wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / msvcp90 / locale.c
blob338ded0082d9d9ced07f10621e7c3d60be0401cc
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 <stdarg.h>
21 #include "assert.h"
22 #include "locale.h"
23 #include "errno.h"
24 #include "limits.h"
25 #include "math.h"
26 #include "mbctype.h"
27 #include "stdio.h"
28 #include "wchar.h"
29 #include "wctype.h"
30 #include "time.h"
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winnls.h"
34 #include "msvcp90.h"
35 #include "wine/heap.h"
36 #include "wine/list.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
41 typedef enum {
42 DATEORDER_no_order,
43 DATEORDER_dmy,
44 DATEORDER_mdy,
45 DATEORDER_ymd,
46 DATEORDER_ydm
47 } dateorder;
49 char* __cdecl _Getdays(void);
50 wchar_t* __cdecl _W_Getdays(void);
51 char* __cdecl _Getmonths(void);
52 wchar_t* __cdecl _W_Getmonths(void);
53 void* __cdecl _Gettnames(void);
54 unsigned int __cdecl ___lc_codepage_func(void);
55 int __cdecl ___lc_collate_cp_func(void);
56 const unsigned short* __cdecl __pctype_func(void);
57 const locale_facet* __thiscall locale__Getfacet(const locale*, size_t);
58 const locale* __cdecl locale_classic(void);
60 #if _MSVCP_VER >= 110
61 wchar_t ** __cdecl ___lc_locale_name_func(void);
62 #else
63 LCID* __cdecl ___lc_handle_func(void);
64 #endif
66 #if _MSVCP_VER < 100
67 #define locale_string basic_string_char
68 #define locale_string_char_ctor(this) MSVCP_basic_string_char_ctor(this)
69 #define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
70 #define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
71 #define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
72 #define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
73 #define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
74 #else
75 #define locale_string _Yarn_char
76 #define locale_string_char_ctor(this) _Yarn_char_ctor(this)
77 #define locale_string_char_ctor_cstr(this,str) _Yarn_char_ctor_cstr(this,str)
78 #define locale_string_char_copy_ctor(this,copy) _Yarn_char_copy_ctor(this,copy)
79 #define locale_string_char_dtor(this) _Yarn_char_dtor(this)
80 #define locale_string_char_c_str(this) _Yarn_char_c_str(this)
81 #define locale_string_char_assign(this,assign) _Yarn_char_op_assign(this,assign)
83 #define locale_string_wchar _Yarn_wchar
84 #define locale_string_wchar_ctor(this) _Yarn_wchar_ctor(this)
85 #define locale_string_wchar_dtor(this) _Yarn_wchar_dtor(this)
86 #define locale_string_wchar_c_str(this) _Yarn_wchar__C_str(this)
87 #define locale_string_wchar_assign(this,str) _Yarn_wchar_op_assign_cstr(this,str)
88 #endif
90 typedef int category;
92 typedef struct {
93 size_t id;
94 } locale_id;
96 typedef struct _locale__Locimp {
97 locale_facet facet;
98 locale_facet **facetvec;
99 size_t facet_cnt;
100 category catmask;
101 bool transparent;
102 locale_string name;
103 } locale__Locimp;
105 typedef struct {
106 void *timeptr;
107 } _Timevec;
109 typedef struct {
110 _Lockit lock;
111 locale_string days;
112 locale_string months;
113 #if _MSVCP_VER >= 110
114 locale_string_wchar wdays;
115 locale_string_wchar wmonths;
116 #endif
117 locale_string oldlocname;
118 locale_string newlocname;
119 } _Locinfo;
121 typedef struct {
122 #if _MSVCP_VER < 110
123 LCID handle;
124 #endif
125 unsigned page;
126 #if _MSVCP_VER >= 110
127 wchar_t *lc_name;
128 #endif
129 } _Collvec;
131 typedef struct {
132 locale_facet facet;
133 _Collvec coll;
134 } collate;
136 typedef struct {
137 locale_facet facet;
138 const char *grouping;
139 char dp;
140 char sep;
141 const char *false_name;
142 const char *true_name;
143 } numpunct_char;
145 typedef struct {
146 locale_facet facet;
147 const char *grouping;
148 wchar_t dp;
149 wchar_t sep;
150 const wchar_t *false_name;
151 const wchar_t *true_name;
152 } numpunct_wchar;
154 typedef struct {
155 locale_facet facet;
156 _Timevec time;
157 #if _MSVCP_VER <= 100
158 _Cvtvec cvt;
159 #endif
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 typedef struct {
171 locale_facet facet;
172 const wchar_t *days;
173 const wchar_t *months;
174 dateorder dateorder;
175 _Cvtvec cvt;
176 } time_get_wchar;
178 /* ?_Id_cnt@id@locale@std@@0HA */
179 int locale_id__Id_cnt = 0;
181 static locale classic_locale;
183 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
184 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
185 locale__Locimp *global_locale = NULL;
187 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
188 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
189 locale__Locimp *locale__Locimp__Clocptr = NULL;
191 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
193 if(this->strbuf && !this->got) {
194 int c = basic_streambuf_char_sgetc(this->strbuf);
195 if(c == EOF)
196 this->strbuf = NULL;
197 else
198 this->val = c;
201 this->got = TRUE;
202 return this->val;
205 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
207 if(this->strbuf && !this->got) {
208 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
209 if(c == WEOF)
210 this->strbuf = NULL;
211 else
212 this->val = c;
215 this->got = TRUE;
216 return this->val;
219 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
221 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
222 this->strbuf = NULL;
223 this->got = TRUE;
224 }else {
225 this->got = FALSE;
226 istreambuf_iterator_char_val(this);
230 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
232 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
233 this->strbuf = NULL;
234 this->got = TRUE;
235 }else {
236 this->got = FALSE;
237 istreambuf_iterator_wchar_val(this);
241 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
243 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
244 this->failed = TRUE;
247 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
249 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
250 this->failed = TRUE;
253 /* ??1facet@locale@std@@UAE@XZ */
254 /* ??1facet@locale@std@@UEAA@XZ */
255 /* ??1facet@locale@std@@MAA@XZ */
256 /* ??1facet@locale@std@@MAE@XZ */
257 /* ??1facet@locale@std@@MEAA@XZ */
258 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
259 void __thiscall locale_facet_dtor(locale_facet *this)
261 TRACE("(%p)\n", this);
264 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
265 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
266 locale_facet*, (locale_facet*, unsigned int), (this, flags))
267 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
269 TRACE("(%p %x)\n", this, flags);
270 if(flags & 2) {
271 /* we have an array, with the number of elements stored before the first object */
272 INT_PTR i, *ptr = (INT_PTR *)this-1;
274 for(i=*ptr-1; i>=0; i--)
275 locale_facet_dtor(this+i);
276 MSVCRT_operator_delete(ptr);
277 } else {
278 locale_facet_dtor(this);
279 if(flags & 1)
280 MSVCRT_operator_delete(this);
283 return this;
286 typedef struct
288 locale_facet *fac;
289 struct list entry;
290 } facets_elem;
291 static struct list lazy_facets = LIST_INIT(lazy_facets);
293 /* Not exported from msvcp90 */
294 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
295 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
296 void __cdecl locale_facet_register(locale_facet *add)
298 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
299 if(!head) {
300 ERR("Out of memory\n");
301 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
304 head->fac = add;
305 list_add_head(&lazy_facets, &head->entry);
308 /* Not exported from msvcp90 */
309 /* ?_Register@facet@locale@std@@QAEXXZ */
310 /* ?_Register@facet@locale@std@@QEAAXXZ */
311 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
312 void __thiscall locale_facet__Register(locale_facet *this)
314 TRACE("(%p)\n", this);
315 locale_facet_register(this);
318 /* Not exported from msvcp90 */
319 /* ??_7facet@locale@std@@6B@ */
320 extern const vtable_ptr MSVCP_locale_facet_vtable;
322 /* ??0id@locale@std@@QAE@I@Z */
323 /* ??0id@locale@std@@QEAA@_K@Z */
324 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
325 locale_id* __thiscall locale_id_ctor_id(locale_id *this, size_t id)
327 TRACE("(%p %Iu)\n", this, id);
329 this->id = id;
330 return this;
333 /* ??_Fid@locale@std@@QAEXXZ */
334 /* ??_Fid@locale@std@@QEAAXXZ */
335 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
336 locale_id* __thiscall locale_id_ctor(locale_id *this)
338 TRACE("(%p)\n", this);
340 this->id = 0;
341 return this;
344 /* ??Bid@locale@std@@QAEIXZ */
345 /* ??Bid@locale@std@@QEAA_KXZ */
346 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
347 size_t __thiscall locale_id_operator_size_t(locale_id *this)
349 _Lockit lock;
351 TRACE("(%p)\n", this);
353 if(!this->id) {
354 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
355 this->id = ++locale_id__Id_cnt;
356 _Lockit_dtor(&lock);
359 return this->id;
362 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
363 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
364 int* __cdecl locale_id__Id_cnt_func(void)
366 TRACE("\n");
367 return &locale_id__Id_cnt;
370 /* ??_Ffacet@locale@std@@QAEXXZ */
371 /* ??_Ffacet@locale@std@@QEAAXXZ */
372 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
373 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
375 TRACE("(%p)\n", this);
376 this->vtable = &MSVCP_locale_facet_vtable;
377 this->refs = 0;
378 return this;
381 /* ??0facet@locale@std@@IAE@I@Z */
382 /* ??0facet@locale@std@@IEAA@_K@Z */
383 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
384 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, size_t refs)
386 TRACE("(%p %Iu)\n", this, refs);
387 this->vtable = &MSVCP_locale_facet_vtable;
388 this->refs = refs;
389 return this;
392 /* ?_Incref@facet@locale@std@@QAEXXZ */
393 /* ?_Incref@facet@locale@std@@QEAAXXZ */
394 /* ?_Incref@facet@locale@std@@UAEXXZ */
395 /* ?_Incref@facet@locale@std@@UEAAXXZ */
396 #if _MSVCP_VER >= 110
397 #define call_locale_facet__Incref(this) CALL_VTBL_FUNC(this, 4, void, (locale_facet*), (this))
398 #else
399 #define call_locale_facet__Incref locale_facet__Incref
400 #endif
401 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
402 void __thiscall locale_facet__Incref(locale_facet *this)
404 _Lockit lock;
406 TRACE("(%p)\n", this);
408 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
409 this->refs++;
410 _Lockit_dtor(&lock);
413 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
414 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
415 /* ?_Decref@facet@locale@std@@UAEPAV_Facet_base@3@XZ */
416 /* ?_Decref@facet@locale@std@@UEAAPEAV_Facet_base@3@XZ */
417 #if _MSVCP_VER >= 110
418 #define call_locale_facet__Decref(this) CALL_VTBL_FUNC(this, 8, \
419 locale_facet*, (locale_facet*), (this))
420 #else
421 #define call_locale_facet__Decref locale_facet__Decref
422 #endif
423 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
424 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
426 _Lockit lock;
427 locale_facet *ret;
429 TRACE("(%p)\n", this);
431 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
432 if(this->refs)
433 this->refs--;
435 ret = this->refs ? NULL : this;
436 _Lockit_dtor(&lock);
438 return ret;
441 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
442 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
443 size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
445 TRACE("(%p %p)\n", facet, loc);
446 return -1;
449 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@@Z */
450 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@@Z */
451 size_t __cdecl locale_facet__Getcat_old(const locale_facet **facet)
453 TRACE("(%p)\n", facet);
454 return -1;
457 /* ??0_Timevec@std@@QAE@ABV01@@Z */
458 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
459 /* This copy constructor modifies copied object */
460 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
461 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
463 TRACE("(%p %p)\n", this, copy);
464 this->timeptr = copy->timeptr;
465 copy->timeptr = NULL;
466 return this;
469 /* ??0_Timevec@std@@QAE@PAX@Z */
470 /* ??0_Timevec@std@@QEAA@PEAX@Z */
471 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
472 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
474 TRACE("(%p %p)\n", this, timeptr);
475 this->timeptr = timeptr;
476 return this;
479 /* ??_F_Timevec@std@@QAEXXZ */
480 /* ??_F_Timevec@std@@QEAAXXZ */
481 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
482 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
484 TRACE("(%p)\n", this);
485 this->timeptr = NULL;
486 return this;
489 /* ??1_Timevec@std@@QAE@XZ */
490 /* ??1_Timevec@std@@QEAA@XZ */
491 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
492 void __thiscall _Timevec_dtor(_Timevec *this)
494 TRACE("(%p)\n", this);
495 free(this->timeptr);
498 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
499 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
500 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
501 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
503 TRACE("(%p %p)\n", this, right);
504 this->timeptr = right->timeptr;
505 right->timeptr = NULL;
506 return this;
509 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
510 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
511 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
512 void* __thiscall _Timevec__Getptr(_Timevec *this)
514 TRACE("(%p)\n", this);
515 return this->timeptr;
518 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
519 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
520 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
522 const char *locale = NULL;
524 /* This function is probably modifying more global objects */
525 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
527 if(!locstr)
528 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
530 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
531 locale_string_char_ctor(&locinfo->days);
532 locale_string_char_ctor(&locinfo->months);
533 #if _MSVCP_VER >= 110
534 locale_string_wchar_ctor(&locinfo->wdays);
535 locale_string_wchar_ctor(&locinfo->wmonths);
536 #endif
537 locale_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
539 if(category)
540 locale = setlocale(LC_ALL, locstr);
541 else
542 locale = setlocale(LC_ALL, NULL);
544 if(locale)
545 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
546 else
547 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
549 return locinfo;
552 /* ??0_Locinfo@std@@QAE@HPBD@Z */
553 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
554 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
555 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
557 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
560 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
561 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
562 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
564 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
567 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
568 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
569 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
570 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
572 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
575 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
576 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
577 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
579 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
582 /* ??0_Locinfo@std@@QAE@PBD@Z */
583 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
584 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
585 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
587 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
590 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
591 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
592 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
594 TRACE("(%p)\n", locinfo);
596 setlocale(LC_ALL, locale_string_char_c_str(&locinfo->oldlocname));
597 locale_string_char_dtor(&locinfo->days);
598 locale_string_char_dtor(&locinfo->months);
599 #if _MSVCP_VER >= 110
600 locale_string_wchar_dtor(&locinfo->wdays);
601 locale_string_wchar_dtor(&locinfo->wmonths);
602 #endif
603 locale_string_char_dtor(&locinfo->oldlocname);
604 locale_string_char_dtor(&locinfo->newlocname);
605 _Lockit_dtor(&locinfo->lock);
608 /* ??_F_Locinfo@std@@QAEXXZ */
609 /* ??_F_Locinfo@std@@QEAAXXZ */
610 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
611 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
613 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
616 /* ??1_Locinfo@std@@QAE@XZ */
617 /* ??1_Locinfo@std@@QEAA@XZ */
618 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
619 void __thiscall _Locinfo_dtor(_Locinfo *this)
621 _Locinfo__Locinfo_dtor(this);
624 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
625 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
626 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
628 const char *locale = NULL;
630 /* This function is probably modifying more global objects */
631 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
632 if(!locstr)
633 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
635 locale_string_char_dtor(&locinfo->newlocname);
637 if(category)
638 locale = setlocale(LC_ALL, locstr);
639 else
640 locale = setlocale(LC_ALL, NULL);
642 if(locale)
643 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
644 else
645 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
647 return locinfo;
650 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
651 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
652 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
653 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
655 return _Locinfo__Locinfo_Addcats(this, category, locstr);
658 static _Collvec* getcoll(_Collvec *ret)
660 TRACE("\n");
662 ret->page = ___lc_collate_cp_func();
663 #if _MSVCP_VER < 110
664 ret->handle = ___lc_handle_func()[LC_COLLATE];
665 #else
666 ret->lc_name = ___lc_locale_name_func()[LC_COLLATE];
667 #endif
668 return ret;
671 /* _Getcoll */
672 #if defined(__i386__) || _MSVCP_VER<110
673 ULONGLONG __cdecl _Getcoll(void)
675 ULONGLONG ret;
677 C_ASSERT(sizeof(_Collvec) <= sizeof(ULONGLONG));
679 getcoll((_Collvec*)&ret);
680 return ret;
682 #else
683 _Collvec* __cdecl _Getcoll(_Collvec *ret)
685 return getcoll(ret);
687 #endif
689 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
690 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
691 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
692 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
694 return getcoll(ret);
697 /* _Getctype */
698 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
700 short *table;
701 #if _MSVCP_VER >= 110
702 wchar_t *name;
703 size_t size;
704 #endif
706 TRACE("\n");
708 ret->page = ___lc_codepage_func();
709 #if _MSVCP_VER < 110
710 ret->handle = ___lc_handle_func()[LC_COLLATE];
711 #else
712 if((name = ___lc_locale_name_func()[LC_COLLATE])) {
713 size = wcslen(name)+1;
714 ret->name = malloc(size*sizeof(*name));
715 if(!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
716 memcpy(ret->name, name, size*sizeof(*name));
717 } else {
718 ret->name = NULL;
720 #endif
721 ret->delfl = TRUE;
722 table = malloc(sizeof(short[256]));
723 if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
724 memcpy(table, __pctype_func(), sizeof(short[256]));
725 ret->table = table;
726 return ret;
729 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
730 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
731 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
732 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
734 return _Getctype(ret);
737 /* _Getcvt */
738 #if _MSVCP_VER < 110
739 ULONGLONG __cdecl _Getcvt(void)
741 union {
742 _Cvtvec cvtvec;
743 ULONGLONG ull;
744 } ret;
746 TRACE("\n");
748 ret.cvtvec.page = ___lc_codepage_func();
749 ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
750 return ret.ull;
752 #else
753 _Cvtvec* __cdecl _Getcvt(_Cvtvec *ret)
755 int i;
757 TRACE("\n");
759 memset(ret, 0, sizeof(*ret));
760 ret->page = ___lc_codepage_func();
761 ret->mb_max = ___mb_cur_max_func();
763 if(ret->mb_max > 1) {
764 for(i=0; i<256; i++)
765 if(_ismbblead(i)) ret->isleadbyte[i/8] |= 1 << (i&7);
767 return ret;
769 #endif
771 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
772 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
773 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
774 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
776 #if _MSVCP_VER < 110
777 ULONGLONG ull = _Getcvt();
778 memcpy(ret, &ull, sizeof(ull));
779 #else
780 _Cvtvec cvtvec;
781 _Getcvt(&cvtvec);
782 memcpy(ret, &cvtvec, sizeof(cvtvec));
783 #endif
784 return ret;
787 int __cdecl _Getdateorder(void)
789 WCHAR date_fmt[2];
791 #if _MSVCP_VER < 110
792 if(!GetLocaleInfoW(___lc_handle_func()[LC_TIME], LOCALE_ILDATE,
793 date_fmt, ARRAY_SIZE(date_fmt)))
794 return DATEORDER_no_order;
795 #else
796 if(!GetLocaleInfoEx(___lc_locale_name_func()[LC_TIME], LOCALE_ILDATE,
797 date_fmt, ARRAY_SIZE(date_fmt)))
798 return DATEORDER_no_order;
799 #endif
801 if(*date_fmt == '0') return DATEORDER_mdy;
802 if(*date_fmt == '1') return DATEORDER_dmy;
803 if(*date_fmt == '2') return DATEORDER_ymd;
804 return DATEORDER_no_order;
807 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
808 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
809 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
810 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
812 TRACE("(%p)\n", this);
813 return _Getdateorder();
816 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
817 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
818 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
819 const char* __thiscall _Locinfo__Getdays(const _Locinfo *this)
821 char *days = _Getdays();
822 const char *ret;
824 TRACE("(%p)\n", this);
826 if(days) {
827 locale_string_char_dtor((locale_string *)&this->days);
828 locale_string_char_ctor_cstr((locale_string *)&this->days, days);
829 free(days);
832 ret = locale_string_char_c_str(&this->days);
833 if (!ret[0]) ret = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
834 return ret;
837 #if _MSVCP_VER >= 110
838 /* ?_W_Getdays@_Locinfo@std@@QBEPBGXZ */
839 /* ?_W_Getdays@_Locinfo@std@@QEBAPEBGXZ */
840 DEFINE_THISCALL_WRAPPER(_Locinfo__W_Getdays, 4)
841 const wchar_t* __thiscall _Locinfo__W_Getdays(const _Locinfo *this)
843 static const wchar_t defdays[] =
845 ':','S','u','n',':','S','u','n','d','a','y',
846 ':','M','o','n',':','M','o','n','d','a','y',
847 ':','T','u','e',':','T','u','e','s','d','a','y',
848 ':','W','e','d',':','W','e','d','n','e','s','d','a','y',
849 ':','T','h','u',':','T','h','u','r','s','d','a','y',
850 ':','F','r','i',':','F','r','i','d','a','y',
851 ':','S','a','t',':','S','a','t','u','r','d','a','y'
853 wchar_t *wdays = _W_Getdays();
854 const wchar_t *ret;
856 TRACE("(%p)\n", this);
858 if(wdays) {
859 locale_string_wchar_assign((locale_string_wchar *)&this->wdays, wdays);
860 free(wdays);
863 ret = locale_string_wchar_c_str(&this->wdays);
864 if (!ret[0]) ret = defdays;
865 return ret;
868 /* ?_W_Getmonths@_Locinfo@std@@QBEPBGXZ */
869 /* ?_W_Getmonths@_Locinfo@std@@QEBAPEBGXZ */
870 DEFINE_THISCALL_WRAPPER(_Locinfo__W_Getmonths, 4)
871 const wchar_t* __thiscall _Locinfo__W_Getmonths(const _Locinfo *this)
873 static const wchar_t defmonths[] =
875 ':','J','a','n',':','J','a','n','u','a','r','y',
876 ':','F','e','b',':','F','e','b','r','u','a','r','y',
877 ':','M','a','r',':','M','a','r','c','h',
878 ':','A','p','r',':','A','p','r','i','l',
879 ':','M','a','y',':','M','a','y',
880 ':','J','u','n',':','J','u','n','e',
881 ':','J','u','l',':','J','u','l','y',
882 ':','A','u','g',':','A','u','g','u','s','t',
883 ':','S','e','p',':','S','e','p','t','e','m','b','e','r',
884 ':','O','c','t',':','O','c','t','o','b','e','r',
885 ':','N','o','v',':','N','o','v','e','m','b','e','r',
886 ':','D','e','c',':','D','e','c','e','m','b','e','r'
888 wchar_t *wmonths = _W_Getmonths();
889 const wchar_t *ret;
891 TRACE("(%p)\n", this);
893 if(wmonths) {
894 locale_string_wchar_assign((locale_string_wchar *)&this->wmonths, wmonths);
895 free(wmonths);
898 ret = locale_string_wchar_c_str(&this->wmonths);
899 if (!ret[0]) ret = defmonths;
900 return ret;
902 #endif
904 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
905 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
906 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
907 const char* __thiscall _Locinfo__Getmonths(const _Locinfo *this)
909 char *months = _Getmonths();
910 const char *ret;
912 TRACE("(%p)\n", this);
914 if(months) {
915 locale_string_char_dtor((locale_string *)&this->months);
916 locale_string_char_ctor_cstr((locale_string *)&this->months, months);
917 free(months);
920 ret = locale_string_char_c_str(&this->months);
921 if (!ret[0]) ret = ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
922 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
923 return ret;
926 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
927 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
928 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
929 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
931 TRACE("(%p)\n", this);
932 return "false";
935 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
936 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
937 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
938 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
940 TRACE("(%p)\n", this);
941 return "true";
944 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
945 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
946 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
947 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
949 TRACE("(%p)\n", this);
950 return localeconv();
953 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
954 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
955 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
956 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
958 TRACE("(%p)\n", this);
960 _Timevec_ctor_timeptr(ret, _Gettnames());
961 return ret;
964 /* ?id@?$collate@D@std@@2V0locale@2@A */
965 locale_id collate_char_id = {0};
967 /* ??_7?$collate@D@std@@6B@ */
968 extern const vtable_ptr MSVCP_collate_char_vtable;
970 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
971 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
972 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
973 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
975 TRACE("(%p %p)\n", this, locinfo);
976 _Locinfo__Getcoll(locinfo, &this->coll);
979 /* ??0?$collate@D@std@@IAE@PBDI@Z */
980 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
981 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
982 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, size_t refs)
984 _Locinfo locinfo;
986 TRACE("(%p %s %Iu)\n", this, name, refs);
988 locale_facet_ctor_refs(&this->facet, refs);
989 this->facet.vtable = &MSVCP_collate_char_vtable;
991 _Locinfo_ctor_cstr(&locinfo, name);
992 collate_char__Init(this, &locinfo);
993 _Locinfo_dtor(&locinfo);
994 return this;
997 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
998 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
999 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
1000 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, size_t refs)
1002 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
1004 locale_facet_ctor_refs(&this->facet, refs);
1005 this->facet.vtable = &MSVCP_collate_char_vtable;
1006 collate_char__Init(this, locinfo);
1007 return this;
1010 /* ??0?$collate@D@std@@QAE@I@Z */
1011 /* ??0?$collate@D@std@@QEAA@_K@Z */
1012 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
1013 collate* __thiscall collate_char_ctor_refs(collate *this, size_t refs)
1015 return collate_char_ctor_name(this, "C", refs);
1018 /* ??1?$collate@D@std@@UAE@XZ */
1019 /* ??1?$collate@D@std@@UEAA@XZ */
1020 /* ??1?$collate@D@std@@MAE@XZ */
1021 /* ??1?$collate@D@std@@MEAA@XZ */
1022 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
1023 void __thiscall collate_char_dtor(collate *this)
1025 TRACE("(%p)\n", this);
1028 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
1029 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
1031 TRACE("(%p %x)\n", this, flags);
1032 if(flags & 2) {
1033 /* we have an array, with the number of elements stored before the first object */
1034 INT_PTR i, *ptr = (INT_PTR *)this-1;
1036 for(i=*ptr-1; i>=0; i--)
1037 collate_char_dtor(this+i);
1038 MSVCRT_operator_delete(ptr);
1039 } else {
1040 collate_char_dtor(this);
1041 if(flags & 1)
1042 MSVCRT_operator_delete(this);
1045 return this;
1048 /* ??_F?$collate@D@std@@QAEXXZ */
1049 /* ??_F?$collate@D@std@@QEAAXXZ */
1050 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
1051 collate* __thiscall collate_char_ctor(collate *this)
1053 return collate_char_ctor_name(this, "C", 0);
1056 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1057 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1058 size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
1060 TRACE("(%p %p)\n", facet, loc);
1062 if(facet && !*facet) {
1063 *facet = MSVCRT_operator_new(sizeof(collate));
1064 if(!*facet) {
1065 ERR("Out of memory\n");
1066 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1067 return 0;
1069 collate_char_ctor_name((collate*)*facet,
1070 locale_string_char_c_str(&loc->ptr->name), 0);
1073 return LC_COLLATE;
1076 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@@Z */
1077 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1078 size_t __cdecl collate_char__Getcat_old(const locale_facet **facet)
1080 return collate_char__Getcat(facet, locale_classic());
1083 static collate* collate_char_use_facet(const locale *loc)
1085 static collate *obj = NULL;
1087 _Lockit lock;
1088 const locale_facet *fac;
1090 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1091 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id));
1092 if(fac) {
1093 _Lockit_dtor(&lock);
1094 return (collate*)fac;
1097 if(obj) {
1098 _Lockit_dtor(&lock);
1099 return obj;
1102 collate_char__Getcat(&fac, loc);
1103 obj = (collate*)fac;
1104 call_locale_facet__Incref(&obj->facet);
1105 locale_facet_register(&obj->facet);
1106 _Lockit_dtor(&lock);
1108 return obj;
1111 /* _Strcoll */
1112 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
1113 const char *last2, const _Collvec *coll)
1115 LCID lcid;
1117 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
1119 #if _MSVCP_VER < 110
1120 lcid = (coll ? coll->handle : ___lc_handle_func()[LC_COLLATE]);
1121 #else
1122 lcid = LocaleNameToLCID(coll ? coll->lc_name : ___lc_locale_name_func()[LC_COLLATE], 0);
1123 #endif
1124 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1127 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
1128 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
1129 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
1130 #if _MSVCP_VER <= 100
1131 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1132 (const collate*, const char*, const char*, const char*, const char*), \
1133 (this, first1, last1, first2, last2))
1134 #else
1135 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1136 (const collate*, const char*, const char*, const char*, const char*), \
1137 (this, first1, last1, first2, last2))
1138 #endif
1139 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
1140 const char *last1, const char *first2, const char *last2)
1142 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1143 return _Strcoll(first1, last1, first2, last2, &this->coll);
1146 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
1147 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
1148 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
1149 int __thiscall collate_char_compare(const collate *this, const char *first1,
1150 const char *last1, const char *first2, const char *last2)
1152 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1153 return call_collate_char_do_compare(this, first1, last1, first2, last2);
1156 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
1157 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
1158 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
1159 #if _MSVCP_VER <= 100
1160 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1161 (const collate*, const char*, const char*), (this, first, last))
1162 #else
1163 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1164 (const collate*, const char*, const char*), (this, first, last))
1165 #endif
1166 LONG __thiscall collate_char_do_hash(const collate *this,
1167 const char *first, const char *last)
1169 ULONG ret = 0;
1171 TRACE("(%p %p %p)\n", this, first, last);
1173 for(; first<last; first++)
1174 ret = (ret<<8 | ret>>24) + *first;
1175 return ret;
1178 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
1179 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
1180 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
1181 LONG __thiscall collate_char_hash(const collate *this,
1182 const char *first, const char *last)
1184 TRACE("(%p %p %p)\n", this, first, last);
1185 return call_collate_char_do_hash(this, first, last);
1188 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1189 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1190 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
1191 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
1192 basic_string_char *ret, const char *first, const char *last)
1194 FIXME("(%p %p %p) stub\n", this, first, last);
1195 return ret;
1198 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1199 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1200 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
1201 basic_string_char* __thiscall collate_char_transform(const collate *this,
1202 basic_string_char *ret, const char *first, const char *last)
1204 FIXME("(%p %p %p) stub\n", this, first, last);
1205 return ret;
1208 /* ?id@?$collate@_W@std@@2V0locale@2@A */
1209 locale_id collate_wchar_id = {0};
1210 /* ?id@?$collate@G@std@@2V0locale@2@A */
1211 locale_id collate_short_id = {0};
1213 /* ??_7?$collate@_W@std@@6B@ */
1214 extern const vtable_ptr MSVCP_collate_wchar_vtable;
1215 /* ??_7?$collate@G@std@@6B@ */
1216 extern const vtable_ptr MSVCP_collate_short_vtable;
1218 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
1219 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1220 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
1221 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1222 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
1223 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
1225 TRACE("(%p %p)\n", this, locinfo);
1226 _Locinfo__Getcoll(locinfo, &this->coll);
1229 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
1230 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
1231 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
1232 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, size_t refs)
1234 _Locinfo locinfo;
1236 TRACE("(%p %s %Iu)\n", this, name, refs);
1238 locale_facet_ctor_refs(&this->facet, refs);
1239 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1241 _Locinfo_ctor_cstr(&locinfo, name);
1242 collate_wchar__Init(this, &locinfo);
1243 _Locinfo_dtor(&locinfo);
1244 return this;
1247 /* ??0?$collate@G@std@@IAE@PBDI@Z */
1248 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
1249 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
1250 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, size_t refs)
1252 collate *ret = collate_wchar_ctor_name(this, name, refs);
1253 ret->facet.vtable = &MSVCP_collate_short_vtable;
1254 return ret;
1257 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1258 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1259 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
1260 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, size_t refs)
1262 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
1264 locale_facet_ctor_refs(&this->facet, refs);
1265 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1266 collate_wchar__Init(this, locinfo);
1267 return this;
1270 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
1271 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1272 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
1273 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, size_t refs)
1275 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
1276 ret->facet.vtable = &MSVCP_collate_short_vtable;
1277 return ret;
1280 /* ??0?$collate@_W@std@@QAE@I@Z */
1281 /* ??0?$collate@_W@std@@QEAA@_K@Z */
1282 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
1283 collate* __thiscall collate_wchar_ctor_refs(collate *this, size_t refs)
1285 return collate_wchar_ctor_name(this, "C", refs);
1288 /* ??0?$collate@G@std@@QAE@I@Z */
1289 /* ??0?$collate@G@std@@QEAA@_K@Z */
1290 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1291 collate* __thiscall collate_short_ctor_refs(collate *this, size_t refs)
1293 collate *ret = collate_wchar_ctor_refs(this, refs);
1294 ret->facet.vtable = &MSVCP_collate_short_vtable;
1295 return ret;
1298 /* ??1?$collate@G@std@@UAE@XZ */
1299 /* ??1?$collate@G@std@@UEAA@XZ */
1300 /* ??1?$collate@_W@std@@MAE@XZ */
1301 /* ??1?$collate@_W@std@@MEAA@XZ */
1302 /* ??1?$collate@G@std@@MAE@XZ */
1303 /* ??1?$collate@G@std@@MEAA@XZ */
1304 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1305 void __thiscall collate_wchar_dtor(collate *this)
1307 TRACE("(%p)\n", this);
1310 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1311 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1313 TRACE("(%p %x)\n", this, flags);
1314 if(flags & 2) {
1315 /* we have an array, with the number of elements stored before the first object */
1316 INT_PTR i, *ptr = (INT_PTR *)this-1;
1318 for(i=*ptr-1; i>=0; i--)
1319 collate_wchar_dtor(this+i);
1320 MSVCRT_operator_delete(ptr);
1321 } else {
1322 collate_wchar_dtor(this);
1323 if(flags & 1)
1324 MSVCRT_operator_delete(this);
1327 return this;
1330 /* ??_F?$collate@_W@std@@QAEXXZ */
1331 /* ??_F?$collate@_W@std@@QEAAXXZ */
1332 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1333 collate* __thiscall collate_wchar_ctor(collate *this)
1335 return collate_wchar_ctor_name(this, "C", 0);
1338 /* ??_F?$collate@G@std@@QAEXXZ */
1339 /* ??_F?$collate@G@std@@QEAAXXZ */
1340 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1341 collate* __thiscall collate_short_ctor(collate *this)
1343 collate *ret = collate_wchar_ctor(this);
1344 ret->facet.vtable = &MSVCP_collate_short_vtable;
1345 return ret;
1348 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1349 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1350 size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1352 TRACE("(%p %p)\n", facet, loc);
1354 if(facet && !*facet) {
1355 *facet = MSVCRT_operator_new(sizeof(collate));
1356 if(!*facet) {
1357 ERR("Out of memory\n");
1358 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1359 return 0;
1361 collate_wchar_ctor_name((collate*)*facet,
1362 locale_string_char_c_str(&loc->ptr->name), 0);
1365 return LC_COLLATE;
1368 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@@Z */
1369 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1370 size_t __cdecl collate_wchar__Getcat_old(const locale_facet **facet)
1372 return collate_wchar__Getcat(facet, locale_classic());
1375 static collate* collate_wchar_use_facet(const locale *loc)
1377 static collate *obj = NULL;
1379 _Lockit lock;
1380 const locale_facet *fac;
1382 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1383 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id));
1384 if(fac) {
1385 _Lockit_dtor(&lock);
1386 return (collate*)fac;
1389 if(obj) {
1390 _Lockit_dtor(&lock);
1391 return obj;
1394 collate_wchar__Getcat(&fac, loc);
1395 obj = (collate*)fac;
1396 call_locale_facet__Incref(&obj->facet);
1397 locale_facet_register(&obj->facet);
1398 _Lockit_dtor(&lock);
1400 return obj;
1403 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1404 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1405 size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1407 if(facet && !*facet) {
1408 collate_wchar__Getcat(facet, loc);
1409 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1412 return LC_COLLATE;
1415 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@@Z */
1416 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1417 size_t __cdecl collate_short__Getcat_old(const locale_facet **facet)
1419 return collate_short__Getcat(facet, locale_classic());
1422 static collate* collate_short_use_facet(const locale *loc)
1424 static collate *obj = NULL;
1426 _Lockit lock;
1427 const locale_facet *fac;
1429 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1430 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id));
1431 if(fac) {
1432 _Lockit_dtor(&lock);
1433 return (collate*)fac;
1436 if(obj) {
1437 _Lockit_dtor(&lock);
1438 return obj;
1441 collate_short__Getcat(&fac, loc);
1442 obj = (collate*)fac;
1443 call_locale_facet__Incref(&obj->facet);
1444 locale_facet_register(&obj->facet);
1445 _Lockit_dtor(&lock);
1447 return obj;
1450 /* _Wcscoll */
1451 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1452 const wchar_t *last2, const _Collvec *coll)
1454 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1456 #if _MSVCP_VER < 110
1457 return CompareStringW(coll ? coll->handle : ___lc_handle_func()[LC_COLLATE],
1458 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1459 #else
1460 return CompareStringEx(coll ? coll->lc_name : ___lc_locale_name_func()[LC_COLLATE],
1461 0, first1, last1-first1, first2, last2-first2, NULL, NULL, 0)-CSTR_EQUAL;
1462 #endif
1465 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1466 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1467 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1468 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1469 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1470 #if _MSVCP_VER <= 100
1471 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1472 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1473 (this, first1, last1, first2, last2))
1474 #else
1475 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1476 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1477 (this, first1, last1, first2, last2))
1478 #endif
1479 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1480 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1482 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1483 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1486 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1487 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1488 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1489 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1490 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1491 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1492 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1494 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1495 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1498 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1499 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1500 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1501 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1502 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1503 #if _MSVCP_VER <= 100
1504 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1505 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1506 #else
1507 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1508 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1509 #endif
1510 LONG __thiscall collate_wchar_do_hash(const collate *this,
1511 const wchar_t *first, const wchar_t *last)
1513 ULONG ret = 0;
1515 TRACE("(%p %p %p)\n", this, first, last);
1517 for(; first<last; first++)
1518 ret = (ret<<8 | ret>>24) + *first;
1519 return ret;
1522 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1523 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1524 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1525 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1526 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1527 LONG __thiscall collate_wchar_hash(const collate *this,
1528 const wchar_t *first, const wchar_t *last)
1530 TRACE("(%p %p %p)\n", this, first, last);
1531 return call_collate_wchar_do_hash(this, first, last);
1534 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1535 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1536 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1537 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1538 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1539 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1540 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1542 FIXME("(%p %p %p) stub\n", this, first, last);
1543 return ret;
1546 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1547 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1548 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1549 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1550 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1551 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1552 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1554 FIXME("(%p %p %p) stub\n", this, first, last);
1555 return ret;
1558 /* ??_7ctype_base@std@@6B@ */
1559 extern const vtable_ptr MSVCP_ctype_base_vtable;
1561 /* ??0ctype_base@std@@QAE@I@Z */
1562 /* ??0ctype_base@std@@QEAA@_K@Z */
1563 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1564 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, size_t refs)
1566 TRACE("(%p %Iu)\n", this, refs);
1567 locale_facet_ctor_refs(&this->facet, refs);
1568 this->facet.vtable = &MSVCP_ctype_base_vtable;
1569 return this;
1572 /* ??_Fctype_base@std@@QAEXXZ */
1573 /* ??_Fctype_base@std@@QEAAXXZ */
1574 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1575 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1577 TRACE("(%p)\n", this);
1578 locale_facet_ctor_refs(&this->facet, 0);
1579 this->facet.vtable = &MSVCP_ctype_base_vtable;
1580 return this;
1583 /* ??1ctype_base@std@@UAE@XZ */
1584 /* ??1ctype_base@std@@UEAA@XZ */
1585 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1586 void __thiscall ctype_base_dtor(ctype_base *this)
1588 TRACE("(%p)\n", this);
1591 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1592 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1594 TRACE("(%p %x)\n", this, flags);
1595 if(flags & 2) {
1596 /* we have an array, with the number of elements stored before the first object */
1597 INT_PTR i, *ptr = (INT_PTR *)this-1;
1599 for(i=*ptr-1; i>=0; i--)
1600 ctype_base_dtor(this+i);
1601 MSVCRT_operator_delete(ptr);
1602 } else {
1603 ctype_base_dtor(this);
1604 if(flags & 1)
1605 MSVCRT_operator_delete(this);
1608 return this;
1611 /* ?_Xran@ctype_base@std@@KAXXZ */
1612 void __cdecl ctype_base__Xran(void)
1614 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1617 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1618 locale_id ctype_char_id = {0};
1619 /* ?table_size@?$ctype@D@std@@2IB */
1620 /* ?table_size@?$ctype@D@std@@2_KB */
1621 size_t ctype_char_table_size = 256;
1623 /* ??_7?$ctype@D@std@@6B@ */
1624 extern const vtable_ptr MSVCP_ctype_char_vtable;
1626 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1627 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1628 locale_id* __cdecl ctype_char__Id_func(void)
1630 TRACE("()\n");
1631 return &ctype_char_id;
1634 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1635 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1636 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1637 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1639 TRACE("(%p %p)\n", this, locinfo);
1640 _Locinfo__Getctype(locinfo, &this->ctype);
1643 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1644 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1645 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1646 void __thiscall ctype_char__Tidy(ctype_char *this)
1648 TRACE("(%p)\n", this);
1650 if(this->ctype.delfl)
1651 free((short*)this->ctype.table);
1652 #if _MSVCP_VER >= 110
1653 free(this->ctype.name);
1654 #endif
1657 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1658 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1659 const short* __cdecl ctype_char_classic_table(void)
1661 ctype_char *ctype;
1663 TRACE("()\n");
1664 ctype = ctype_char_use_facet( locale_classic() );
1665 return ctype->ctype.table;
1668 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1669 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1670 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1671 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1672 const _Locinfo *locinfo, size_t refs)
1674 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
1675 ctype_base_ctor_refs(&this->base, refs);
1676 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1677 ctype_char__Init(this, locinfo);
1678 return this;
1681 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1682 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1683 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1684 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1685 const short *table, bool delete, size_t refs)
1687 _Locinfo locinfo;
1689 TRACE("(%p %p %d %Iu)\n", this, table, delete, refs);
1691 ctype_base_ctor_refs(&this->base, refs);
1692 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1694 _Locinfo_ctor(&locinfo);
1695 ctype_char__Init(this, &locinfo);
1696 _Locinfo_dtor(&locinfo);
1698 if(table) {
1699 ctype_char__Tidy(this);
1700 this->ctype.table = table;
1701 this->ctype.delfl = delete;
1703 return this;
1706 /* ??_F?$ctype@D@std@@QAEXXZ */
1707 /* ??_F?$ctype@D@std@@QEAAXXZ */
1708 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1709 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1711 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1714 /* ??1?$ctype@D@std@@UAE@XZ */
1715 /* ??1?$ctype@D@std@@UEAA@XZ */
1716 /* ??1?$ctype@D@std@@MAE@XZ */
1717 /* ??1?$ctype@D@std@@MEAA@XZ */
1718 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1719 void __thiscall ctype_char_dtor(ctype_char *this)
1721 TRACE("(%p)\n", this);
1722 ctype_char__Tidy(this);
1725 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1726 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1728 TRACE("(%p %x)\n", this, flags);
1729 if(flags & 2) {
1730 /* we have an array, with the number of elements stored before the first object */
1731 INT_PTR i, *ptr = (INT_PTR *)this-1;
1733 for(i=*ptr-1; i>=0; i--)
1734 ctype_char_dtor(this+i);
1735 MSVCRT_operator_delete(ptr);
1736 } else {
1737 ctype_char_dtor(this);
1738 if(flags & 1)
1739 MSVCRT_operator_delete(this);
1742 return this;
1745 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1746 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1747 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1748 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1749 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1750 char, (const ctype_char*, char, char), (this, ch, unused))
1751 #elif _MSVCP_VER <= 100
1752 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1753 char, (const ctype_char*, char, char), (this, ch, unused))
1754 #else
1755 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 40, \
1756 char, (const ctype_char*, char, char), (this, ch, unused))
1757 #endif
1758 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1760 TRACE("(%p %c %c)\n", this, ch, unused);
1761 return ch;
1764 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1765 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1766 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1767 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1768 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1769 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1770 (this, first, last, unused, dest))
1771 #elif _MSVCP_VER <= 100
1772 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1773 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1774 (this, first, last, unused, dest))
1775 #else
1776 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 36, \
1777 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1778 (this, first, last, unused, dest))
1779 #endif
1780 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1781 const char *first, const char *last, char unused, char *dest)
1783 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1784 memcpy(dest, first, last-first);
1785 return last;
1788 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1789 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1790 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1791 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1792 const char*, (const ctype_char*, const char*, const char*, char, char*, size_t), \
1793 (this, first, last, unused, dest, size))
1794 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1795 const char *last, char unused, char *dest, size_t size)
1797 TRACE("(%p %p %p %p %Iu)\n", this, first, last, dest, size);
1798 memcpy_s(dest, size, first, last-first);
1799 return last;
1802 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1803 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1804 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1805 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1807 TRACE("(%p %c %c)\n", this, ch, dflt);
1808 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1811 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1812 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1813 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1814 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1815 const char *first, const char *last, char dflt, char *dest)
1817 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1818 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1821 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1822 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1823 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1824 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1825 const char *last, char dflt, char *dest, size_t size)
1827 TRACE("(%p %p %p %p %Iu)\n", this, first, last, dest, size);
1828 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1831 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1832 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1833 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1834 #if _MSVCP_VER <= 100
1835 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1836 char, (const ctype_char*, char), (this, ch))
1837 #else
1838 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
1839 char, (const ctype_char*, char), (this, ch))
1840 #endif
1841 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1843 TRACE("(%p %c)\n", this, ch);
1844 return ch;
1847 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1848 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1849 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1850 #if _MSVCP_VER <= 100
1851 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1852 const char*, (const ctype_char*, const char*, const char*, char*), \
1853 (this, first, last, dest))
1854 #else
1855 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 28, \
1856 const char*, (const ctype_char*, const char*, const char*, char*), \
1857 (this, first, last, dest))
1858 #endif
1859 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1860 const char *first, const char *last, char *dest)
1862 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1863 memcpy(dest, first, last-first);
1864 return last;
1867 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1868 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1869 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1870 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1871 const char*, (const ctype_char*, const char*, const char*, char*, size_t), \
1872 (this, first, last, dest, size))
1873 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1874 const char *first, const char *last, char *dest, size_t size)
1876 TRACE("(%p %p %p %p %Iu)\n", this, first, last, dest, size);
1877 memcpy_s(dest, size, first, last-first);
1878 return last;
1881 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1882 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1883 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1884 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1886 TRACE("(%p %c)\n", this, ch);
1887 return call_ctype_char_do_widen_ch(this, ch);
1890 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1891 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1892 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1893 const char* __thiscall ctype_char_widen(const ctype_char *this,
1894 const char *first, const char *last, char *dest)
1896 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1897 return call_ctype_char_do_widen(this, first, last, dest);
1900 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1901 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1902 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1903 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1904 const char *first, const char *last, char *dest, size_t size)
1906 TRACE("(%p %p %p %p %Iu)\n", this, first, last, dest, size);
1907 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1910 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1911 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1912 size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1914 TRACE("(%p %p)\n", facet, loc);
1916 if(facet && !*facet) {
1917 _Locinfo locinfo;
1919 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1920 if(!*facet) {
1921 ERR("Out of memory\n");
1922 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1923 return 0;
1926 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
1927 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1928 _Locinfo_dtor(&locinfo);
1931 return LC_CTYPE;
1934 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z */
1935 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1936 size_t __cdecl ctype_char__Getcat_old(const locale_facet **facet)
1938 return ctype_char__Getcat(facet, locale_classic());
1941 ctype_char* ctype_char_use_facet(const locale *loc)
1943 static ctype_char *obj = NULL;
1945 _Lockit lock;
1946 const locale_facet *fac;
1948 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1949 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1950 if(fac) {
1951 _Lockit_dtor(&lock);
1952 return (ctype_char*)fac;
1955 if(obj) {
1956 _Lockit_dtor(&lock);
1957 return obj;
1960 ctype_char__Getcat(&fac, loc);
1961 obj = (ctype_char*)fac;
1962 call_locale_facet__Incref(&obj->base.facet);
1963 locale_facet_register(&obj->base.facet);
1964 _Lockit_dtor(&lock);
1966 return obj;
1969 /* _Tolower */
1970 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1972 unsigned int cp;
1974 TRACE("%d %p\n", ch, ctype);
1976 if(ctype)
1977 cp = ctype->page;
1978 else
1979 cp = ___lc_codepage_func();
1981 /* Don't convert to unicode in case of C locale */
1982 if(!cp) {
1983 if(ch>='A' && ch<='Z')
1984 ch = ch-'A'+'a';
1985 return ch;
1986 } else {
1987 WCHAR wide, lower;
1988 char str[2];
1989 int size;
1991 if(ch > 255) {
1992 str[0] = (ch>>8) & 255;
1993 str[1] = ch & 255;
1994 size = 2;
1995 } else {
1996 str[0] = ch & 255;
1997 size = 1;
2000 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
2001 return ch;
2003 lower = towlower(wide);
2004 if(lower == wide)
2005 return ch;
2007 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
2009 return str[0] + (str[1]<<8);
2013 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
2014 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
2015 #if _MSVCP_VER <= 100
2016 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
2017 char, (const ctype_char*, char), (this, ch))
2018 #else
2019 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
2020 char, (const ctype_char*, char), (this, ch))
2021 #endif
2022 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
2023 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
2025 TRACE("(%p %c)\n", this, ch);
2026 return _Tolower(ch, &this->ctype);
2029 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
2030 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
2031 #if _MSVCP_VER <= 100
2032 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
2033 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2034 #else
2035 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 12, \
2036 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2037 #endif
2038 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
2039 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
2041 TRACE("(%p %p %p)\n", this, first, last);
2042 for(; first<last; first++)
2043 *first = _Tolower(*first, &this->ctype);
2044 return last;
2047 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
2048 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
2049 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
2050 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
2052 TRACE("(%p %c)\n", this, ch);
2053 return call_ctype_char_do_tolower_ch(this, ch);
2056 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
2057 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2058 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
2059 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
2061 TRACE("(%p %p %p)\n", this, first, last);
2062 return call_ctype_char_do_tolower(this, first, last);
2065 /* _Toupper */
2066 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
2068 unsigned int cp;
2070 TRACE("%d %p\n", ch, ctype);
2072 if(ctype)
2073 cp = ctype->page;
2074 else
2075 cp = ___lc_codepage_func();
2077 /* Don't convert to unicode in case of C locale */
2078 if(!cp) {
2079 if(ch>='a' && ch<='z')
2080 ch = ch-'a'+'A';
2081 return ch;
2082 } else {
2083 WCHAR wide, upper;
2084 char str[2];
2085 int size;
2087 if(ch > 255) {
2088 str[0] = (ch>>8) & 255;
2089 str[1] = ch & 255;
2090 size = 2;
2091 } else {
2092 str[0] = ch & 255;
2093 size = 1;
2096 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
2097 return ch;
2099 upper = towupper(wide);
2100 if(upper == wide)
2101 return ch;
2103 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
2105 return str[0] + (str[1]<<8);
2109 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
2110 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
2111 #if _MSVCP_VER <= 100
2112 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
2113 char, (const ctype_char*, char), (this, ch))
2114 #else
2115 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2116 char, (const ctype_char*, char), (this, ch))
2117 #endif
2118 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
2119 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
2121 TRACE("(%p %c)\n", this, ch);
2122 return _Toupper(ch, &this->ctype);
2125 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
2126 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
2127 #if _MSVCP_VER <= 100
2128 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
2129 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2130 #else
2131 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 20, \
2132 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2133 #endif
2134 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
2135 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
2136 char *first, const char *last)
2138 TRACE("(%p %p %p)\n", this, first, last);
2139 for(; first<last; first++)
2140 *first = _Toupper(*first, &this->ctype);
2141 return last;
2144 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
2145 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
2146 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
2147 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
2149 TRACE("(%p %c)\n", this, ch);
2150 return call_ctype_char_do_toupper_ch(this, ch);
2153 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
2154 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2155 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
2156 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
2158 TRACE("(%p %p %p)\n", this, first, last);
2159 return call_ctype_char_do_toupper(this, first, last);
2162 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
2163 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
2164 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
2165 bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
2167 TRACE("(%p %x %c)\n", this, mask, ch);
2168 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
2171 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
2172 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
2173 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
2174 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
2176 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2177 for(; first<last; first++)
2178 *dest++ = this->ctype.table[(unsigned char)*first];
2179 return last;
2182 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
2183 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2184 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
2185 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
2187 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2188 for(; first<last; first++)
2189 if(!ctype_char_is_ch(this, mask, *first))
2190 break;
2191 return first;
2194 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
2195 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2196 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
2197 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
2199 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2200 for(; first<last; first++)
2201 if(ctype_char_is_ch(this, mask, *first))
2202 break;
2203 return first;
2206 /* ?table@?$ctype@D@std@@IBEPBFXZ */
2207 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
2208 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
2209 const short* __thiscall ctype_char_table(const ctype_char *this)
2211 TRACE("(%p)\n", this);
2212 return this->ctype.table;
2215 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
2216 locale_id ctype_wchar_id = {0};
2217 /* ?id@?$ctype@G@std@@2V0locale@2@A */
2218 locale_id ctype_short_id = {0};
2220 /* ??_7?$ctype@_W@std@@6B@ */
2221 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
2222 /* ??_7?$ctype@G@std@@6B@ */
2223 extern const vtable_ptr MSVCP_ctype_short_vtable;
2225 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
2226 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
2227 locale_id* __cdecl ctype_wchar__Id_func(void)
2229 TRACE("()\n");
2230 return &ctype_wchar_id;
2233 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
2234 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
2235 locale_id* __cdecl ctype_short__Id_func(void)
2237 TRACE("()\n");
2238 return &ctype_short_id;
2241 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
2242 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
2243 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
2244 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
2245 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
2246 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
2248 TRACE("(%p %p)\n", this, locinfo);
2249 _Locinfo__Getctype(locinfo, &this->ctype);
2250 _Locinfo__Getcvt(locinfo, &this->cvt);
2253 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
2254 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2255 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
2256 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
2257 const _Locinfo *locinfo, size_t refs)
2259 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
2260 ctype_base_ctor_refs(&this->base, refs);
2261 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2262 ctype_wchar__Init(this, locinfo);
2263 return this;
2266 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
2267 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2268 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
2269 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
2270 const _Locinfo *locinfo, size_t refs)
2272 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
2273 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2274 return ret;
2277 /* ??0?$ctype@_W@std@@QAE@I@Z */
2278 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
2279 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
2280 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, size_t refs)
2282 _Locinfo locinfo;
2284 TRACE("(%p %Iu)\n", this, refs);
2286 ctype_base_ctor_refs(&this->base, refs);
2287 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2289 _Locinfo_ctor(&locinfo);
2290 ctype_wchar__Init(this, &locinfo);
2291 _Locinfo_dtor(&locinfo);
2292 return this;
2295 /* ??0?$ctype@G@std@@QAE@I@Z */
2296 /* ??0?$ctype@G@std@@QEAA@_K@Z */
2297 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
2298 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, size_t refs)
2300 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
2301 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2302 return ret;
2305 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
2306 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
2307 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
2308 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
2309 const char *name, size_t refs)
2311 _Locinfo locinfo;
2313 TRACE("(%p %s %Iu)\n", this, debugstr_a(name), refs);
2315 ctype_base_ctor_refs(&this->base, refs);
2316 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2318 _Locinfo_ctor_cstr(&locinfo, name);
2319 ctype_wchar__Init(this, &locinfo);
2320 _Locinfo_dtor(&locinfo);
2321 return this;
2324 /* ??_F?$ctype@_W@std@@QAEXXZ */
2325 /* ??_F?$ctype@_W@std@@QEAAXXZ */
2326 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
2327 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
2329 TRACE("(%p)\n", this);
2330 return ctype_short_ctor_refs(this, 0);
2333 /* ??_F?$ctype@G@std@@QAEXXZ */
2334 /* ??_F?$ctype@G@std@@QEAAXXZ */
2335 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
2336 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
2338 ctype_wchar *ret = ctype_wchar_ctor(this);
2339 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2340 return ret;
2343 /* ??1?$ctype@G@std@@UAE@XZ */
2344 /* ??1?$ctype@G@std@@UEAA@XZ */
2345 /* ??1?$ctype@_W@std@@MAE@XZ */
2346 /* ??1?$ctype@_W@std@@MEAA@XZ */
2347 /* ??1?$ctype@G@std@@MAE@XZ */
2348 /* ??1?$ctype@G@std@@MEAA@XZ */
2349 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
2350 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
2352 TRACE("(%p)\n", this);
2353 if(this->ctype.delfl)
2354 free((void*)this->ctype.table);
2355 #if _MSVCP_VER >= 110
2356 free(this->ctype.name);
2357 #endif
2360 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
2361 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
2363 TRACE("(%p %x)\n", this, flags);
2364 if(flags & 2) {
2365 /* we have an array, with the number of elements stored before the first object */
2366 INT_PTR i, *ptr = (INT_PTR *)this-1;
2368 for(i=*ptr-1; i>=0; i--)
2369 ctype_wchar_dtor(this+i);
2370 MSVCRT_operator_delete(ptr);
2371 } else {
2372 ctype_wchar_dtor(this);
2373 if(flags & 1)
2374 MSVCRT_operator_delete(this);
2377 return this;
2380 /* _Wcrtomb */
2381 int __cdecl _Wcrtomb(char *s, wchar_t wch, _Mbstatet *state, const _Cvtvec *cvt)
2383 int cp, size;
2384 BOOL def;
2386 TRACE("%p %d %p %p\n", s, wch, state, cvt);
2388 if(cvt)
2389 cp = cvt->page;
2390 else
2391 cp = ___lc_codepage_func();
2393 if(!cp) {
2394 if(wch > 255) {
2395 *_errno() = EILSEQ;
2396 return -1;
2399 *s = wch & 255;
2400 return 1;
2403 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
2404 if(!size || def) {
2405 *_errno() = EILSEQ;
2406 return -1;
2409 return size;
2412 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
2413 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
2414 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
2415 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
2416 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
2417 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
2419 char buf[MB_LEN_MAX];
2421 TRACE("(%p %d %d)\n", this, ch, dflt);
2423 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
2426 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
2427 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
2428 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
2429 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
2430 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
2431 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2432 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
2433 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2434 #elif _MSVCP_VER <= 100
2435 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
2436 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2437 #else
2438 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 56, \
2439 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2440 #endif
2441 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2443 return ctype_wchar__Donarrow(this, ch, dflt);
2446 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
2447 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2448 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2449 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2450 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2451 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2452 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2453 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2454 (this, first, last, dflt, dest))
2455 #elif _MSVCP_VER <= 100
2456 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
2457 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2458 (this, first, last, dflt, dest))
2459 #else
2460 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 52, \
2461 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2462 (this, first, last, dflt, dest))
2463 #endif
2464 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2465 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2467 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2468 for(; first<last; first++)
2469 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2470 return last;
2473 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2474 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2475 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2476 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2477 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2478 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2479 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, size_t), \
2480 (this, first, last, dflt, dest, size))
2481 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2482 const wchar_t *first, const wchar_t *last, char dflt, char *dest, size_t size)
2484 TRACE("(%p %p %p %d %p %Iu)\n", this, first, last, dflt, dest, size);
2485 /* This function converts all multi-byte characters to dflt,
2486 * thanks to it result size is known before converting */
2487 if(last-first > size)
2488 ctype_base__Xran();
2489 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2492 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2493 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2494 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2495 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2496 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2497 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2499 TRACE("(%p %d %d)\n", this, ch, dflt);
2500 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2503 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2504 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2505 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2506 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2507 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2508 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2509 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2511 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2512 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2515 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2516 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2517 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2518 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2519 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2520 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2521 const wchar_t *last, char dflt, char *dest, size_t size)
2523 TRACE("(%p %p %p %d %p %Iu)\n", this, first, last, dflt, dest, size);
2524 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2527 /* _Mbrtowc */
2528 int __cdecl _Mbrtowc(wchar_t *out, const char *in, size_t len, _Mbstatet *state, const _Cvtvec *cvt)
2530 int i, cp;
2531 CPINFO cp_info;
2532 BOOL is_lead;
2534 TRACE("(%p %p %Iu %p %p)\n", out, in, len, state, cvt);
2536 if(!len)
2537 return 0;
2539 if(cvt)
2540 cp = cvt->page;
2541 else
2542 cp = ___lc_codepage_func();
2544 if(!cp) {
2545 if(out)
2546 *out = (unsigned char)*in;
2548 memset(state, 0, sizeof(*state));
2549 return *in ? 1 : 0;
2552 if(MBSTATET_TO_INT(state)) {
2553 ((char*)&MBSTATET_TO_INT(state))[1] = *in;
2555 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)&MBSTATET_TO_INT(state), 2, out, out ? 1 : 0)) {
2556 memset(state, 0, sizeof(*state));
2557 *_errno() = EILSEQ;
2558 return -1;
2561 memset(state, 0, sizeof(*state));
2562 return 2;
2565 GetCPInfo(cp, &cp_info);
2566 is_lead = FALSE;
2567 for(i=0; i<MAX_LEADBYTES; i+=2) {
2568 if(!cp_info.LeadByte[i+1])
2569 break;
2570 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2571 is_lead = TRUE;
2572 break;
2576 if(is_lead) {
2577 if(len == 1) {
2578 MBSTATET_TO_INT(state) = (unsigned char)*in;
2579 return -2;
2582 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2583 *_errno() = EILSEQ;
2584 return -1;
2586 return 2;
2589 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2590 *_errno() = EILSEQ;
2591 return -1;
2593 return 1;
2596 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
2598 _Mbstatet state;
2599 wchar_t ret;
2601 memset(&state, 0, sizeof(state));
2602 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
2605 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2606 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2607 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2608 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2609 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2610 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2612 _Mbstatet state;
2613 wchar_t ret;
2615 TRACE("(%p %d)\n", this, ch);
2617 memset(&state, 0, sizeof(state));
2618 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2621 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2622 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2623 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2624 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2625 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2626 #if _MSVCP_VER <= 100
2627 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2628 wchar_t, (const ctype_wchar*, char), (this, ch))
2629 #else
2630 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 48, \
2631 wchar_t, (const ctype_wchar*, char), (this, ch))
2632 #endif
2633 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2635 return ctype_wchar__Dowiden(this, ch);
2638 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2639 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2640 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2641 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2642 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2643 #if _MSVCP_VER <= 100
2644 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2645 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2646 (this, first, last, dest))
2647 #else
2648 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 44, \
2649 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2650 (this, first, last, dest))
2651 #endif
2652 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2653 const char *first, const char *last, wchar_t *dest)
2655 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2656 for(; first<last; first++)
2657 *dest++ = ctype_wchar__Dowiden(this, *first);
2658 return last;
2661 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2662 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2663 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2664 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2665 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2666 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2667 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, size_t), \
2668 (this, first, last, dest, size))
2669 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2670 const char *first, const char *last, wchar_t *dest, size_t size)
2672 TRACE("(%p %p %p %p %Iu)\n", this, first, last, dest, size);
2673 /* This function converts all multi-byte characters to WEOF,
2674 * thanks to it result size is known before converting */
2675 if(size < last-first)
2676 ctype_base__Xran();
2677 return ctype_wchar_do_widen(this, first, last, dest);
2680 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2681 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2682 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2683 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2684 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2685 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2687 TRACE("(%p %d)\n", this, ch);
2688 return call_ctype_wchar_do_widen_ch(this, ch);
2691 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2692 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2693 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2694 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2695 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2696 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2697 const char *first, const char *last, wchar_t *dest)
2699 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2700 return call_ctype_wchar_do_widen(this, first, last, dest);
2703 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2704 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2705 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2706 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2707 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2708 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2709 const char *first, const char *last, wchar_t *dest, size_t size)
2711 TRACE("(%p %p %p %p %Iu)\n", this, first, last, dest, size);
2712 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2715 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2716 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2717 size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2719 TRACE("(%p %p)\n", facet, loc);
2721 if(facet && !*facet) {
2722 _Locinfo locinfo;
2724 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2725 if(!*facet) {
2726 ERR("Out of memory\n");
2727 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2728 return 0;
2731 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2732 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2733 _Locinfo_dtor(&locinfo);
2736 return LC_CTYPE;
2739 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@@Z */
2740 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2741 size_t __cdecl ctype_wchar__Getcat_old(const locale_facet **facet)
2743 return ctype_wchar__Getcat(facet, locale_classic());
2746 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2747 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2748 size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2750 if(facet && !*facet) {
2751 ctype_wchar__Getcat(facet, loc);
2752 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2755 return LC_CTYPE;
2758 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z */
2759 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2760 size_t __cdecl ctype_short__Getcat_old(const locale_facet **facet)
2762 return ctype_short__Getcat(facet, locale_classic());
2765 /* _Towlower */
2766 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2768 TRACE("(%d %p)\n", ch, ctype);
2769 return towlower(ch);
2772 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2774 static ctype_wchar *obj = NULL;
2776 _Lockit lock;
2777 const locale_facet *fac;
2779 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2780 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2781 if(fac) {
2782 _Lockit_dtor(&lock);
2783 return (ctype_wchar*)fac;
2786 if(obj) {
2787 _Lockit_dtor(&lock);
2788 return obj;
2791 ctype_wchar__Getcat(&fac, loc);
2792 obj = (ctype_wchar*)fac;
2793 call_locale_facet__Incref(&obj->base.facet);
2794 locale_facet_register(&obj->base.facet);
2795 _Lockit_dtor(&lock);
2797 return obj;
2800 ctype_wchar* ctype_short_use_facet(const locale *loc)
2802 static ctype_wchar *obj = NULL;
2804 _Lockit lock;
2805 const locale_facet *fac;
2807 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2808 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2809 if(fac) {
2810 _Lockit_dtor(&lock);
2811 return (ctype_wchar*)fac;
2814 if(obj) {
2815 _Lockit_dtor(&lock);
2816 return obj;
2819 ctype_short__Getcat(&fac, loc);
2820 obj = (ctype_wchar*)fac;
2821 call_locale_facet__Incref(&obj->base.facet);
2822 locale_facet_register(&obj->base.facet);
2823 _Lockit_dtor(&lock);
2825 return obj;
2828 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2829 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2830 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2831 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2832 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2833 #if _MSVCP_VER <= 100
2834 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2835 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2836 #else
2837 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2838 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2839 #endif
2840 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2842 return _Towlower(ch, &this->ctype);
2845 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2846 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2847 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2848 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2849 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2850 #if _MSVCP_VER <= 100
2851 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2852 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2853 (this, first, last))
2854 #else
2855 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 28, \
2856 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2857 (this, first, last))
2858 #endif
2859 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2860 wchar_t *first, const wchar_t *last)
2862 TRACE("(%p %p %p)\n", this, first, last);
2863 for(; first<last; first++)
2864 *first = _Towlower(*first, &this->ctype);
2865 return last;
2868 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2869 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2870 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2871 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2872 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2873 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2875 TRACE("(%p %d)\n", this, ch);
2876 return call_ctype_wchar_do_tolower_ch(this, ch);
2879 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2880 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2881 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2882 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2883 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2884 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2885 wchar_t *first, const wchar_t *last)
2887 TRACE("(%p %p %p)\n", this, first, last);
2888 return call_ctype_wchar_do_tolower(this, first, last);
2891 /* _Towupper */
2892 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2894 TRACE("(%d %p)\n", ch, ctype);
2895 return towupper(ch);
2898 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2899 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2900 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2901 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2902 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2903 #if _MSVCP_VER <= 100
2904 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2905 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2906 #else
2907 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2908 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2909 #endif
2910 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2912 return _Towupper(ch, &this->ctype);
2915 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2916 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2917 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2918 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2919 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2920 #if _MSVCP_VER <= 100
2921 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2922 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2923 (this, first, last))
2924 #else
2925 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 36, \
2926 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2927 (this, first, last))
2928 #endif
2929 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2930 wchar_t *first, const wchar_t *last)
2932 TRACE("(%p %p %p)\n", this, first, last);
2933 for(; first<last; first++)
2934 *first = _Towupper(*first, &this->ctype);
2935 return last;
2938 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2939 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2940 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2941 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2942 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2943 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2945 TRACE("(%p %d)\n", this, ch);
2946 return call_ctype_wchar_do_toupper_ch(this, ch);
2949 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2950 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2951 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2952 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2953 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2954 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2955 wchar_t *first, const wchar_t *last)
2957 TRACE("(%p %p %p)\n", this, first, last);
2958 return call_ctype_wchar_do_toupper(this, first, last);
2961 /* _Getwctypes */
2962 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2963 short *mask, const _Ctypevec *ctype)
2965 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2966 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2967 return last;
2970 /* _Getwctype */
2971 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2973 short mask = 0;
2974 _Getwctypes(&ch, &ch+1, &mask, ctype);
2975 return mask;
2978 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2979 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2980 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2981 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2982 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2983 #if _MSVCP_VER <= 100
2984 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2985 bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2986 #else
2987 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 16, \
2988 bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2989 #endif
2990 bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2992 TRACE("(%p %x %d)\n", this, mask, ch);
2993 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2996 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2997 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2998 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2999 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
3000 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
3001 #if _MSVCP_VER <= 100
3002 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
3003 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
3004 (this, first, last, dest))
3005 #else
3006 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 12, \
3007 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
3008 (this, first, last, dest))
3009 #endif
3010 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
3011 const wchar_t *first, const wchar_t *last, short *dest)
3013 TRACE("(%p %p %p %p)\n", this, first, last, dest);
3014 return _Getwctypes(first, last, dest, &this->ctype);
3017 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
3018 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
3019 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
3020 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
3021 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
3022 bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
3024 TRACE("(%p %x %d)\n", this, mask, ch);
3025 return call_ctype_wchar_do_is_ch(this, mask, ch);
3028 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
3029 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
3030 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
3031 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
3032 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
3033 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
3034 const wchar_t *first, const wchar_t *last, short *dest)
3036 TRACE("(%p %p %p %p)\n", this, first, last, dest);
3037 return call_ctype_wchar_do_is(this, first, last, dest);
3040 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
3041 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
3042 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
3043 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
3044 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
3045 #if _MSVCP_VER <= 100
3046 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
3047 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3048 (this, mask, first, last))
3049 #else
3050 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 20, \
3051 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3052 (this, mask, first, last))
3053 #endif
3054 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
3055 short mask, const wchar_t *first, const wchar_t *last)
3057 TRACE("(%p %d %p %p)\n", this, mask, first, last);
3058 for(; first<last; first++)
3059 if(!ctype_wchar_is_ch(this, mask, *first))
3060 break;
3061 return first;
3064 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
3065 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
3066 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
3067 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
3068 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
3069 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
3070 short mask, const wchar_t *first, const wchar_t *last)
3072 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3073 return call_ctype_wchar_do_scan_is(this, mask, first, last);
3076 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
3077 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
3078 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
3079 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
3080 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
3081 #if _MSVCP_VER <= 100
3082 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
3083 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3084 (this, mask, first, last))
3085 #else
3086 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 24, \
3087 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3088 (this, mask, first, last))
3089 #endif
3090 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
3091 short mask, const wchar_t *first, const wchar_t *last)
3093 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3094 for(; first<last; first++)
3095 if(ctype_wchar_is_ch(this, mask, *first))
3096 break;
3097 return first;
3100 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
3101 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
3102 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
3103 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
3104 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
3105 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
3106 short mask, const wchar_t *first, const wchar_t *last)
3108 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3109 return call_ctype_wchar_do_scan_not(this, mask, first, last);
3112 /* ??_7codecvt_base@std@@6B@ */
3113 extern const vtable_ptr MSVCP_codecvt_base_vtable;
3115 /* ??0codecvt_base@std@@QAE@I@Z */
3116 /* ??0codecvt_base@std@@QEAA@_K@Z */
3117 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
3118 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, size_t refs)
3120 TRACE("(%p %Iu)\n", this, refs);
3121 locale_facet_ctor_refs(&this->facet, refs);
3122 this->facet.vtable = &MSVCP_codecvt_base_vtable;
3123 return this;
3126 /* ??_Fcodecvt_base@std@@QAEXXZ */
3127 /* ??_Fcodecvt_base@std@@QEAAXXZ */
3128 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
3129 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
3131 return codecvt_base_ctor_refs(this, 0);
3134 /* ??1codecvt_base@std@@UAE@XZ */
3135 /* ??1codecvt_base@std@@UEAA@XZ */
3136 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
3137 void __thiscall codecvt_base_dtor(codecvt_base *this)
3139 TRACE("(%p)\n", this);
3140 locale_facet_dtor(&this->facet);
3143 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
3144 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
3146 TRACE("(%p %x)\n", this, flags);
3147 if(flags & 2) {
3148 /* we have an array, with the number of elements stored before the first object */
3149 INT_PTR i, *ptr = (INT_PTR *)this-1;
3151 for(i=*ptr-1; i>=0; i--)
3152 codecvt_base_dtor(this+i);
3153 MSVCRT_operator_delete(ptr);
3154 } else {
3155 codecvt_base_dtor(this);
3156 if(flags & 1)
3157 MSVCRT_operator_delete(this);
3160 return this;
3163 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
3164 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
3165 #if _MSVCP_VER <= 100
3166 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
3167 bool, (const codecvt_base*), (this))
3168 #else
3169 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 12, \
3170 bool, (const codecvt_base*), (this))
3171 #endif
3172 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
3173 bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
3175 TRACE("(%p)\n", this);
3176 return _MSVCP_VER <= 100;
3179 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
3180 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
3181 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
3182 bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
3184 TRACE("(%p)\n", this);
3185 return call_codecvt_base_do_always_noconv(this);
3188 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
3189 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
3190 #if _MSVCP_VER <= 100
3191 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
3192 int, (const codecvt_base*), (this))
3193 #else
3194 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 16, \
3195 int, (const codecvt_base*), (this))
3196 #endif
3197 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
3198 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
3200 TRACE("(%p)\n", this);
3201 return 1;
3204 /* ?max_length@codecvt_base@std@@QBEHXZ */
3205 /* ?max_length@codecvt_base@std@@QEBAHXZ */
3206 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
3207 int __thiscall codecvt_base_max_length(const codecvt_base *this)
3209 TRACE("(%p)\n", this);
3210 return call_codecvt_base_do_max_length(this);
3213 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
3214 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
3215 #if _MSVCP_VER <= 100
3216 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
3217 int, (const codecvt_base*), (this))
3218 #else
3219 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 20, \
3220 int, (const codecvt_base*), (this))
3221 #endif
3222 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
3223 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
3225 TRACE("(%p)\n", this);
3226 return 1;
3229 /* ?encoding@codecvt_base@std@@QBEHXZ */
3230 /* ?encoding@codecvt_base@std@@QEBAHXZ */
3231 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
3232 int __thiscall codecvt_base_encoding(const codecvt_base *this)
3234 TRACE("(%p)\n", this);
3235 return call_codecvt_base_do_encoding(this);
3238 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
3239 locale_id codecvt_char_id = {0};
3241 /* ??_7?$codecvt@DDH@std@@6B@ */
3242 extern const vtable_ptr MSVCP_codecvt_char_vtable;
3244 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
3245 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3246 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
3247 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
3249 TRACE("(%p %p)\n", this, locinfo);
3252 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
3253 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3254 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
3255 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, size_t refs)
3257 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
3258 codecvt_base_ctor_refs(&this->base, refs);
3259 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
3260 return this;
3263 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
3264 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
3265 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
3266 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, size_t refs)
3268 return codecvt_char_ctor_locinfo(this, NULL, refs);
3271 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
3272 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
3273 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
3274 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
3276 return codecvt_char_ctor_locinfo(this, NULL, 0);
3279 /* ??1?$codecvt@DDH@std@@UAE@XZ */
3280 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
3281 /* ??1?$codecvt@DDH@std@@MAE@XZ */
3282 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
3283 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
3284 void __thiscall codecvt_char_dtor(codecvt_char *this)
3286 TRACE("(%p)\n", this);
3287 codecvt_base_dtor(&this->base);
3290 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
3291 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
3293 TRACE("(%p %x)\n", this, flags);
3294 if(flags & 2) {
3295 /* we have an array, with the number of elements stored before the first object */
3296 INT_PTR i, *ptr = (INT_PTR *)this-1;
3298 for(i=*ptr-1; i>=0; i--)
3299 codecvt_char_dtor(this+i);
3300 MSVCRT_operator_delete(ptr);
3301 } else {
3302 codecvt_char_dtor(this);
3303 if(flags & 1)
3304 MSVCRT_operator_delete(this);
3307 return this;
3310 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3311 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3312 size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
3314 TRACE("(%p %p)\n", facet, loc);
3316 if(facet && !*facet) {
3317 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
3318 if(!*facet) {
3319 ERR("Out of memory\n");
3320 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3321 return 0;
3323 codecvt_char_ctor((codecvt_char*)*facet);
3326 return LC_CTYPE;
3329 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z */
3330 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3331 size_t __cdecl codecvt_char__Getcat_old(const locale_facet **facet)
3333 return codecvt_char__Getcat(facet, locale_classic());
3336 codecvt_char* codecvt_char_use_facet(const locale *loc)
3338 static codecvt_char *obj = NULL;
3340 _Lockit lock;
3341 const locale_facet *fac;
3343 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3344 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
3345 if(fac) {
3346 _Lockit_dtor(&lock);
3347 return (codecvt_char*)fac;
3350 if(obj) {
3351 _Lockit_dtor(&lock);
3352 return obj;
3355 codecvt_char__Getcat(&fac, loc);
3356 obj = (codecvt_char*)fac;
3357 call_locale_facet__Incref(&obj->base.facet);
3358 locale_facet_register(&obj->base.facet);
3359 _Lockit_dtor(&lock);
3361 return obj;
3364 /* ?do_always_noconv@?$codecvt@DDH@std@@MBE_NXZ */
3365 /* ?do_always_noconv@?$codecvt@DDH@std@@MEBA_NXZ */
3366 DEFINE_THISCALL_WRAPPER(codecvt_char_do_always_noconv, 4)
3367 bool __thiscall codecvt_char_do_always_noconv(const codecvt_char *this)
3369 TRACE("(%p)\n", this);
3370 return TRUE;
3373 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3374 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3375 #if _MSVCP_VER <= 100
3376 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3377 CALL_VTBL_FUNC(this, 16, int, \
3378 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3379 (this, state, from, from_end, from_next, to, to_end, to_next))
3380 #else
3381 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3382 CALL_VTBL_FUNC(this, 24, int, \
3383 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3384 (this, state, from, from_end, from_next, to, to_end, to_next))
3385 #endif
3386 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
3387 int __thiscall codecvt_char_do_in(const codecvt_char *this, _Mbstatet *state,
3388 const char *from, const char *from_end, const char **from_next,
3389 char *to, char *to_end, char **to_next)
3391 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3392 from_next, to, to_end, to_next);
3393 *from_next = from;
3394 *to_next = to;
3395 return CODECVT_noconv;
3398 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3399 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3400 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
3401 int __thiscall codecvt_char_in(const codecvt_char *this, _Mbstatet *state,
3402 const char *from, const char *from_end, const char **from_next,
3403 char *to, char *to_end, char **to_next)
3405 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3406 from_next, to, to_end, to_next);
3407 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
3408 to, to_end, to_next);
3411 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3412 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3413 #if _MSVCP_VER <= 100
3414 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3415 CALL_VTBL_FUNC(this, 20, int, \
3416 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3417 (this, state, from, from_end, from_next, to, to_end, to_next))
3418 #else
3419 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3420 CALL_VTBL_FUNC(this, 28, int, \
3421 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3422 (this, state, from, from_end, from_next, to, to_end, to_next))
3423 #endif
3424 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
3425 int __thiscall codecvt_char_do_out(const codecvt_char *this, _Mbstatet *state,
3426 const char *from, const char *from_end, const char **from_next,
3427 char *to, char *to_end, char **to_next)
3429 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3430 from_end, from_next, to, to_end, to_next);
3431 *from_next = from;
3432 *to_next = to;
3433 return CODECVT_noconv;
3436 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3437 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3438 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
3439 int __thiscall codecvt_char_out(const codecvt_char *this, _Mbstatet *state,
3440 const char *from, const char *from_end, const char **from_next,
3441 char *to, char *to_end, char **to_next)
3443 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3444 from_next, to, to_end, to_next);
3445 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
3446 to, to_end, to_next);
3449 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
3450 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3451 #if _MSVCP_VER <= 100
3452 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3453 int, (const codecvt_char*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3454 #else
3455 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3456 int, (const codecvt_char*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3457 #endif
3458 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
3459 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
3460 _Mbstatet *state, char *to, char *to_end, char **to_next)
3462 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3463 *to_next = to;
3464 return CODECVT_noconv;
3467 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
3468 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3469 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
3470 int __thiscall codecvt_char_unshift(const codecvt_char *this,
3471 _Mbstatet *state, char *to, char *to_end, char **to_next)
3473 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3474 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
3477 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
3478 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
3479 #if _MSVCP_VER <= 100
3480 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3481 int, (const codecvt_char*, const _Mbstatet*, const char*, const char*, size_t), \
3482 (this, state, from, from_end, max))
3483 #else
3484 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3485 int, (const codecvt_char*, const _Mbstatet*, const char*, const char*, size_t), \
3486 (this, state, from, from_end, max))
3487 #endif
3488 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
3489 int __thiscall codecvt_char_do_length(const codecvt_char *this, const _Mbstatet *state,
3490 const char *from, const char *from_end, size_t max)
3492 TRACE("(%p %p %p %p %Iu)\n", this, state, from, from_end, max);
3493 return (from_end-from > max ? max : from_end-from);
3496 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
3497 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
3498 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
3499 int __thiscall codecvt_char_length(const codecvt_char *this, const _Mbstatet *state,
3500 const char *from, const char *from_end, size_t max)
3502 TRACE("(%p %p %p %p %Iu)\n", this, state, from, from_end, max);
3503 return call_codecvt_char_do_length(this, state, from, from_end, max);
3506 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
3507 locale_id codecvt_wchar_id = {0};
3508 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
3509 locale_id codecvt_short_id = {0};
3511 /* ??_7?$codecvt@_WDH@std@@6B@ */
3512 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
3513 /* ??_7?$codecvt@GDH@std@@6B@ */
3514 extern const vtable_ptr MSVCP_codecvt_short_vtable;
3516 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
3517 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3518 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
3519 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3520 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
3521 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
3523 TRACE("(%p %p)\n", this, locinfo);
3524 _Locinfo__Getcvt(locinfo, &this->cvt);
3527 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
3528 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3529 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
3530 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, size_t refs)
3532 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
3534 codecvt_base_ctor_refs(&this->base, refs);
3535 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
3537 codecvt_wchar__Init(this, locinfo);
3538 return this;
3541 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
3542 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3543 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
3544 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, size_t refs)
3546 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
3548 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
3549 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
3550 return this;
3553 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
3554 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
3555 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
3556 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, size_t refs)
3558 _Locinfo locinfo;
3560 TRACE("(%p %Iu)\n", this, refs);
3562 _Locinfo_ctor(&locinfo);
3563 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
3564 _Locinfo_dtor(&locinfo);
3565 return this;
3568 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
3569 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
3570 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
3571 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, size_t refs)
3573 _Locinfo locinfo;
3575 TRACE("(%p %Iu)\n", this, refs);
3577 _Locinfo_ctor(&locinfo);
3578 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3579 _Locinfo_dtor(&locinfo);
3580 return this;
3583 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
3584 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
3585 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
3586 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, size_t refs)
3588 _Locinfo locinfo;
3590 TRACE("(%p %s %Iu)\n", this, name, refs);
3592 _Locinfo_ctor_cstr(&locinfo, name);
3593 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3594 _Locinfo_dtor(&locinfo);
3595 return this;
3598 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3599 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3600 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3601 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3603 return codecvt_wchar_ctor_refs(this, 0);
3606 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3607 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3608 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3609 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3611 return codecvt_short_ctor_refs(this, 0);
3614 /* ??1?$codecvt@GDH@std@@UAE@XZ */
3615 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
3616 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3617 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3618 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3619 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3620 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3621 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3623 TRACE("(%p)\n", this);
3624 codecvt_base_dtor(&this->base);
3627 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3628 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3630 TRACE("(%p %x)\n", this, flags);
3631 if(flags & 2) {
3632 /* we have an array, with the number of elements stored before the first object */
3633 INT_PTR i, *ptr = (INT_PTR *)this-1;
3635 for(i=*ptr-1; i>=0; i--)
3636 codecvt_wchar_dtor(this+i);
3637 MSVCRT_operator_delete(ptr);
3638 } else {
3639 codecvt_wchar_dtor(this);
3640 if(flags & 1)
3641 MSVCRT_operator_delete(this);
3644 return this;
3647 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3648 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3649 size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3651 TRACE("(%p %p)\n", facet, loc);
3653 if(facet && !*facet) {
3654 _Locinfo locinfo;
3656 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3657 if(!*facet) {
3658 ERR("Out of memory\n");
3659 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3660 return 0;
3663 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3664 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3665 _Locinfo_dtor(&locinfo);
3668 return LC_CTYPE;
3671 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@@Z */
3672 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3673 size_t __cdecl codecvt_wchar__Getcat_old(const locale_facet **facet)
3675 return codecvt_wchar__Getcat(facet, locale_classic());
3678 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3680 static codecvt_wchar *obj = NULL;
3682 _Lockit lock;
3683 const locale_facet *fac;
3685 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3686 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3687 if(fac) {
3688 _Lockit_dtor(&lock);
3689 return (codecvt_wchar*)fac;
3692 if(obj) {
3693 _Lockit_dtor(&lock);
3694 return obj;
3697 codecvt_wchar__Getcat(&fac, loc);
3698 obj = (codecvt_wchar*)fac;
3699 call_locale_facet__Incref(&obj->base.facet);
3700 locale_facet_register(&obj->base.facet);
3701 _Lockit_dtor(&lock);
3703 return obj;
3706 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3707 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3708 size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3710 TRACE("(%p %p)\n", facet, loc);
3712 if(facet && !*facet) {
3713 _Locinfo locinfo;
3715 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3716 if(!*facet) {
3717 ERR("Out of memory\n");
3718 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3719 return 0;
3722 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3723 codecvt_short_ctor((codecvt_wchar*)*facet);
3724 _Locinfo_dtor(&locinfo);
3727 return LC_CTYPE;
3730 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@@Z */
3731 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3732 size_t __cdecl codecvt_short__Getcat_old(const locale_facet **facet)
3734 return codecvt_short__Getcat(facet, locale_classic());
3737 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3739 static codecvt_wchar *obj = NULL;
3741 _Lockit lock;
3742 const locale_facet *fac;
3744 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3745 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3746 if(fac) {
3747 _Lockit_dtor(&lock);
3748 return (codecvt_wchar*)fac;
3751 if(obj) {
3752 _Lockit_dtor(&lock);
3753 return obj;
3756 codecvt_short__Getcat(&fac, loc);
3757 obj = (codecvt_wchar*)fac;
3758 call_locale_facet__Incref(&obj->base.facet);
3759 locale_facet_register(&obj->base.facet);
3760 _Lockit_dtor(&lock);
3762 return obj;
3765 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3766 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3767 locale_id* __cdecl codecvt_wchar__Id_func(void)
3769 TRACE("()\n");
3770 return &codecvt_wchar_id;
3773 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3774 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3775 locale_id* __cdecl codecvt_short__Id_func(void)
3777 TRACE("()\n");
3778 return &codecvt_short_id;
3781 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3782 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3783 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3784 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3785 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3786 bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3788 TRACE("(%p)\n", this);
3789 return FALSE;
3792 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3793 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3794 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3795 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3796 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3797 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3799 TRACE("(%p)\n", this);
3800 return MB_LEN_MAX;
3803 /* ?do_encoding@?$codecvt@GDH@std@@MBEHXZ */
3804 /* ?do_encoding@?$codecvt@GDH@std@@MEBAHXZ */
3805 /* ?do_encoding@?$codecvt@_WDH@std@@MBEHXZ */
3806 /* ?do_encoding@?$codecvt@_WDH@std@@MEBAHXZ */
3807 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_encoding, 4)
3808 int __thiscall codecvt_wchar_do_encoding(const codecvt_wchar *this)
3810 TRACE("(%p)\n", this);
3811 return 0;
3814 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3815 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3816 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3817 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3818 #if _MSVCP_VER <= 100
3819 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3820 CALL_VTBL_FUNC(this, 16, int, \
3821 (const codecvt_wchar*, _Mbstatet*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3822 (this, state, from, from_end, from_next, to, to_end, to_next))
3823 #else
3824 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3825 CALL_VTBL_FUNC(this, 24, int, \
3826 (const codecvt_wchar*, _Mbstatet*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3827 (this, state, from, from_end, from_next, to, to_end, to_next))
3828 #endif
3829 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3830 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, _Mbstatet *state,
3831 const char *from, const char *from_end, const char **from_next,
3832 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3834 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3835 from_end, from_next, to, to_end, to_next);
3837 *from_next = from;
3838 *to_next = to;
3840 while(*from_next!=from_end && *to_next!=to_end) {
3841 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3842 case -2:
3843 *from_next = from_end;
3844 return CODECVT_partial;
3845 case -1:
3846 return CODECVT_error;
3847 case 2:
3848 (*from_next)++;
3849 /* fall through */
3850 case 0:
3851 case 1:
3852 (*from_next)++;
3853 (*to_next)++;
3857 return CODECVT_ok;
3860 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3861 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3862 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3863 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3864 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3865 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, _Mbstatet *state,
3866 const char *from, const char *from_end, const char **from_next,
3867 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3869 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3870 from_end, from_next, to, to_end, to_next);
3871 return call_codecvt_wchar_do_in(this, state, from,
3872 from_end, from_next, to, to_end, to_next);
3875 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3876 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3877 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3878 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3879 #if _MSVCP_VER <= 100
3880 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3881 CALL_VTBL_FUNC(this, 20, int, \
3882 (const codecvt_wchar*, _Mbstatet*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3883 (this, state, from, from_end, from_next, to, to_end, to_next))
3884 #else
3885 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3886 CALL_VTBL_FUNC(this, 28, int, \
3887 (const codecvt_wchar*, _Mbstatet*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3888 (this, state, from, from_end, from_next, to, to_end, to_next))
3889 #endif
3890 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3891 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, _Mbstatet *state,
3892 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3893 char *to, char *to_end, char **to_next)
3895 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3896 from_end, from_next, to, to_end, to_next);
3898 *from_next = from;
3899 *to_next = to;
3901 while(*from_next!=from_end && *to_next!=to_end) {
3902 _Mbstatet old_state = *state;
3903 int size;
3904 char buf[MB_LEN_MAX];
3906 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3907 case -1:
3908 return CODECVT_error;
3909 default:
3910 if(size > from_end-*from_next) {
3911 *state = old_state;
3912 return CODECVT_partial;
3915 (*from_next)++;
3916 memcpy_s(*to_next, to_end-*to_next, buf, size);
3917 (*to_next) += size;
3921 return CODECVT_ok;
3924 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3925 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3926 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3927 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3928 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3929 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, _Mbstatet *state,
3930 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3931 char *to, char *to_end, char **to_next)
3933 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3934 from_end, from_next, to, to_end, to_next);
3935 return call_codecvt_wchar_do_out(this, state, from,
3936 from_end, from_next, to, to_end, to_next);
3939 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3940 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3941 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3942 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3943 #if _MSVCP_VER <= 100
3944 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3945 int, (const codecvt_wchar*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3946 #else
3947 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3948 int, (const codecvt_wchar*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3949 #endif
3950 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3951 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3952 _Mbstatet *state, char *to, char *to_end, char **to_next)
3954 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3955 if(MBSTATET_TO_INT(state))
3956 WARN("unexpected state: %x\n", MBSTATET_TO_INT(state));
3958 *to_next = to;
3959 return CODECVT_ok;
3962 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3963 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3964 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3965 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3966 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3967 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3968 _Mbstatet *state, char *to, char *to_end, char **to_next)
3970 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3971 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3974 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3975 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3976 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3977 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3978 #if _MSVCP_VER <= 100
3979 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3980 int, (const codecvt_wchar*, const _Mbstatet*, const char*, const char*, size_t), \
3981 (this, state, from, from_end, max))
3982 #else
3983 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3984 int, (const codecvt_wchar*, const _Mbstatet*, const char*, const char*, size_t), \
3985 (this, state, from, from_end, max))
3986 #endif
3987 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3988 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const _Mbstatet *state,
3989 const char *from, const char *from_end, size_t max)
3991 _Mbstatet tmp_state = *state;
3992 int ret=0;
3994 TRACE("(%p %p %p %p %Iu)\n", this, state, from, from_end, max);
3996 while(ret<max && from!=from_end) {
3997 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3998 case -2:
3999 case -1:
4000 return ret;
4001 case 2:
4002 from++;
4003 /* fall through */
4004 case 0:
4005 case 1:
4006 from++;
4007 ret++;
4011 return ret;
4014 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
4015 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
4016 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
4017 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
4018 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
4019 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const _Mbstatet *state,
4020 const char *from, const char *from_end, size_t max)
4022 TRACE("(%p %p %p %p %Iu)\n", this, state, from, from_end, max);
4023 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
4026 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
4027 locale_id numpunct_char_id = {0};
4029 /* ??_7?$numpunct@D@std@@6B@ */
4030 extern const vtable_ptr MSVCP_numpunct_char_vtable;
4032 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
4033 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4034 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
4035 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, bool isdef)
4037 int len;
4039 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4041 len = strlen(_Locinfo__Getfalse(locinfo))+1;
4042 this->false_name = MSVCRT_operator_new(len);
4043 if(this->false_name)
4044 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
4046 len = strlen(_Locinfo__Gettrue(locinfo))+1;
4047 this->true_name = MSVCRT_operator_new(len);
4048 if(this->true_name)
4049 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
4051 if(isdef) {
4052 this->grouping = MSVCRT_operator_new(1);
4053 if(this->grouping)
4054 *(char*)this->grouping = 0;
4056 this->dp = '.';
4057 this->sep = ',';
4058 } else {
4059 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4061 len = strlen(lc->grouping)+1;
4062 this->grouping = MSVCRT_operator_new(len);
4063 if(this->grouping)
4064 memcpy((char*)this->grouping, lc->grouping, len);
4066 this->dp = lc->decimal_point[0];
4067 this->sep = lc->thousands_sep[0];
4070 if(!this->false_name || !this->true_name || !this->grouping) {
4071 MSVCRT_operator_delete((char*)this->grouping);
4072 MSVCRT_operator_delete((char*)this->false_name);
4073 MSVCRT_operator_delete((char*)this->true_name);
4075 ERR("Out of memory\n");
4076 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4080 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
4081 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
4082 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
4083 void __thiscall numpunct_char__Tidy(numpunct_char *this)
4085 TRACE("(%p)\n", this);
4087 MSVCRT_operator_delete((char*)this->grouping);
4088 MSVCRT_operator_delete((char*)this->false_name);
4089 MSVCRT_operator_delete((char*)this->true_name);
4092 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
4093 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4094 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
4095 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
4096 const _Locinfo *locinfo, size_t refs, bool usedef)
4098 TRACE("(%p %p %Iu %d)\n", this, locinfo, refs, usedef);
4099 locale_facet_ctor_refs(&this->facet, refs);
4100 this->facet.vtable = &MSVCP_numpunct_char_vtable;
4101 numpunct_char__Init(this, locinfo, usedef);
4102 return this;
4105 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
4106 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
4107 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
4108 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
4109 const char *name, size_t refs, bool usedef)
4111 _Locinfo locinfo;
4113 TRACE("(%p %s %Iu %d)\n", this, debugstr_a(name), refs, usedef);
4114 locale_facet_ctor_refs(&this->facet, refs);
4115 this->facet.vtable = &MSVCP_numpunct_char_vtable;
4117 _Locinfo_ctor_cstr(&locinfo, name);
4118 numpunct_char__Init(this, &locinfo, usedef);
4119 _Locinfo_dtor(&locinfo);
4120 return this;
4123 /* ??0?$numpunct@D@std@@QAE@I@Z */
4124 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
4125 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
4126 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, size_t refs)
4128 TRACE("(%p %Iu)\n", this, refs);
4129 return numpunct_char_ctor_name(this, "C", refs, FALSE);
4132 /* ??_F?$numpunct@D@std@@QAEXXZ */
4133 /* ??_F?$numpunct@D@std@@QEAAXXZ */
4134 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
4135 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
4137 return numpunct_char_ctor_refs(this, 0);
4140 /* ??1?$numpunct@D@std@@UAE@XZ */
4141 /* ??1?$numpunct@D@std@@UEAA@XZ */
4142 /* ??1?$numpunct@D@std@@MAE@XZ */
4143 /* ??1?$numpunct@D@std@@MEAA@XZ */
4144 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
4145 void __thiscall numpunct_char_dtor(numpunct_char *this)
4147 TRACE("(%p)\n", this);
4148 numpunct_char__Tidy(this);
4151 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
4152 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
4154 TRACE("(%p %x)\n", this, flags);
4155 if(flags & 2) {
4156 /* we have an array, with the number of elements stored before the first object */
4157 INT_PTR i, *ptr = (INT_PTR *)this-1;
4159 for(i=*ptr-1; i>=0; i--)
4160 numpunct_char_dtor(this+i);
4161 MSVCRT_operator_delete(ptr);
4162 } else {
4163 numpunct_char_dtor(this);
4164 if(flags & 1)
4165 MSVCRT_operator_delete(this);
4168 return this;
4171 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4172 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4173 size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
4175 TRACE("(%p %p)\n", facet, loc);
4177 if(facet && !*facet) {
4178 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
4179 if(!*facet) {
4180 ERR("Out of memory\n");
4181 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4182 return 0;
4184 numpunct_char_ctor_name((numpunct_char*)*facet,
4185 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4188 return LC_NUMERIC;
4191 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z */
4192 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4193 size_t __cdecl numpunct_char__Getcat_old(const locale_facet **facet)
4195 return numpunct_char__Getcat(facet, locale_classic());
4198 static numpunct_char* numpunct_char_use_facet(const locale *loc)
4200 static numpunct_char *obj = NULL;
4202 _Lockit lock;
4203 const locale_facet *fac;
4205 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4206 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
4207 if(fac) {
4208 _Lockit_dtor(&lock);
4209 return (numpunct_char*)fac;
4212 if(obj) {
4213 _Lockit_dtor(&lock);
4214 return obj;
4217 numpunct_char__Getcat(&fac, loc);
4218 obj = (numpunct_char*)fac;
4219 call_locale_facet__Incref(&obj->facet);
4220 locale_facet_register(&obj->facet);
4221 _Lockit_dtor(&lock);
4223 return obj;
4226 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
4227 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
4228 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
4229 #if _MSVCP_VER <= 100
4230 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4231 char, (const numpunct_char *this), (this))
4232 #else
4233 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4234 char, (const numpunct_char *this), (this))
4235 #endif
4236 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
4238 TRACE("(%p)\n", this);
4239 return this->dp;
4242 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
4243 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
4244 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
4245 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
4247 TRACE("(%p)\n", this);
4248 return call_numpunct_char_do_decimal_point(this);
4251 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
4252 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
4253 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
4254 #if _MSVCP_VER <= 100
4255 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4256 char, (const numpunct_char*), (this))
4257 #else
4258 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4259 char, (const numpunct_char*), (this))
4260 #endif
4261 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
4263 TRACE("(%p)\n", this);
4264 return this->sep;
4267 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
4268 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
4269 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
4270 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
4272 TRACE("(%p)\n", this);
4273 return call_numpunct_char_do_thousands_sep(this);
4276 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4277 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4278 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
4279 #if _MSVCP_VER <= 100
4280 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4281 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4282 #else
4283 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4284 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4285 #endif
4286 basic_string_char* __thiscall numpunct_char_do_grouping(
4287 const numpunct_char *this, basic_string_char *ret)
4289 TRACE("(%p)\n", this);
4290 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4293 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4294 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4295 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
4296 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
4298 TRACE("(%p)\n", this);
4299 return call_numpunct_char_do_grouping(this, ret);
4302 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4303 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4304 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
4305 #if _MSVCP_VER <= 100
4306 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4307 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4308 #else
4309 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4310 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4311 #endif
4312 basic_string_char* __thiscall numpunct_char_do_falsename(
4313 const numpunct_char *this, basic_string_char *ret)
4315 TRACE("(%p)\n", this);
4316 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
4319 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4320 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4321 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
4322 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
4324 TRACE("(%p)\n", this);
4325 return call_numpunct_char_do_falsename(this, ret);
4328 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4329 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4330 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
4331 #if _MSVCP_VER <= 100
4332 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4333 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4334 #else
4335 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4336 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4337 #endif
4338 basic_string_char* __thiscall numpunct_char_do_truename(
4339 const numpunct_char *this, basic_string_char *ret)
4341 TRACE("(%p)\n", this);
4342 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
4345 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4346 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4347 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
4348 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
4350 TRACE("(%p)\n", this);
4351 return call_numpunct_char_do_truename(this, ret);
4354 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
4355 locale_id numpunct_wchar_id = {0};
4356 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
4357 locale_id numpunct_short_id = {0};
4359 /* ??_7?$numpunct@_W@std@@6B@ */
4360 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
4361 /* ??_7?$numpunct@G@std@@6B@ */
4362 extern const vtable_ptr MSVCP_numpunct_short_vtable;
4364 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
4365 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4366 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
4367 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4368 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
4369 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
4370 const _Locinfo *locinfo, bool isdef)
4372 const char *to_convert;
4373 _Cvtvec cvt;
4374 int len;
4376 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4378 _Locinfo__Getcvt(locinfo, &cvt);
4380 to_convert = _Locinfo__Getfalse(locinfo);
4381 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4382 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4383 if(this->false_name)
4384 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4385 (wchar_t*)this->false_name, len);
4387 to_convert = _Locinfo__Gettrue(locinfo);
4388 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4389 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4390 if(this->true_name)
4391 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4392 (wchar_t*)this->true_name, len);
4394 if(isdef) {
4395 this->grouping = MSVCRT_operator_new(1);
4396 if(this->grouping)
4397 *(char*)this->grouping = 0;
4399 this->dp = '.';
4400 this->sep = ',';
4401 } else {
4402 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4404 len = strlen(lc->grouping)+1;
4405 this->grouping = MSVCRT_operator_new(len);
4406 if(this->grouping)
4407 memcpy((char*)this->grouping, lc->grouping, len);
4409 this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
4410 this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
4413 if(!this->false_name || !this->true_name || !this->grouping) {
4414 MSVCRT_operator_delete((char*)this->grouping);
4415 MSVCRT_operator_delete((wchar_t*)this->false_name);
4416 MSVCRT_operator_delete((wchar_t*)this->true_name);
4418 ERR("Out of memory\n");
4419 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4423 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
4424 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
4425 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
4426 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
4427 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
4428 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
4430 TRACE("(%p)\n", this);
4432 MSVCRT_operator_delete((char*)this->grouping);
4433 MSVCRT_operator_delete((wchar_t*)this->false_name);
4434 MSVCRT_operator_delete((wchar_t*)this->true_name);
4437 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
4438 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4439 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
4440 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
4441 const _Locinfo *locinfo, size_t refs, bool usedef)
4443 TRACE("(%p %p %Iu %d)\n", this, locinfo, refs, usedef);
4444 locale_facet_ctor_refs(&this->facet, refs);
4445 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4446 numpunct_wchar__Init(this, locinfo, usedef);
4447 return this;
4450 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
4451 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4452 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
4453 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
4454 const _Locinfo *locinfo, size_t refs, bool usedef)
4456 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
4457 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4458 return this;
4461 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
4462 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
4463 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
4464 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
4465 const char *name, size_t refs, bool usedef)
4467 _Locinfo locinfo;
4469 TRACE("(%p %s %Iu %d)\n", this, debugstr_a(name), refs, usedef);
4470 locale_facet_ctor_refs(&this->facet, refs);
4471 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4473 _Locinfo_ctor_cstr(&locinfo, name);
4474 numpunct_wchar__Init(this, &locinfo, usedef);
4475 _Locinfo_dtor(&locinfo);
4476 return this;
4479 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
4480 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
4481 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
4482 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
4483 const char *name, size_t refs, bool usedef)
4485 numpunct_wchar_ctor_name(this, name, refs, usedef);
4486 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4487 return this;
4490 /* ??0?$numpunct@_W@std@@QAE@I@Z */
4491 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
4492 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
4493 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, size_t refs)
4495 TRACE("(%p %Iu)\n", this, refs);
4496 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
4499 /* ??0?$numpunct@G@std@@QAE@I@Z */
4500 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
4501 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
4502 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, size_t refs)
4504 numpunct_wchar_ctor_refs(this, refs);
4505 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4506 return this;
4509 /* ??_F?$numpunct@_W@std@@QAEXXZ */
4510 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
4511 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
4512 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
4514 return numpunct_wchar_ctor_refs(this, 0);
4517 /* ??_F?$numpunct@G@std@@QAEXXZ */
4518 /* ??_F?$numpunct@G@std@@QEAAXXZ */
4519 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
4520 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
4522 return numpunct_short_ctor_refs(this, 0);
4525 /* ??1?$numpunct@G@std@@UAE@XZ */
4526 /* ??1?$numpunct@G@std@@UEAA@XZ */
4527 /* ??1?$numpunct@_W@std@@MAE@XZ */
4528 /* ??1?$numpunct@_W@std@@MEAA@XZ */
4529 /* ??1?$numpunct@G@std@@MAE@XZ */
4530 /* ??1?$numpunct@G@std@@MEAA@XZ */
4531 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
4532 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
4534 TRACE("(%p)\n", this);
4535 numpunct_wchar__Tidy(this);
4538 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
4539 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
4541 TRACE("(%p %x)\n", this, flags);
4542 if(flags & 2) {
4543 /* we have an array, with the number of elements stored before the first object */
4544 INT_PTR i, *ptr = (INT_PTR *)this-1;
4546 for(i=*ptr-1; i>=0; i--)
4547 numpunct_wchar_dtor(this+i);
4548 MSVCRT_operator_delete(ptr);
4549 } else {
4550 numpunct_wchar_dtor(this);
4551 if(flags & 1)
4552 MSVCRT_operator_delete(this);
4555 return this;
4558 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4559 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4560 size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
4562 TRACE("(%p %p)\n", facet, loc);
4564 if(facet && !*facet) {
4565 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4566 if(!*facet) {
4567 ERR("Out of memory\n");
4568 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4569 return 0;
4571 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
4572 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4575 return LC_NUMERIC;
4578 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@@Z */
4579 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4580 size_t __cdecl numpunct_wchar__Getcat_old(const locale_facet **facet)
4582 return numpunct_wchar__Getcat(facet, locale_classic());
4585 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
4587 static numpunct_wchar *obj = NULL;
4589 _Lockit lock;
4590 const locale_facet *fac;
4592 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4593 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
4594 if(fac) {
4595 _Lockit_dtor(&lock);
4596 return (numpunct_wchar*)fac;
4599 if(obj) {
4600 _Lockit_dtor(&lock);
4601 return obj;
4604 numpunct_wchar__Getcat(&fac, loc);
4605 obj = (numpunct_wchar*)fac;
4606 call_locale_facet__Incref(&obj->facet);
4607 locale_facet_register(&obj->facet);
4608 _Lockit_dtor(&lock);
4610 return obj;
4613 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4614 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4615 size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
4617 TRACE("(%p %p)\n", facet, loc);
4619 if(facet && !*facet) {
4620 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4621 if(!*facet) {
4622 ERR("Out of memory\n");
4623 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4624 return 0;
4626 numpunct_short_ctor_name((numpunct_wchar*)*facet,
4627 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4630 return LC_NUMERIC;
4633 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@@Z */
4634 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4635 size_t __cdecl numpunct_short__Getcat_old(const locale_facet **facet)
4637 return numpunct_short__Getcat(facet, locale_classic());
4640 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
4642 static numpunct_wchar *obj = NULL;
4644 _Lockit lock;
4645 const locale_facet *fac;
4647 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4648 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
4649 if(fac) {
4650 _Lockit_dtor(&lock);
4651 return (numpunct_wchar*)fac;
4654 if(obj) {
4655 _Lockit_dtor(&lock);
4656 return obj;
4659 numpunct_short__Getcat(&fac, loc);
4660 obj = (numpunct_wchar*)fac;
4661 call_locale_facet__Incref(&obj->facet);
4662 locale_facet_register(&obj->facet);
4663 _Lockit_dtor(&lock);
4665 return obj;
4668 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
4669 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
4670 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
4671 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
4672 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
4673 #if _MSVCP_VER <= 100
4674 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4675 wchar_t, (const numpunct_wchar *this), (this))
4676 #else
4677 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4678 wchar_t, (const numpunct_wchar *this), (this))
4679 #endif
4680 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
4682 TRACE("(%p)\n", this);
4683 return this->dp;
4686 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
4687 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
4688 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
4689 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
4690 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
4691 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
4693 TRACE("(%p)\n", this);
4694 return call_numpunct_wchar_do_decimal_point(this);
4697 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
4698 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
4699 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
4700 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
4701 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
4702 #if _MSVCP_VER <= 100
4703 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4704 wchar_t, (const numpunct_wchar *this), (this))
4705 #else
4706 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4707 wchar_t, (const numpunct_wchar *this), (this))
4708 #endif
4709 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
4711 TRACE("(%p)\n", this);
4712 return this->sep;
4715 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4716 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4717 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4718 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4719 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4720 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4722 TRACE("(%p)\n", this);
4723 return call_numpunct_wchar_do_thousands_sep(this);
4726 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4727 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4728 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4729 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4730 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4731 #if _MSVCP_VER <= 100
4732 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4733 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4734 #else
4735 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4736 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4737 #endif
4738 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4740 TRACE("(%p)\n", this);
4741 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4744 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4745 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4746 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4747 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4748 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4749 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4751 TRACE("(%p)\n", this);
4752 return call_numpunct_wchar_do_grouping(this, ret);
4755 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4756 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4757 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4758 /* ?do_falsename@?$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_falsename, 8)
4760 #if _MSVCP_VER <= 100
4761 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4762 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4763 #else
4764 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4765 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4766 #endif
4767 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4769 TRACE("(%p)\n", this);
4770 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4773 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4774 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4775 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4776 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4777 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4778 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4780 TRACE("(%p)\n", this);
4781 return call_numpunct_wchar_do_falsename(this, ret);
4784 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4785 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4786 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4787 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4788 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4789 #if _MSVCP_VER <= 100
4790 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4791 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4792 #else
4793 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4794 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4795 #endif
4796 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4798 TRACE("(%p)\n", this);
4799 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4802 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4803 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4804 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4805 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4806 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4807 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4809 TRACE("(%p)\n", this);
4810 return call_numpunct_wchar_do_truename(this, ret);
4813 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4815 double ret = strtod(buf, buf_end);
4817 if(exp)
4818 ret *= pow(10, exp);
4819 return ret;
4822 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4824 double ret;
4826 *err = *_errno();
4827 *_errno() = 0;
4828 ret = _Stod(buf, buf_end, exp);
4829 if(*_errno()) {
4830 *err = *_errno();
4831 }else {
4832 *_errno() = *err;
4833 *err = 0;
4835 return ret;
4838 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4840 return _Stod(buf, buf_end, exp);
4843 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4845 return _Stodx(buf, buf_end, exp, err);
4848 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
4850 return _strtoi64(buf, buf_end, base);
4853 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
4855 __int64 ret;
4857 *err = *_errno();
4858 *_errno() = 0;
4859 ret = _strtoi64(buf, buf_end, base);
4860 if(*_errno()) {
4861 *err = *_errno();
4862 }else {
4863 *_errno() = *err;
4864 *err = 0;
4866 return ret;
4869 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4871 __int64 i = _Stollx(buf, buf_end, base, err);
4872 if(!*err && i!=(__int64)((LONG)i))
4873 *err = ERANGE;
4874 return i;
4877 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
4879 return _strtoui64(buf, buf_end, base);
4882 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
4884 unsigned __int64 ret;
4886 *err = *_errno();
4887 *_errno() = 0;
4888 ret = _strtoui64(buf, buf_end, base);
4889 if(*_errno()) {
4890 *err = *_errno();
4891 }else {
4892 *_errno() = *err;
4893 *err = 0;
4895 return ret;
4898 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4900 int err;
4901 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4902 if(!err && i!=(unsigned __int64)((ULONG)i))
4903 *_errno() = ERANGE;
4904 return buf[0]=='-' ? -i : i;
4907 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4909 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4910 if(!*err && i!=(unsigned __int64)((ULONG)i))
4911 *err = ERANGE;
4912 return buf[0]=='-' ? -i : i;
4915 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4916 locale_id num_get_wchar_id = {0};
4917 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4918 locale_id num_get_short_id = {0};
4920 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4921 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4922 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4923 extern const vtable_ptr MSVCP_num_get_short_vtable;
4925 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4926 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4927 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4928 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4929 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4930 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4932 TRACE("(%p %p)\n", this, locinfo);
4933 #if _MSVCP_VER <= 100
4934 _Locinfo__Getcvt(locinfo, &this->cvt);
4935 #endif
4938 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4939 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4940 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4941 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4942 const _Locinfo *locinfo, size_t refs)
4944 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
4946 locale_facet_ctor_refs(&this->facet, refs);
4947 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4949 num_get_wchar__Init(this, locinfo);
4950 return this;
4953 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4954 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4955 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4956 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4957 const _Locinfo *locinfo, size_t refs)
4959 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4960 this->facet.vtable = &MSVCP_num_get_short_vtable;
4961 return this;
4964 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4965 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4966 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4967 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, size_t refs)
4969 _Locinfo locinfo;
4971 TRACE("(%p %Iu)\n", this, refs);
4973 _Locinfo_ctor(&locinfo);
4974 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4975 _Locinfo_dtor(&locinfo);
4976 return this;
4979 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4980 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4981 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4982 num_get* __thiscall num_get_short_ctor_refs(num_get *this, size_t refs)
4984 num_get_wchar_ctor_refs(this, refs);
4985 this->facet.vtable = &MSVCP_num_get_short_vtable;
4986 return this;
4989 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4990 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4991 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4992 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4994 return num_get_wchar_ctor_refs(this, 0);
4997 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4998 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4999 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
5000 num_get* __thiscall num_get_short_ctor(num_get *this)
5002 return num_get_short_ctor_refs(this, 0);
5005 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
5006 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
5007 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
5008 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
5009 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
5010 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
5011 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
5012 void __thiscall num_get_wchar_dtor(num_get *this)
5014 TRACE("(%p)\n", this);
5015 locale_facet_dtor(&this->facet);
5018 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
5019 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
5021 TRACE("(%p %x)\n", this, flags);
5022 if(flags & 2) {
5023 /* we have an array, with the number of elements stored before the first object */
5024 INT_PTR i, *ptr = (INT_PTR *)this-1;
5026 for(i=*ptr-1; i>=0; i--)
5027 num_get_wchar_dtor(this+i);
5028 MSVCRT_operator_delete(ptr);
5029 } else {
5030 num_get_wchar_dtor(this);
5031 if(flags & 1)
5032 MSVCRT_operator_delete(this);
5035 return this;
5038 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5039 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5040 size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
5042 TRACE("(%p %p)\n", facet, loc);
5044 if(facet && !*facet) {
5045 _Locinfo locinfo;
5047 *facet = MSVCRT_operator_new(sizeof(num_get));
5048 if(!*facet) {
5049 ERR("Out of memory\n");
5050 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5051 return 0;
5054 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
5055 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5056 _Locinfo_dtor(&locinfo);
5059 return LC_NUMERIC;
5062 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5063 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5064 size_t __cdecl num_get_wchar__Getcat_old(const locale_facet **facet)
5066 return num_get_wchar__Getcat(facet, locale_classic());
5069 num_get* num_get_wchar_use_facet(const locale *loc)
5071 static num_get *obj = NULL;
5073 _Lockit lock;
5074 const locale_facet *fac;
5076 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5077 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
5078 if(fac) {
5079 _Lockit_dtor(&lock);
5080 return (num_get*)fac;
5083 if(obj) {
5084 _Lockit_dtor(&lock);
5085 return obj;
5088 num_get_wchar__Getcat(&fac, loc);
5089 obj = (num_get*)fac;
5090 call_locale_facet__Incref(&obj->facet);
5091 locale_facet_register(&obj->facet);
5092 _Lockit_dtor(&lock);
5094 return obj;
5097 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5098 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5099 size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
5101 if(facet && !*facet) {
5102 num_get_wchar__Getcat(facet, loc);
5103 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
5106 return LC_NUMERIC;
5109 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5110 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5111 size_t __cdecl num_get_short__Getcat_old(const locale_facet **facet)
5113 return num_get_short__Getcat(facet, locale_classic());
5116 num_get* num_get_short_use_facet(const locale *loc)
5118 static num_get *obj = NULL;
5120 _Lockit lock;
5121 const locale_facet *fac;
5123 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5124 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
5125 if(fac) {
5126 _Lockit_dtor(&lock);
5127 return (num_get*)fac;
5130 if(obj) {
5131 _Lockit_dtor(&lock);
5132 return obj;
5135 num_get_short__Getcat(&fac, loc);
5136 obj = (num_get*)fac;
5137 call_locale_facet__Incref(&obj->facet);
5138 locale_facet_register(&obj->facet);
5139 _Lockit_dtor(&lock);
5141 return obj;
5144 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5145 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
5147 basic_string_char grouping_bstr;
5148 basic_string_char groups_found;
5149 int i, groups_no = 0, cur_group = 0, exp = 0;
5150 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
5151 wchar_t sep = 0, digits[11], *digits_pos;
5152 const char *grouping, *groups;
5153 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5154 const _Cvtvec *cvt;
5156 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5158 #if _MSVCP_VER <= 100
5159 cvt = &this->cvt;
5160 #else
5161 cvt = &ctype_wchar_use_facet(loc)->cvt;
5162 #endif
5164 for(i=0; i<10; i++)
5165 digits[i] = mb_to_wc('0'+i, cvt);
5166 digits[10] = 0;
5168 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5169 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5170 #if _MSVCP_VER >= 70
5171 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5172 #endif
5174 if(sep)
5175 MSVCP_basic_string_char_ctor(&groups_found);
5177 istreambuf_iterator_wchar_val(first);
5178 /* get sign */
5179 if(first->strbuf && first->val==mb_to_wc('-', cvt)) {
5180 *dest++ = '-';
5181 istreambuf_iterator_wchar_inc(first);
5182 }else if(first->strbuf && first->val==mb_to_wc('+', cvt)) {
5183 *dest++ = '+';
5184 istreambuf_iterator_wchar_inc(first);
5187 /* read possibly grouped numbers before decimal */
5188 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5189 if(!(digits_pos = wcschr(digits, first->val))) {
5190 if(sep && first->val==sep) {
5191 if(!groups_no) break; /* empty group - stop parsing */
5192 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5193 groups_no = 0;
5194 ++cur_group;
5195 }else {
5196 break;
5198 }else {
5199 got_digit = TRUE; /* found a digit, zero or non-zero */
5200 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5201 if(!got_nonzero && first->val == digits[0])
5203 ++groups_no;
5204 continue;
5206 got_nonzero = TRUE;
5207 if(dest < num_end)
5208 *dest++ = '0'+digits_pos-digits;
5209 else
5210 exp++; /* too many digits, just multiply by 10 */
5211 if(sep && groups_no<CHAR_MAX)
5212 ++groups_no;
5216 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5217 if(got_digit && !got_nonzero)
5218 *dest++ = '0';
5220 /* get decimal, if any */
5221 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
5222 if(dest < num_end)
5223 *dest++ = *localeconv()->decimal_point;
5224 istreambuf_iterator_wchar_inc(first);
5227 /* read non-grouped after decimal */
5228 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5229 if(!(digits_pos = wcschr(digits, first->val)))
5230 break;
5231 else if(dest<num_end) {
5232 got_digit = TRUE;
5233 *dest++ = '0'+digits_pos-digits;
5237 /* read exponent, if any */
5238 if(first->strbuf && (first->val==mb_to_wc('e', cvt) || first->val==mb_to_wc('E', cvt))) {
5239 *dest++ = 'e';
5240 istreambuf_iterator_wchar_inc(first);
5242 if(first->strbuf && first->val==mb_to_wc('-', cvt)) {
5243 *dest++ = '-';
5244 istreambuf_iterator_wchar_inc(first);
5245 }else if(first->strbuf && first->val==mb_to_wc('+', cvt)) {
5246 *dest++ = '+';
5247 istreambuf_iterator_wchar_inc(first);
5250 got_digit = got_nonzero = FALSE;
5251 error = TRUE;
5252 /* skip any leading zeroes */
5253 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
5254 error = FALSE;
5256 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
5257 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5258 error = FALSE;
5259 if(dest<exp_end)
5260 *dest++ = '0'+digits_pos-digits;
5263 /* if just found zeroes for exponent, use that */
5264 if(got_digit && !got_nonzero)
5266 error = FALSE;
5267 if(dest<exp_end)
5268 *dest++ = '0';
5272 if(sep && groups_no)
5273 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5275 if(!cur_group) /* no groups, skip loop */
5276 cur_group--;
5277 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
5278 error = TRUE; /* trailing empty */
5280 for(; cur_group>=0 && !error; cur_group--) {
5281 if(*grouping == CHAR_MAX) {
5282 if(cur_group)
5283 error = TRUE;
5284 break;
5285 }else if((cur_group && *grouping!=groups[cur_group])
5286 || (!cur_group && *grouping<groups[cur_group])) {
5287 error = TRUE;
5288 break;
5289 }else if(grouping[1]) {
5290 grouping++;
5293 MSVCP_basic_string_char_dtor(&grouping_bstr);
5294 if(sep)
5295 MSVCP_basic_string_char_dtor(&groups_found);
5297 if(error) {
5298 *dest_beg = '\0';
5299 return 0;
5301 *dest++ = '\0';
5302 return exp;
5305 /* ?_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 */
5306 /* ?_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 */
5307 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5308 istreambuf_iterator_wchar *last, const locale *loc)
5310 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
5313 /* ?_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 */
5314 /* ?_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 */
5315 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5316 istreambuf_iterator_wchar *last, const locale *loc)
5318 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
5321 /* ?_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 */
5322 /* ?_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 */
5323 /* ?_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 */
5324 /* ?_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 */
5325 int __cdecl num_get_wchar__Getffldx(num_get *this, char *dest, istreambuf_iterator_wchar *first,
5326 istreambuf_iterator_wchar *last, ios_base *ios, int *phexexp)
5328 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
5329 return -1;
5332 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5333 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
5335 wchar_t digits[23], *digits_pos, sep = 0;
5336 basic_string_char grouping_bstr;
5337 basic_string_char groups_found;
5338 int i, basefield, base, groups_no = 0, cur_group = 0;
5339 char *dest_beg = dest, *dest_end = dest+24;
5340 const char *grouping, *groups;
5341 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5342 const _Cvtvec *cvt;
5344 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5346 #if _MSVCP_VER <= 100
5347 cvt = &this->cvt;
5348 #else
5349 cvt = &ctype_wchar_use_facet(loc)->cvt;
5350 #endif
5352 for(i=0; i<10; i++)
5353 digits[i] = mb_to_wc('0'+i, cvt);
5354 for(i=0; i<6; i++) {
5355 digits[10+i] = mb_to_wc('a'+i, cvt);
5356 digits[16+i] = mb_to_wc('A'+i, cvt);
5359 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5360 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5361 #if _MSVCP_VER >= 70
5362 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5363 #endif
5365 basefield = fmtflags & FMTFLAG_basefield;
5366 if(basefield == FMTFLAG_oct)
5367 base = 8;
5368 else if(basefield == FMTFLAG_hex)
5369 base = 22; /* equal to the size of digits buffer */
5370 else if(!basefield)
5371 base = 0;
5372 else
5373 base = 10;
5375 istreambuf_iterator_wchar_val(first);
5376 if(first->strbuf && first->val==mb_to_wc('-', cvt)) {
5377 *dest++ = '-';
5378 istreambuf_iterator_wchar_inc(first);
5379 }else if(first->strbuf && first->val==mb_to_wc('+', cvt)) {
5380 *dest++ = '+';
5381 istreambuf_iterator_wchar_inc(first);
5384 if(first->strbuf && first->val==digits[0]) {
5385 found_zero = TRUE;
5386 istreambuf_iterator_wchar_inc(first);
5387 if(first->strbuf && (first->val==mb_to_wc('x', cvt) || first->val==mb_to_wc('X', cvt))) {
5388 if(!base || base == 22) {
5389 found_zero = FALSE;
5390 istreambuf_iterator_wchar_inc(first);
5391 base = 22;
5392 }else {
5393 base = 10;
5395 }else {
5396 error = FALSE;
5397 if(!base) base = 8;
5399 }else {
5400 if(!base) base = 10;
5402 digits[base] = 0;
5404 if(sep) {
5405 MSVCP_basic_string_char_ctor(&groups_found);
5406 if(found_zero) ++groups_no;
5409 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5410 if(!(digits_pos = wcschr(digits, first->val))) {
5411 if(sep && first->val==sep) {
5412 if(!groups_no) break; /* empty group - stop parsing */
5413 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5414 groups_no = 0;
5415 ++cur_group;
5416 }else {
5417 break;
5419 }else {
5420 error = FALSE;
5421 if(dest_empty && first->val == digits[0]) {
5422 found_zero = TRUE;
5423 ++groups_no;
5424 continue;
5426 dest_empty = FALSE;
5427 /* skip digits that can't be copied to dest buffer, other
5428 * functions are responsible for detecting overflows */
5429 if(dest < dest_end)
5430 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
5431 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
5432 'A'+digits_pos-digits-16));
5433 if(sep && groups_no<CHAR_MAX)
5434 ++groups_no;
5438 if(sep && groups_no)
5439 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5441 if(!cur_group) { /* no groups, skip loop */
5442 cur_group--;
5443 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
5444 error = TRUE; /* trailing empty */
5445 found_zero = FALSE;
5448 for(; cur_group>=0 && !error; cur_group--) {
5449 if(*grouping == CHAR_MAX) {
5450 if(cur_group)
5451 error = TRUE;
5452 break;
5453 }else if((cur_group && *grouping!=groups[cur_group])
5454 || (!cur_group && *grouping<groups[cur_group])) {
5455 error = TRUE;
5456 break;
5457 }else if(grouping[1]) {
5458 grouping++;
5462 MSVCP_basic_string_char_dtor(&grouping_bstr);
5463 if(sep)
5464 MSVCP_basic_string_char_dtor(&groups_found);
5466 if(error) {
5467 if (found_zero)
5468 *dest++ = '0';
5469 else
5470 dest = dest_beg;
5471 }else if(dest_empty)
5472 *dest++ = '0';
5473 *dest = '\0';
5475 return (base==22 ? 16 : base);
5478 /* ?_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 */
5479 /* ?_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 */
5480 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5481 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5483 return num_get__Getifld(this, dest, first, last,
5484 fmtflags, loc, numpunct_wchar_use_facet(loc));
5487 /* ?_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 */
5488 /* ?_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 */
5489 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5490 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5492 return num_get__Getifld(this, dest, first, last,
5493 fmtflags, loc, numpunct_short_use_facet(loc));
5496 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABEH_W000@Z */
5497 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAH_W000@Z */
5498 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABEHGGGG@Z */
5499 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHGGGG@Z */
5500 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_wchar__Hexdig, 20)
5501 int __thiscall MSVCP_num_get_wchar__Hexdig(num_get *this, wchar_t dig, wchar_t e0, wchar_t al, wchar_t au)
5503 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
5504 return -1;
5507 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
5508 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5509 istreambuf_iterator_wchar last, ios_base *base, int *state,
5510 void **pval, numpunct_wchar *numpunct)
5512 unsigned __int64 v;
5513 char tmp[25], *end;
5514 int err;
5516 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5518 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5519 &last, FMTFLAG_hex, IOS_LOCALE(base), numpunct), &err);
5520 if(v!=(unsigned __int64)((INT_PTR)v))
5521 *state |= IOSTATE_failbit;
5522 else if(end!=tmp && !err)
5523 *pval = (void*)((INT_PTR)v);
5524 else
5525 *state |= IOSTATE_failbit;
5527 if(!first.strbuf)
5528 *state |= IOSTATE_eofbit;
5530 *ret = first;
5531 return ret;
5534 /* ?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 */
5535 /* ?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 */
5536 #if _MSVCP_VER <= 100
5537 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
5538 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5539 (this, ret, first, last, base, state, pval))
5540 #else
5541 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5542 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5543 (this, ret, first, last, base, state, pval))
5544 #endif
5545 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
5546 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5547 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5549 return num_get_do_get_void(this, ret, first, last, base,
5550 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5553 /* ?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 */
5554 /* ?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 */
5555 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
5556 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5557 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5559 return num_get_do_get_void(this, ret, first, last, base,
5560 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5563 /* ?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 */
5564 /* ?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 */
5565 /* ?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 */
5566 /* ?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 */
5567 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
5568 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5569 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5571 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5572 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
5575 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
5576 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5577 istreambuf_iterator_wchar last, ios_base *base, int *state,
5578 double *pval, numpunct_wchar *numpunct)
5580 double v;
5581 char tmp[32], *end;
5582 int err;
5584 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5586 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, IOS_LOCALE(base), numpunct), &err);
5587 if(end!=tmp && !err)
5588 *pval = v;
5589 else
5590 *state |= IOSTATE_failbit;
5592 if(!first.strbuf)
5593 *state |= IOSTATE_eofbit;
5595 *ret = first;
5596 return ret;
5599 /* ?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 */
5600 /* ?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 */
5601 /* ?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 */
5602 /* ?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 */
5603 #if _MSVCP_VER <= 100
5604 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
5605 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5606 (this, ret, first, last, base, state, pval))
5607 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5608 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5609 (this, ret, first, last, base, state, pval))
5610 #else
5611 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5612 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5613 (this, ret, first, last, base, state, pval))
5614 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5615 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5616 (this, ret, first, last, base, state, pval))
5617 #endif
5618 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
5619 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5620 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5622 return num_get_do_get_double(this, ret, first, last, base,
5623 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5626 /* ?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 */
5627 /* ?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 */
5628 /* ?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 */
5629 /* ?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 */
5630 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
5631 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5632 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5634 return num_get_do_get_double(this, ret, first, last, base,
5635 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5638 /* ?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 */
5639 /* ?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 */
5640 /* ?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 */
5641 /* ?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 */
5642 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
5643 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
5644 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5646 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5647 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
5650 /* ?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 */
5651 /* ?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 */
5652 /* ?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 */
5653 /* ?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 */
5654 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
5655 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5656 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5658 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5659 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
5662 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
5663 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5664 istreambuf_iterator_wchar last, ios_base *base, int *state,
5665 float *pval, numpunct_wchar *numpunct)
5667 float v;
5668 char tmp[32], *end;
5669 int err;
5671 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5673 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
5674 &last, IOS_LOCALE(base), numpunct), &err);
5675 if(end!=tmp && !err)
5676 *pval = v;
5677 else
5678 *state |= IOSTATE_failbit;
5680 if(!first.strbuf)
5681 *state |= IOSTATE_eofbit;
5683 *ret = first;
5684 return ret;
5687 /* ?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 */
5688 /* ?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 */
5689 #if _MSVCP_VER <= 100
5690 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5691 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5692 (this, ret, first, last, base, state, pval))
5693 #else
5694 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5695 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5696 (this, ret, first, last, base, state, pval))
5697 #endif
5698 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
5699 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5700 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5702 return num_get_do_get_float(this, ret, first, last, base,
5703 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5706 /* ?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 */
5707 /* ?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 */
5708 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
5709 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5710 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5712 return num_get_do_get_float(this, ret, first, last, base,
5713 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5716 /* ?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 */
5717 /* ?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 */
5718 /* ?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 */
5719 /* ?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 */
5720 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
5721 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5722 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5724 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5725 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
5728 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
5729 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5730 istreambuf_iterator_wchar last, ios_base *base, int *state,
5731 ULONGLONG *pval, numpunct_wchar *numpunct)
5733 unsigned __int64 v;
5734 char tmp[25], *end;
5735 int err;
5737 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5739 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5740 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5741 if(end!=tmp && !err)
5742 *pval = v;
5743 else
5744 *state |= IOSTATE_failbit;
5746 if(!first.strbuf)
5747 *state |= IOSTATE_eofbit;
5749 *ret = first;
5750 return ret;
5753 /* ?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 */
5754 /* ?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 */
5755 #if _MSVCP_VER <= 100
5756 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5757 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5758 (this, ret, first, last, base, state, pval))
5759 #else
5760 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5761 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5762 (this, ret, first, last, base, state, pval))
5763 #endif
5764 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
5765 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5766 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5768 return num_get_do_get_uint64(this, ret, first, last, base,
5769 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5772 /* ?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 */
5773 /* ?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 */
5774 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
5775 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5776 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5778 return num_get_do_get_uint64(this, ret, first, last, base,
5779 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5782 /* ?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 */
5783 /* ?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 */
5784 /* ?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 */
5785 /* ?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 */
5786 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5787 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5788 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5790 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5791 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5794 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5795 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5796 istreambuf_iterator_wchar last, ios_base *base, int *state,
5797 LONGLONG *pval, numpunct_wchar *numpunct)
5799 __int64 v;
5800 char tmp[25], *end;
5801 int err;
5803 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5805 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5806 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5807 if(end!=tmp && !err)
5808 *pval = v;
5809 else
5810 *state |= IOSTATE_failbit;
5812 if(!first.strbuf)
5813 *state |= IOSTATE_eofbit;
5815 *ret = first;
5816 return ret;
5819 /* ?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 */
5820 /* ?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 */
5821 #if _MSVCP_VER <= 100
5822 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5823 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5824 (this, ret, first, last, base, state, pval))
5825 #else
5826 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5827 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5828 (this, ret, first, last, base, state, pval))
5829 #endif
5830 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5831 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5832 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5834 return num_get_do_get_int64(this, ret, first, last, base,
5835 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5838 /* ?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 */
5839 /* ?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 */
5840 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5841 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5842 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5844 return num_get_do_get_int64(this, ret, first, last, base,
5845 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5848 /* ?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 */
5849 /* ?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 */
5850 /* ?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 */
5851 /* ?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 */
5852 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5853 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5854 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5856 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5857 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5860 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5861 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5862 istreambuf_iterator_wchar last, ios_base *base, int *state,
5863 ULONG *pval, numpunct_wchar *numpunct)
5865 ULONG v;
5866 char tmp[25], *end;
5867 int err;
5869 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5871 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5872 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5873 if(end!=tmp && !err)
5874 *pval = v;
5875 else
5876 *state |= IOSTATE_failbit;
5878 if(!first.strbuf)
5879 *state |= IOSTATE_eofbit;
5881 *ret = first;
5882 return ret;
5885 /* ?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 */
5886 /* ?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 */
5887 #if _MSVCP_VER <= 100
5888 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5889 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5890 (this, ret, first, last, base, state, pval))
5891 #else
5892 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5893 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5894 (this, ret, first, last, base, state, pval))
5895 #endif
5896 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5897 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5898 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5900 return num_get_do_get_ulong(this, ret, first, last, base,
5901 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5904 /* ?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 */
5905 /* ?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 */
5906 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5907 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5908 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5910 return num_get_do_get_ulong(this, ret, first, last, base,
5911 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5914 /* ?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 */
5915 /* ?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 */
5916 /* ?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 */
5917 /* ?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 */
5918 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5919 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5920 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5922 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5923 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5926 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5927 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5928 istreambuf_iterator_wchar last, ios_base *base, int *state,
5929 LONG *pval, numpunct_wchar *numpunct)
5931 LONG v;
5932 char tmp[25], *end;
5933 int err;
5935 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5937 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5938 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5939 if(end!=tmp && !err)
5940 *pval = v;
5941 else
5942 *state |= IOSTATE_failbit;
5944 if(!first.strbuf)
5945 *state |= IOSTATE_eofbit;
5947 *ret = first;
5948 return ret;
5951 /* ?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 */
5952 /* ?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 */
5953 #if _MSVCP_VER <= 100
5954 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5955 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5956 (this, ret, first, last, base, state, pval))
5957 #else
5958 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5959 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5960 (this, ret, first, last, base, state, pval))
5961 #endif
5962 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5963 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5964 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5966 return num_get_do_get_long(this, ret, first, last, base,
5967 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5970 /* ?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 */
5971 /* ?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 */
5972 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5973 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5974 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5976 return num_get_do_get_long(this, ret, first, last, base,
5977 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5980 /* ?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 */
5981 /* ?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 */
5982 /* ?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 */
5983 /* ?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 */
5984 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5985 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5986 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5988 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5989 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5992 /* ?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 */
5993 /* ?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 */
5994 #if _MSVCP_VER <= 100
5995 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5996 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5997 (this, ret, first, last, base, state, pval))
5998 #else
5999 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
6000 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
6001 (this, ret, first, last, base, state, pval))
6002 #endif
6003 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
6004 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
6005 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
6007 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6008 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
6011 /* ?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 */
6012 /* ?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 */
6013 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
6014 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
6015 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
6017 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6018 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
6021 /* ?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 */
6022 /* ?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 */
6023 /* ?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 */
6024 /* ?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 */
6025 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
6026 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
6027 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
6029 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6030 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
6033 /* ?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 */
6034 /* ?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 */
6035 #if _MSVCP_VER <= 100
6036 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
6037 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
6038 (this, ret, first, last, base, state, pval))
6039 #else
6040 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_wchar*, \
6041 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
6042 (this, ret, first, last, base, state, pval))
6043 #endif
6044 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
6045 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6046 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6048 ULONG v;
6049 char tmp[25], *beg, *end;
6050 int err, b;
6052 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6054 b = num_get_wchar__Getifld(this, tmp,
6055 &first, &last, base->fmtfl, IOS_LOCALE(base));
6056 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6057 v = _Stoulx(beg, &end, b, &err);
6059 if(v != (ULONG)((unsigned short)v))
6060 *state |= IOSTATE_failbit;
6061 else if(end!=beg && !err)
6062 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6063 else
6064 *state |= IOSTATE_failbit;
6066 if(!first.strbuf)
6067 *state |= IOSTATE_eofbit;
6069 *ret = first;
6070 return ret;
6073 /* ?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 */
6074 /* ?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 */
6075 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
6076 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6077 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6079 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
6080 return ret;
6083 /* ?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 */
6084 /* ?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 */
6085 /* ?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@ */
6086 /* ?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 */
6087 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
6088 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6089 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6091 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6092 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
6095 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
6096 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
6097 istreambuf_iterator_wchar last, ios_base *base, int *state,
6098 bool *pval, numpunct_wchar *numpunct)
6100 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6102 if(base->fmtfl & FMTFLAG_boolalpha) {
6103 basic_string_wchar false_bstr, true_bstr;
6104 const wchar_t *pfalse, *ptrue;
6106 numpunct_wchar_falsename(numpunct, &false_bstr);
6107 numpunct_wchar_truename(numpunct, &true_bstr);
6108 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
6109 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
6111 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
6112 if(pfalse && *pfalse && first.val!=*pfalse)
6113 pfalse = NULL;
6114 if(ptrue && *ptrue && first.val!=*ptrue)
6115 ptrue = NULL;
6117 if(pfalse && *pfalse && ptrue && !*ptrue)
6118 ptrue = NULL;
6119 if(ptrue && *ptrue && pfalse && !*pfalse)
6120 pfalse = NULL;
6122 if(pfalse)
6123 pfalse++;
6124 if(ptrue)
6125 ptrue++;
6127 if(pfalse || ptrue)
6128 istreambuf_iterator_wchar_inc(&first);
6130 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6131 break;
6134 if(ptrue)
6135 *pval = TRUE;
6136 else if(pfalse)
6137 *pval = FALSE;
6138 else
6139 *state |= IOSTATE_failbit;
6141 MSVCP_basic_string_wchar_dtor(&false_bstr);
6142 MSVCP_basic_string_wchar_dtor(&true_bstr);
6143 }else {
6144 char tmp[25], *end;
6145 int err;
6146 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
6147 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
6149 if(end!=tmp && err==0 && (v==0 || v==1))
6150 *pval = v;
6151 else
6152 *state |= IOSTATE_failbit;
6155 if(!first.strbuf)
6156 *state |= IOSTATE_eofbit;
6157 memcpy(ret, &first, sizeof(first));
6158 return ret;
6161 /* ?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 */
6162 /* ?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 */
6163 #if _MSVCP_VER <= 100
6164 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
6165 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, bool*), \
6166 (this, ret, first, last, base, state, pval))
6167 #else
6168 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_wchar*, \
6169 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, bool*), \
6170 (this, ret, first, last, base, state, pval))
6171 #endif
6172 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
6173 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6174 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, bool *pval)
6176 return num_get_do_get_bool(this, ret, first, last, base,
6177 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
6180 /* ?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 */
6181 /* ?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 */
6182 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
6183 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6184 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, bool *pval)
6186 return num_get_do_get_bool(this, ret, first, last, base,
6187 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
6190 /* ?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 */
6191 /* ?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 */
6192 /* ?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 */
6193 /* ?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 */
6194 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
6195 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6196 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, bool *pval)
6198 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6199 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
6202 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6203 locale_id num_get_char_id = {0};
6205 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6206 extern const vtable_ptr MSVCP_num_get_char_vtable;
6208 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6209 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6210 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
6211 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
6213 TRACE("(%p %p)\n", this, locinfo);
6214 #if _MSVCP_VER <= 100
6215 _Locinfo__Getcvt(locinfo, &this->cvt);
6216 #endif
6219 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6220 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6221 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
6222 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
6223 const _Locinfo *locinfo, size_t refs)
6225 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
6227 locale_facet_ctor_refs(&this->facet, refs);
6228 this->facet.vtable = &MSVCP_num_get_char_vtable;
6230 num_get_char__Init(this, locinfo);
6231 return this;
6234 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6235 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6236 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
6237 num_get* __thiscall num_get_char_ctor_refs(num_get *this, size_t refs)
6239 _Locinfo locinfo;
6241 TRACE("(%p %Iu)\n", this, refs);
6243 _Locinfo_ctor(&locinfo);
6244 num_get_char_ctor_locinfo(this, &locinfo, refs);
6245 _Locinfo_dtor(&locinfo);
6246 return this;
6249 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6250 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6251 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
6252 num_get* __thiscall num_get_char_ctor(num_get *this)
6254 return num_get_char_ctor_refs(this, 0);
6257 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
6258 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
6259 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6260 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6261 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
6262 void __thiscall num_get_char_dtor(num_get *this)
6264 TRACE("(%p)\n", this);
6265 locale_facet_dtor(&this->facet);
6268 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
6269 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
6271 TRACE("(%p %x)\n", this, flags);
6272 if(flags & 2) {
6273 /* we have an array, with the number of elements stored before the first object */
6274 INT_PTR i, *ptr = (INT_PTR *)this-1;
6276 for(i=*ptr-1; i>=0; i--)
6277 num_get_char_dtor(this+i);
6278 MSVCRT_operator_delete(ptr);
6279 } else {
6280 num_get_char_dtor(this);
6281 if(flags & 1)
6282 MSVCRT_operator_delete(this);
6285 return this;
6288 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6289 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6290 size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
6292 TRACE("(%p %p)\n", facet, loc);
6294 if(facet && !*facet) {
6295 _Locinfo locinfo;
6297 *facet = MSVCRT_operator_new(sizeof(num_get));
6298 if(!*facet) {
6299 ERR("Out of memory\n");
6300 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6301 return 0;
6304 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6305 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
6306 _Locinfo_dtor(&locinfo);
6309 return LC_NUMERIC;
6312 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6313 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6314 size_t __cdecl num_get_char__Getcat_old(const locale_facet **facet)
6316 return num_get_char__Getcat(facet, locale_classic());
6319 num_get* num_get_char_use_facet(const locale *loc)
6321 static num_get *obj = NULL;
6323 _Lockit lock;
6324 const locale_facet *fac;
6326 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6327 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
6328 if(fac) {
6329 _Lockit_dtor(&lock);
6330 return (num_get*)fac;
6333 if(obj) {
6334 _Lockit_dtor(&lock);
6335 return obj;
6338 num_get_char__Getcat(&fac, loc);
6339 obj = (num_get*)fac;
6340 call_locale_facet__Incref(&obj->facet);
6341 locale_facet_register(&obj->facet);
6342 _Lockit_dtor(&lock);
6344 return obj;
6347 /* ?_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 */
6348 /* ?_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 */
6349 /* Copies number to dest buffer, validates grouping and skips separators.
6350 * Updates first so it points past the number, all digits are skipped.
6351 * Returns how exponent needs to changed.
6352 * Size of dest buffer is not specified, assuming it's not smaller than 32:
6353 * strlen(+0.e+) + 22(digits) + 4(exponent) + 1(nullbyte)
6355 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6356 istreambuf_iterator_char *last, const locale *loc)
6358 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6359 basic_string_char grouping_bstr;
6360 basic_string_char groups_found;
6361 int groups_no = 0, cur_group = 0, exp = 0;
6362 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep = 0;
6363 const char *grouping, *groups;
6364 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
6366 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
6368 numpunct_char_grouping(numpunct, &grouping_bstr);
6369 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6370 #if _MSVCP_VER >= 70
6371 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6372 #endif
6374 if(sep)
6375 MSVCP_basic_string_char_ctor(&groups_found);
6377 istreambuf_iterator_char_val(first);
6378 /* get sign */
6379 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6380 *dest++ = first->val;
6381 istreambuf_iterator_char_inc(first);
6384 /* read possibly grouped numbers before decimal */
6385 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6386 if(first->val<'0' || first->val>'9') {
6387 if(sep && first->val==sep) {
6388 if(!groups_no) break; /* empty group - stop parsing */
6389 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6390 groups_no = 0;
6391 ++cur_group;
6392 }else {
6393 break;
6395 }else {
6396 got_digit = TRUE; /* found a digit, zero or non-zero */
6397 /* write digit to dest if not a leading zero (to not waste dest buffer) */
6398 if(!got_nonzero && first->val == '0')
6400 ++groups_no;
6401 continue;
6403 got_nonzero = TRUE;
6404 if(dest < num_end)
6405 *dest++ = first->val;
6406 else
6407 exp++; /* too many digits, just multiply by 10 */
6408 if(sep && groups_no<CHAR_MAX)
6409 ++groups_no;
6413 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
6414 if(got_digit && !got_nonzero)
6415 *dest++ = '0';
6417 /* get decimal, if any */
6418 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
6419 if(dest < num_end)
6420 *dest++ = *localeconv()->decimal_point;
6421 istreambuf_iterator_char_inc(first);
6424 /* read non-grouped after decimal */
6425 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6426 if(first->val<'0' || first->val>'9')
6427 break;
6428 else if(dest<num_end) {
6429 got_digit = TRUE;
6430 *dest++ = first->val;
6434 /* read exponent, if any */
6435 if(first->strbuf && (first->val=='e' || first->val=='E')) {
6436 *dest++ = first->val;
6437 istreambuf_iterator_char_inc(first);
6439 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6440 *dest++ = first->val;
6441 istreambuf_iterator_char_inc(first);
6444 got_digit = got_nonzero = FALSE;
6445 error = TRUE;
6446 /* skip any leading zeroes */
6447 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
6448 got_digit = TRUE;
6450 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
6451 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
6452 error = FALSE;
6453 if(dest<exp_end)
6454 *dest++ = first->val;
6457 /* if just found zeroes for exponent, use that */
6458 if(got_digit && !got_nonzero)
6460 error = FALSE;
6461 if(dest<exp_end)
6462 *dest++ = '0';
6466 if(sep && groups_no)
6467 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6469 if(!cur_group) /* no groups, skip loop */
6470 cur_group--;
6471 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
6472 error = TRUE; /* trailing empty */
6474 for(; cur_group>=0 && !error; cur_group--) {
6475 if(*grouping == CHAR_MAX) {
6476 if(cur_group)
6477 error = TRUE;
6478 break;
6479 }else if((cur_group && *grouping!=groups[cur_group])
6480 || (!cur_group && *grouping<groups[cur_group])) {
6481 error = TRUE;
6482 break;
6483 }else if(grouping[1]) {
6484 grouping++;
6487 MSVCP_basic_string_char_dtor(&grouping_bstr);
6488 if(sep)
6489 MSVCP_basic_string_char_dtor(&groups_found);
6491 if(error) {
6492 *dest_beg = '\0';
6493 return 0;
6495 *dest++ = '\0';
6496 return exp;
6499 /* ?_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 */
6500 /* ?_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 */
6501 int __cdecl num_get_char__Getffldx(const num_get *this, char *dest, istreambuf_iterator_char *first,
6502 istreambuf_iterator_char *last, ios_base *ios, int *phexexp)
6504 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
6505 return -1;
6508 /* ?_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 */
6509 /* ?_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 */
6510 /* Copies number to dest buffer, validates grouping and skips separators.
6511 * Updates first so it points past the number, all digits are skipped.
6512 * Returns number base (8, 10 or 16).
6513 * Size of dest buffer is not specified, assuming it's not smaller than 25:
6514 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
6516 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6517 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
6519 static const char digits[] = "0123456789abcdefABCDEF";
6521 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6522 basic_string_char grouping_bstr;
6523 basic_string_char groups_found;
6524 int basefield, base, groups_no = 0, cur_group = 0;
6525 char *dest_beg = dest, *dest_end = dest+24, sep = 0;
6526 const char *grouping, *groups;
6527 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
6529 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
6531 numpunct_char_grouping(numpunct, &grouping_bstr);
6532 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6533 #if _MSVCP_VER >= 70
6534 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6535 #endif
6537 basefield = fmtflags & FMTFLAG_basefield;
6538 if(basefield == FMTFLAG_oct)
6539 base = 8;
6540 else if(basefield == FMTFLAG_hex)
6541 base = 22; /* equal to the size of digits buffer */
6542 else if(!basefield)
6543 base = 0;
6544 else
6545 base = 10;
6547 istreambuf_iterator_char_val(first);
6548 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6549 *dest++ = first->val;
6550 istreambuf_iterator_char_inc(first);
6553 if(first->strbuf && first->val=='0') {
6554 found_zero = TRUE;
6555 istreambuf_iterator_char_inc(first);
6556 if(first->strbuf && (first->val=='x' || first->val=='X')) {
6557 if(!base || base == 22) {
6558 found_zero = FALSE;
6559 istreambuf_iterator_char_inc(first);
6560 base = 22;
6561 }else {
6562 base = 10;
6564 }else {
6565 error = FALSE;
6566 if(!base) base = 8;
6568 }else {
6569 if (!base) base = 10;
6572 if(sep)
6574 MSVCP_basic_string_char_ctor(&groups_found);
6575 if(found_zero) ++groups_no;
6578 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6579 if(!memchr(digits, first->val, base)) {
6580 if(sep && first->val==sep) {
6581 if(!groups_no) break; /* empty group - stop parsing */
6582 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6583 groups_no = 0;
6584 ++cur_group;
6585 }else {
6586 break;
6588 }else {
6589 error = FALSE;
6590 if(dest_empty && first->val == '0')
6592 found_zero = TRUE;
6593 ++groups_no;
6594 continue;
6596 dest_empty = FALSE;
6597 /* skip digits that can't be copied to dest buffer, other
6598 * functions are responsible for detecting overflows */
6599 if(dest < dest_end)
6600 *dest++ = first->val;
6601 if(sep && groups_no<CHAR_MAX)
6602 ++groups_no;
6606 if(sep && groups_no)
6607 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6609 if(!cur_group) { /* no groups, skip loop */
6610 cur_group--;
6611 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
6612 error = TRUE; /* trailing empty */
6613 found_zero = FALSE;
6616 for(; cur_group>=0 && !error; cur_group--) {
6617 if(*grouping == CHAR_MAX) {
6618 if(cur_group)
6619 error = TRUE;
6620 break;
6621 }else if((cur_group && *grouping!=groups[cur_group])
6622 || (!cur_group && *grouping<groups[cur_group])) {
6623 error = TRUE;
6624 break;
6625 }else if(grouping[1]) {
6626 grouping++;
6630 MSVCP_basic_string_char_dtor(&grouping_bstr);
6631 if(sep)
6632 MSVCP_basic_string_char_dtor(&groups_found);
6634 if(error) {
6635 if (found_zero)
6636 *dest++ = '0';
6637 else
6638 dest = dest_beg;
6639 }else if(dest_empty)
6640 *dest++ = '0';
6641 *dest = '\0';
6643 return (base==22 ? 16 : base);
6646 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABEHD000@Z */
6647 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHD000@Z */
6648 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_char__Hexdig, 20)
6649 int __thiscall MSVCP_num_get_char__Hexdig(num_get *this, char dig, char e0, char al, char au)
6651 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
6652 return -1;
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@AAHAAPAX@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@AEAHAEAPEAX@Z */
6657 #if _MSVCP_VER <= 100
6658 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
6659 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6660 (this, ret, first, last, base, state, pval))
6661 #else
6662 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6663 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6664 (this, ret, first, last, base, state, pval))
6665 #endif
6666 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
6667 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
6668 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6670 unsigned __int64 v;
6671 char tmp[25], *end;
6672 int err;
6674 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6676 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6677 &first, &last, FMTFLAG_hex, IOS_LOCALE(base)), &err);
6678 if(v!=(unsigned __int64)((INT_PTR)v))
6679 *state |= IOSTATE_failbit;
6680 else if(end!=tmp && !err)
6681 *pval = (void*)((INT_PTR)v);
6682 else
6683 *state |= IOSTATE_failbit;
6685 if(!first.strbuf)
6686 *state |= IOSTATE_eofbit;
6688 *ret = first;
6689 return ret;
6692 /* ?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 */
6693 /* ?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 */
6694 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
6695 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
6696 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6698 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6699 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
6702 /* ?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 */
6703 /* ?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 */
6704 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
6705 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
6706 #if _MSVCP_VER <= 100
6707 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
6708 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6709 (this, ret, first, last, base, state, pval))
6710 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6711 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6712 (this, ret, first, last, base, state, pval))
6713 #else
6714 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6715 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6716 (this, ret, first, last, base, state, pval))
6717 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6718 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6719 (this, ret, first, last, base, state, pval))
6720 #endif
6721 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
6722 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
6723 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6725 double v;
6726 char tmp[32], *end;
6727 int err;
6729 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6731 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6732 if(end!=tmp && !err)
6733 *pval = v;
6734 else
6735 *state |= IOSTATE_failbit;
6737 if(!first.strbuf)
6738 *state |= IOSTATE_eofbit;
6740 *ret = first;
6741 return ret;
6744 /* ?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 */
6745 /* ?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 */
6746 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
6747 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
6748 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6750 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6751 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
6754 /* ?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 */
6755 /* ?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 */
6756 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
6757 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
6758 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6760 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6761 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
6764 /* ?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 */
6765 /* ?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 */
6766 #if _MSVCP_VER <= 100
6767 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6768 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6769 (this, ret, first, last, base, state, pval))
6770 #else
6771 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6772 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6773 (this, ret, first, last, base, state, pval))
6774 #endif
6775 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
6776 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
6777 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6779 float v;
6780 char tmp[32], *end;
6781 int err;
6783 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6785 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6786 if(end!=tmp && !err)
6787 *pval = v;
6788 else
6789 *state |= IOSTATE_failbit;
6791 if(!first.strbuf)
6792 *state |= IOSTATE_eofbit;
6794 *ret = first;
6795 return ret;
6798 /* ?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 */
6799 /* ?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 */
6800 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
6801 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
6802 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6804 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6805 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
6808 /* ?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 */
6809 /* ?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 */
6810 #if _MSVCP_VER <= 100
6811 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6812 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6813 (this, ret, first, last, base, state, pval))
6814 #else
6815 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6816 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6817 (this, ret, first, last, base, state, pval))
6818 #endif
6819 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
6820 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6821 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6823 unsigned __int64 v;
6824 char tmp[25], *end;
6825 int err;
6827 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6829 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6830 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6831 if(end!=tmp && !err)
6832 *pval = v;
6833 else
6834 *state |= IOSTATE_failbit;
6836 if(!first.strbuf)
6837 *state |= IOSTATE_eofbit;
6839 *ret = first;
6840 return ret;
6843 /* ?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 */
6844 /* ?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 */
6845 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
6846 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6847 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6849 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6850 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
6853 /* ?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 */
6854 /* ?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 */
6855 #if _MSVCP_VER <= 100
6856 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6857 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6858 (this, ret, first, last, base, state, pval))
6859 #else
6860 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6861 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6862 (this, ret, first, last, base, state, pval))
6863 #endif
6864 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6865 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6866 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6868 __int64 v;
6869 char tmp[25], *end;
6870 int err;
6872 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6874 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6875 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6876 if(end!=tmp && !err)
6877 *pval = v;
6878 else
6879 *state |= IOSTATE_failbit;
6881 if(!first.strbuf)
6882 *state |= IOSTATE_eofbit;
6884 *ret = first;
6885 return ret;
6888 /* ?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 */
6889 /* ?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 */
6890 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6891 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6892 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6894 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6895 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6898 /* ?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 */
6899 /* ?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 */
6900 #if _MSVCP_VER <= 100
6901 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6902 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6903 (this, ret, first, last, base, state, pval))
6904 #else
6905 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6906 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6907 (this, ret, first, last, base, state, pval))
6908 #endif
6909 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6910 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6911 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6913 ULONG v;
6914 char tmp[25], *end;
6915 int err;
6917 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6919 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6920 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6921 if(end!=tmp && !err)
6922 *pval = v;
6923 else
6924 *state |= IOSTATE_failbit;
6926 if(!first.strbuf)
6927 *state |= IOSTATE_eofbit;
6929 *ret = first;
6930 return ret;
6933 /* ?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 */
6934 /* ?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 */
6935 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6936 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6937 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6939 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6940 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6943 /* ?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 */
6944 /* ?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 */
6945 #if _MSVCP_VER <= 100
6946 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6947 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6948 (this, ret, first, last, base, state, pval))
6949 #else
6950 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6951 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6952 (this, ret, first, last, base, state, pval))
6953 #endif
6954 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6955 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6956 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6958 LONG v;
6959 char tmp[25], *end;
6960 int err;
6962 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6964 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6965 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6966 if(end!=tmp && !err)
6967 *pval = v;
6968 else
6969 *state |= IOSTATE_failbit;
6971 if(!first.strbuf)
6972 *state |= IOSTATE_eofbit;
6974 *ret = first;
6975 return ret;
6978 /* ?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 */
6979 /* ?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 */
6980 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6981 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6982 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6984 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6985 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6988 /* ?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 */
6989 /* ?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 */
6990 #if _MSVCP_VER <= 100
6991 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6992 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6993 (this, ret, first, last, base, state, pval))
6994 #else
6995 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6996 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6997 (this, ret, first, last, base, state, pval))
6998 #endif
6999 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
7000 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
7001 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
7003 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7004 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
7007 /* ?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 */
7008 /* ?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 */
7009 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
7010 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
7011 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
7013 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7014 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
7017 /* ?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 */
7018 /* ?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 */
7019 #if _MSVCP_VER <= 100
7020 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
7021 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
7022 (this, ret, first, last, base, state, pval))
7023 #else
7024 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_char*, \
7025 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
7026 (this, ret, first, last, base, state, pval))
7027 #endif
7028 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
7029 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
7030 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
7032 ULONG v;
7033 char tmp[25], *beg, *end;
7034 int err, b;
7036 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7038 b = num_get_char__Getifld(this, tmp,
7039 &first, &last, base->fmtfl, IOS_LOCALE(base));
7040 beg = tmp + (tmp[0]=='-' ? 1 : 0);
7041 v = _Stoulx(beg, &end, b, &err);
7043 if(v != (ULONG)((unsigned short)v))
7044 *state |= IOSTATE_failbit;
7045 else if(end!=beg && !err)
7046 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
7047 else
7048 *state |= IOSTATE_failbit;
7050 if(!first.strbuf)
7051 *state |= IOSTATE_eofbit;
7053 *ret = first;
7054 return ret;
7057 /* ?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 */
7058 /* ?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 */
7059 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
7060 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
7061 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
7063 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7064 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
7067 /* ?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 */
7068 /* ?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 */
7069 #if _MSVCP_VER <= 100
7070 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
7071 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, bool*), \
7072 (this, ret, first, last, base, state, pval))
7073 #else
7074 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_char*, \
7075 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, bool*), \
7076 (this, ret, first, last, base, state, pval))
7077 #endif
7078 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
7079 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
7080 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, bool *pval)
7082 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7084 if(base->fmtfl & FMTFLAG_boolalpha) {
7085 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7086 basic_string_char false_bstr, true_bstr;
7087 const char *pfalse, *ptrue;
7089 numpunct_char_falsename(numpunct, &false_bstr);
7090 numpunct_char_truename(numpunct, &true_bstr);
7091 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
7092 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
7094 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
7095 if(pfalse && *pfalse && first.val!=*pfalse)
7096 pfalse = NULL;
7097 if(ptrue && *ptrue && first.val!=*ptrue)
7098 ptrue = NULL;
7100 if(pfalse && *pfalse && ptrue && !*ptrue)
7101 ptrue = NULL;
7102 if(ptrue && *ptrue && pfalse && !*pfalse)
7103 pfalse = NULL;
7105 if(pfalse)
7106 pfalse++;
7107 if(ptrue)
7108 ptrue++;
7110 if(pfalse || ptrue)
7111 istreambuf_iterator_char_inc(&first);
7113 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
7114 break;
7117 if(ptrue)
7118 *pval = TRUE;
7119 else if(pfalse)
7120 *pval = FALSE;
7121 else
7122 *state |= IOSTATE_failbit;
7124 MSVCP_basic_string_char_dtor(&false_bstr);
7125 MSVCP_basic_string_char_dtor(&true_bstr);
7126 }else {
7127 char tmp[25], *end;
7128 int err;
7129 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
7130 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
7132 if(end!=tmp && err==0 && (v==0 || v==1))
7133 *pval = v;
7134 else
7135 *state |= IOSTATE_failbit;
7138 if(!first.strbuf)
7139 *state |= IOSTATE_eofbit;
7140 memcpy(ret, &first, sizeof(first));
7141 return ret;
7144 /* ?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 */
7145 /* ?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 */
7146 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
7147 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
7148 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, bool *pval)
7150 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7151 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
7154 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7155 locale_id num_put_char_id = {0};
7157 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7158 extern const vtable_ptr MSVCP_num_put_char_vtable;
7160 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7161 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7162 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
7163 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
7165 TRACE("(%p %p)\n", this, locinfo);
7166 #if _MSVCP_VER < 110
7167 _Locinfo__Getcvt(locinfo, &this->cvt);
7168 #endif
7171 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7172 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7173 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
7174 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, size_t refs)
7176 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
7178 locale_facet_ctor_refs(&this->facet, refs);
7179 this->facet.vtable = &MSVCP_num_put_char_vtable;
7181 num_put_char__Init(this, locinfo);
7182 return this;
7185 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7186 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7187 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
7188 num_put* __thiscall num_put_char_ctor_refs(num_put *this, size_t refs)
7190 _Locinfo locinfo;
7192 TRACE("(%p %Iu)\n", this, refs);
7194 _Locinfo_ctor(&locinfo);
7195 num_put_char_ctor_locinfo(this, &locinfo, refs);
7196 _Locinfo_dtor(&locinfo);
7197 return this;
7200 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7201 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7202 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
7203 num_put* __thiscall num_put_char_ctor(num_put *this)
7205 return num_put_char_ctor_refs(this, 0);
7208 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
7209 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
7210 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7211 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7212 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
7213 void __thiscall num_put_char_dtor(num_put *this)
7215 TRACE("(%p)\n", this);
7216 locale_facet_dtor(&this->facet);
7219 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
7220 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
7222 TRACE("(%p %x)\n", this, flags);
7223 if(flags & 2) {
7224 /* we have an array, with the number of elements stored before the first object */
7225 INT_PTR i, *ptr = (INT_PTR *)this-1;
7227 for(i=*ptr-1; i>=0; i--)
7228 num_put_char_dtor(this+i);
7229 MSVCRT_operator_delete(ptr);
7230 } else {
7231 num_put_char_dtor(this);
7232 if(flags & 1)
7233 MSVCRT_operator_delete(this);
7236 return this;
7239 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7240 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7241 size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
7243 TRACE("(%p %p)\n", facet, loc);
7245 if(facet && !*facet) {
7246 _Locinfo locinfo;
7248 *facet = MSVCRT_operator_new(sizeof(num_put));
7249 if(!*facet) {
7250 ERR("Out of memory\n");
7251 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7252 return 0;
7255 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7256 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7257 _Locinfo_dtor(&locinfo);
7260 return LC_NUMERIC;
7263 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7264 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7265 size_t __cdecl num_put_char__Getcat_old(const locale_facet **facet)
7267 return num_put_char__Getcat(facet, locale_classic());
7270 num_put* num_put_char_use_facet(const locale *loc)
7272 static num_put *obj = NULL;
7274 _Lockit lock;
7275 const locale_facet *fac;
7277 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7278 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
7279 if(fac) {
7280 _Lockit_dtor(&lock);
7281 return (num_put*)fac;
7284 if(obj) {
7285 _Lockit_dtor(&lock);
7286 return obj;
7289 num_put_char__Getcat(&fac, loc);
7290 obj = (num_put*)fac;
7291 call_locale_facet__Incref(&obj->facet);
7292 locale_facet_register(&obj->facet);
7293 _Lockit_dtor(&lock);
7295 return obj;
7298 /* ?_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 */
7299 /* ?_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 */
7300 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
7301 ostreambuf_iterator_char dest, const char *ptr, size_t count)
7303 TRACE("(%p %p %p %Iu)\n", this, ret, ptr, count);
7305 for(; count>0; count--)
7306 ostreambuf_iterator_char_put(&dest, *ptr++);
7308 *ret = dest;
7309 return ret;
7312 /* ?_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 */
7313 /* ?_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 */
7314 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
7315 ostreambuf_iterator_char dest, const char *ptr, size_t count)
7317 TRACE("(%p %p %p %Iu)\n", this, ret, ptr, count);
7319 for(; count>0; count--)
7320 ostreambuf_iterator_char_put(&dest, *ptr++);
7322 *ret = dest;
7323 return ret;
7326 /* ?_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 */
7327 /* ?_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 */
7328 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
7329 ostreambuf_iterator_char dest, const char *ptr, size_t count, char delim)
7331 FIXME("(%p %p %p %Iu %d) stub\n", this, ret, ptr, count, delim);
7332 return NULL;
7335 /* ?_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 */
7336 /* ?_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 */
7337 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
7338 ostreambuf_iterator_char dest, char c, size_t count)
7340 TRACE("(%p %p %d %Iu)\n", this, ret, c, count);
7342 for(; count>0; count--)
7343 ostreambuf_iterator_char_put(&dest, c);
7345 *ret = dest;
7346 return ret;
7349 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
7350 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7351 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7353 int type = fmtfl & FMTFLAG_floatfield;
7354 char *p = fmt;
7356 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7358 *p++ = '%';
7359 if(fmtfl & FMTFLAG_showpos)
7360 *p++ = '+';
7361 if(fmtfl & FMTFLAG_showpoint)
7362 *p++ = '#';
7363 *p++ = '.';
7364 *p++ = '*';
7365 if(spec)
7366 *p++ = spec;
7368 if(type == FMTFLAG_fixed)
7369 *p++ = 'f';
7370 else if(type == FMTFLAG_scientific)
7371 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7372 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7373 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7374 else
7375 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7377 *p++ = '\0';
7378 return fmt;
7381 /* ?_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 */
7382 /* ?_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 */
7383 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
7384 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, size_t bef_point,
7385 size_t aft_point, size_t trailing, size_t count)
7387 FIXME("(%p %p %p %d %p %Iu %Iu %Iu %Iu) stub\n", this, ret, base,
7388 fill, buf, bef_point, aft_point, trailing, count);
7389 return NULL;
7392 /* TODO: This function should be removed when num_put_char__Fput is implemented */
7393 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
7394 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, size_t count)
7396 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7397 basic_string_char grouping_bstr;
7398 const char *grouping;
7399 char *p, sep = 0, dec_point = *localeconv()->decimal_point;
7400 int cur_group = 0, group_size = 0;
7401 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7402 size_t pad;
7404 TRACE("(%p %p %p %d %s %Iu)\n", this, ret, base, fill, buf, count);
7406 /* Change decimal point */
7407 for(p=buf; p<buf+count; p++) {
7408 if(*p == dec_point) {
7409 *p = numpunct_char_decimal_point(numpunct);
7410 break;
7413 p--;
7415 /* Add separators to number */
7416 numpunct_char_grouping(numpunct, &grouping_bstr);
7417 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7418 #if _MSVCP_VER >= 70
7419 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7420 #endif
7422 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7423 group_size++;
7424 if(group_size == grouping[cur_group]) {
7425 group_size = 0;
7426 if(grouping[cur_group+1])
7427 cur_group++;
7429 memmove(p+1, p, buf+count-p);
7430 *p = sep;
7431 count++;
7434 MSVCP_basic_string_char_dtor(&grouping_bstr);
7436 /* Display number with padding */
7437 if(count >= base->wide)
7438 pad = 0;
7439 else
7440 pad = base->wide-count;
7441 base->wide = 0;
7443 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7444 num_put_char__Putc(this, &dest, dest, buf, 1);
7445 buf++;
7447 if(adjustfield != FMTFLAG_left) {
7448 num_put_char__Rep(this, ret, dest, fill, pad);
7449 pad = 0;
7451 num_put_char__Putc(this, &dest, dest, buf, count);
7452 return num_put_char__Rep(this, ret, dest, fill, pad);
7455 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
7456 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7457 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7459 int base = fmtfl & FMTFLAG_basefield;
7460 char *p = fmt;
7462 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7464 *p++ = '%';
7465 if(fmtfl & FMTFLAG_showpos)
7466 *p++ = '+';
7467 if(fmtfl & FMTFLAG_showbase)
7468 *p++ = '#';
7470 *p++ = *spec++;
7471 if(*spec == 'l')
7472 *p++ = *spec++;
7474 if(base == FMTFLAG_oct)
7475 *p++ = 'o';
7476 else if(base == FMTFLAG_hex)
7477 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7478 else
7479 *p++ = *spec;
7481 *p++ = '\0';
7482 return fmt;
7485 /* ?_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 */
7486 /* ?_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 */
7487 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
7488 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, size_t count)
7490 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7491 basic_string_char grouping_bstr;
7492 const char *grouping;
7493 char *p, sep = 0;
7494 int cur_group = 0, group_size = 0;
7495 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7496 size_t pad;
7498 TRACE("(%p %p %p %d %s %Iu)\n", this, ret, base, fill, buf, count);
7500 /* Add separators to number */
7501 numpunct_char_grouping(numpunct, &grouping_bstr);
7502 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7503 #if _MSVCP_VER >= 70
7504 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7505 #endif
7507 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7508 group_size++;
7509 if(group_size == grouping[cur_group]) {
7510 group_size = 0;
7511 if(grouping[cur_group+1])
7512 cur_group++;
7514 memmove(p+1, p, buf+count-p);
7515 *p = sep;
7516 count++;
7519 MSVCP_basic_string_char_dtor(&grouping_bstr);
7521 /* Display number with padding */
7522 if(count >= base->wide)
7523 pad = 0;
7524 else
7525 pad = base->wide-count;
7526 base->wide = 0;
7528 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7529 num_put_char__Putc(this, &dest, dest, buf, 1);
7530 buf++;
7531 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7532 num_put_char__Putc(this, &dest, dest, buf, 2);
7533 buf += 2;
7535 if(adjustfield != FMTFLAG_left) {
7536 num_put_char__Rep(this, ret, dest, fill, pad);
7537 pad = 0;
7539 num_put_char__Putc(this, &dest, dest, buf, count);
7540 return num_put_char__Rep(this, ret, dest, fill, pad);
7543 /* ?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 */
7544 /* ?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 */
7545 #if _MSVCP_VER <= 100
7546 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7547 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7548 (this, ret, dest, base, fill, v))
7549 #else
7550 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_char*, \
7551 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7552 (this, ret, dest, base, fill, v))
7553 #endif
7554 #if _MSVCP_VER != 80
7555 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
7556 #else
7557 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 32)
7558 #endif
7559 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7560 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7562 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7563 char fmt[7]; /* strlen("%+#lld")+1 */
7565 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7567 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7568 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
7571 /* ?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 */
7572 /* ?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 */
7573 #if _MSVCP_VER != 80
7574 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
7575 #else
7576 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 32)
7577 #endif
7578 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7579 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7581 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7582 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
7585 /* ?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 */
7586 /* ?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 */
7587 #if _MSVCP_VER <= 100
7588 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7589 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7590 (this, ret, dest, base, fill, v))
7591 #else
7592 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7593 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7594 (this, ret, dest, base, fill, v))
7595 #endif
7596 #if _MSVCP_VER != 80
7597 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
7598 #else
7599 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 32)
7600 #endif
7601 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7602 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7604 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7605 char fmt[7]; /* strlen("%+#lld")+1 */
7607 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7609 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7610 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
7613 /* ?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 */
7614 /* ?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 */
7615 #if _MSVCP_VER != 80
7616 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
7617 #else
7618 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 32)
7619 #endif
7620 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7621 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7623 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7624 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
7627 static inline unsigned get_precision(const ios_base *base)
7629 streamsize ret = base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
7630 if(ret > UINT_MAX)
7631 ret = UINT_MAX;
7632 return ret;
7635 /* ?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 */
7636 /* ?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 */
7637 /* ?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 */
7638 /* ?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 */
7639 #if _MSVCP_VER <= 100
7640 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7641 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7642 (this, ret, dest, base, fill, v))
7643 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
7644 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7645 (this, ret, dest, base, fill, v))
7646 #else
7647 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7648 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7649 (this, ret, dest, base, fill, v))
7650 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7651 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7652 (this, ret, dest, base, fill, v))
7653 #endif
7654 #if _MSVCP_VER != 80
7655 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
7656 #else
7657 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 36)
7658 #endif
7659 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7660 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7662 char *tmp;
7663 char fmt[8]; /* strlen("%+#.*lg")+1 */
7664 int size;
7665 unsigned prec;
7667 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7669 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
7670 prec = get_precision(base);
7671 size = _scprintf(fmt, prec, v);
7673 /* TODO: don't use dynamic allocation */
7674 tmp = MSVCRT_operator_new(size*2);
7675 if(!tmp) {
7676 ERR("Out of memory\n");
7677 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7679 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
7680 MSVCRT_operator_delete(tmp);
7681 return ret;
7684 /* ?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 */
7685 /* ?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 */
7686 #if _MSVCP_VER != 80
7687 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
7688 #else
7689 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 36)
7690 #endif
7691 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7692 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7694 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7695 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
7698 /* ?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 */
7699 /* ?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 */
7700 #if _MSVCP_VER != 80
7701 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
7702 #else
7703 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 36)
7704 #endif
7705 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
7706 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7708 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7709 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
7712 /* ?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 */
7713 /* ?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 */
7714 #if _MSVCP_VER <= 100
7715 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7716 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7717 (this, ret, dest, base, fill, v))
7718 #else
7719 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7720 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7721 (this, ret, dest, base, fill, v))
7722 #endif
7723 #if _MSVCP_VER != 80
7724 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
7725 #else
7726 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 32)
7727 #endif
7728 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7729 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7731 char tmp[17]; /* 8(16^8==2^64)*2(separators between every digit) + 1 */
7733 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7735 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7738 /* ?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 */
7739 /* ?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 */
7740 #if _MSVCP_VER != 80
7741 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
7742 #else
7743 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 32)
7744 #endif
7745 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7746 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7748 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7749 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
7752 /* ?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 */
7753 /* ?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 */
7754 #if _MSVCP_VER <= 100
7755 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7756 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7757 (this, ret, dest, base, fill, v))
7758 #else
7759 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7760 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7761 (this, ret, dest, base, fill, v))
7762 #endif
7763 #if _MSVCP_VER != 80
7764 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
7765 #else
7766 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 36)
7767 #endif
7768 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7769 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7771 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7772 char fmt[7]; /* strlen("%+#lld")+1 */
7774 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7776 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7777 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
7780 /* ?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 */
7781 /* ?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 */
7782 #if _MSVCP_VER != 80
7783 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
7784 #else
7785 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 36)
7786 #endif
7787 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7788 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7790 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7791 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
7794 /* ?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 */
7795 /* ?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 */
7796 #if _MSVCP_VER <= 100
7797 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7798 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7799 (this, ret, dest, base, fill, v))
7800 #else
7801 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7802 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7803 (this, ret, dest, base, fill, v))
7804 #endif
7805 #if _MSVCP_VER != 80
7806 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
7807 #else
7808 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 36)
7809 #endif
7810 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7811 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7813 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7814 char fmt[7]; /* strlen("%+#lld")+1 */
7816 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7818 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7819 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
7822 /* ?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 */
7823 /* ?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 */
7824 #if _MSVCP_VER != 80
7825 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
7826 #else
7827 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 36)
7828 #endif
7829 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7830 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7832 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7833 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
7836 /* ?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 */
7837 /* ?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 */
7838 #if _MSVCP_VER <= 100
7839 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7840 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, bool), \
7841 (this, ret, dest, base, fill, v))
7842 #else
7843 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_char*, \
7844 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, bool), \
7845 (this, ret, dest, base, fill, v))
7846 #endif
7847 #if _MSVCP_VER != 80
7848 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
7849 #else
7850 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 32)
7851 #endif
7852 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7853 ostreambuf_iterator_char dest, ios_base *base, char fill, bool v)
7855 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7857 if(base->fmtfl & FMTFLAG_boolalpha) {
7858 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7859 basic_string_char str;
7860 size_t pad, len;
7862 if(v)
7863 numpunct_char_truename(numpunct, &str);
7864 else
7865 numpunct_char_falsename(numpunct, &str);
7867 len = MSVCP_basic_string_char_length(&str);
7868 pad = (len>base->wide ? 0 : base->wide-len);
7869 base->wide = 0;
7871 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7872 num_put_char__Rep(this, &dest, dest, fill, pad);
7873 pad = 0;
7875 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
7876 MSVCP_basic_string_char_dtor(&str);
7877 return num_put_char__Rep(this, ret, dest, fill, pad);
7880 return num_put_char_put_long(this, ret, dest, base, fill, v);
7883 /* ?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 */
7884 /* ?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 */
7885 #if _MSVCP_VER != 80
7886 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
7887 #else
7888 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 32)
7889 #endif
7890 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7891 ostreambuf_iterator_char dest, ios_base *base, char fill, bool v)
7893 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7894 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
7897 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7898 locale_id num_put_wchar_id = {0};
7899 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7900 locale_id num_put_short_id = {0};
7902 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7903 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
7904 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7905 extern const vtable_ptr MSVCP_num_put_short_vtable;
7907 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7908 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7909 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
7910 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
7912 TRACE("(%p %p)\n", this, locinfo);
7913 #if _MSVCP_VER < 110
7914 _Locinfo__Getcvt(locinfo, &this->cvt);
7915 #endif
7918 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7919 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7920 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
7921 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, size_t refs)
7923 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
7925 locale_facet_ctor_refs(&this->facet, refs);
7926 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
7928 num_put_wchar__Init(this, locinfo);
7929 return this;
7932 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7933 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7934 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
7935 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, size_t refs)
7937 num_put_wchar_ctor_locinfo(this, locinfo, refs);
7938 this->facet.vtable = &MSVCP_num_put_short_vtable;
7939 return this;
7942 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7943 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7944 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
7945 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, size_t refs)
7947 _Locinfo locinfo;
7949 TRACE("(%p %Iu)\n", this, refs);
7951 _Locinfo_ctor(&locinfo);
7952 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
7953 _Locinfo_dtor(&locinfo);
7954 return this;
7957 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7958 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7959 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
7960 num_put* __thiscall num_put_short_ctor_refs(num_put *this, size_t refs)
7962 num_put_wchar_ctor_refs(this, refs);
7963 this->facet.vtable = &MSVCP_num_put_short_vtable;
7964 return this;
7967 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7968 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7969 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
7970 num_put* __thiscall num_put_wchar_ctor(num_put *this)
7972 return num_put_wchar_ctor_refs(this, 0);
7975 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7976 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7977 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
7978 num_put* __thiscall num_put_short_ctor(num_put *this)
7980 return num_put_short_ctor_refs(this, 0);
7983 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
7984 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
7985 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7986 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7987 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7988 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7989 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
7990 void __thiscall num_put_wchar_dtor(num_put *this)
7992 TRACE("(%p)\n", this);
7993 locale_facet_dtor(&this->facet);
7996 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
7997 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
7999 TRACE("(%p %x)\n", this, flags);
8000 if(flags & 2) {
8001 /* we have an array, with the number of elements stored before the first object */
8002 INT_PTR i, *ptr = (INT_PTR *)this-1;
8004 for(i=*ptr-1; i>=0; i--)
8005 num_put_wchar_dtor(this+i);
8006 MSVCRT_operator_delete(ptr);
8007 } else {
8008 num_put_wchar_dtor(this);
8009 if(flags & 1)
8010 MSVCRT_operator_delete(this);
8013 return this;
8016 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8017 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8018 size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
8020 TRACE("(%p %p)\n", facet, loc);
8022 if(facet && !*facet) {
8023 _Locinfo locinfo;
8025 *facet = MSVCRT_operator_new(sizeof(num_put));
8026 if(!*facet) {
8027 ERR("Out of memory\n");
8028 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8029 return 0;
8032 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8033 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
8034 _Locinfo_dtor(&locinfo);
8037 return LC_NUMERIC;
8040 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8041 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8042 size_t __cdecl num_put_wchar__Getcat_old(const locale_facet **facet)
8044 return num_put_wchar__Getcat(facet, locale_classic());
8047 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8048 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8049 size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
8051 TRACE("(%p %p)\n", facet, loc);
8053 if(facet && !*facet) {
8054 _Locinfo locinfo;
8056 *facet = MSVCRT_operator_new(sizeof(num_put));
8057 if(!*facet) {
8058 ERR("Out of memory\n");
8059 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8060 return 0;
8063 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8064 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
8065 _Locinfo_dtor(&locinfo);
8068 return LC_NUMERIC;
8071 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8072 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8073 size_t __cdecl num_put_short__Getcat_old(const locale_facet **facet)
8075 return num_put_short__Getcat(facet, locale_classic());
8078 num_put* num_put_wchar_use_facet(const locale *loc)
8080 static num_put *obj = NULL;
8082 _Lockit lock;
8083 const locale_facet *fac;
8085 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8086 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
8087 if(fac) {
8088 _Lockit_dtor(&lock);
8089 return (num_put*)fac;
8092 if(obj) {
8093 _Lockit_dtor(&lock);
8094 return obj;
8097 num_put_wchar__Getcat(&fac, loc);
8098 obj = (num_put*)fac;
8099 call_locale_facet__Incref(&obj->facet);
8100 locale_facet_register(&obj->facet);
8101 _Lockit_dtor(&lock);
8103 return obj;
8106 num_put* num_put_short_use_facet(const locale *loc)
8108 static num_put *obj = NULL;
8110 _Lockit lock;
8111 const locale_facet *fac;
8113 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8114 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
8115 if(fac) {
8116 _Lockit_dtor(&lock);
8117 return (num_put*)fac;
8120 if(obj) {
8121 _Lockit_dtor(&lock);
8122 return obj;
8125 num_put_short__Getcat(&fac, loc);
8126 obj = (num_put*)fac;
8127 call_locale_facet__Incref(&obj->facet);
8128 locale_facet_register(&obj->facet);
8129 _Lockit_dtor(&lock);
8131 return obj;
8134 /* ?_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 */
8135 /* ?_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 */
8136 /* ?_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 */
8137 /* ?_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 */
8138 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
8139 ostreambuf_iterator_wchar dest, const wchar_t *ptr, size_t count)
8141 TRACE("(%p %p %s %Iu)\n", this, ret, debugstr_wn(ptr, count), count);
8143 for(; count>0; count--)
8144 ostreambuf_iterator_wchar_put(&dest, *ptr++);
8146 *ret = dest;
8147 return ret;
8150 #if _MSVCP_VER < 110
8151 /* ?_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 */
8152 /* ?_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 */
8153 /* ?_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 */
8154 /* ?_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 */
8155 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
8156 ostreambuf_iterator_wchar dest, const char *ptr, size_t count)
8158 _Mbstatet state;
8159 wchar_t ch;
8161 TRACE("(%p %p %s %Iu)\n", this, ret, debugstr_an(ptr, count), count);
8163 memset(&state, 0, sizeof(state));
8164 for(; count>0; count--) {
8165 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
8166 ostreambuf_iterator_wchar_put(&dest, ch);
8169 *ret = dest;
8170 return ret;
8172 #endif
8174 /* ?_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 */
8175 /* ?_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 */
8176 /* ?_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 */
8177 /* ?_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 */
8178 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
8179 ostreambuf_iterator_wchar dest, const char *ptr, size_t count, wchar_t delim)
8181 FIXME("(%p %p %p %Iu %d) stub\n", this, ret, ptr, count, delim);
8182 return NULL;
8185 /* ?_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 */
8186 /* ?_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 */
8187 /* ?_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 */
8188 /* ?_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 */
8189 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
8190 ostreambuf_iterator_wchar dest, wchar_t c, size_t count)
8192 TRACE("(%p %p %d %Iu)\n", this, ret, c, count);
8194 for(; count>0; count--)
8195 ostreambuf_iterator_wchar_put(&dest, c);
8197 *ret = dest;
8198 return ret;
8201 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
8202 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8203 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
8204 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8205 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
8207 int type = fmtfl & FMTFLAG_floatfield;
8208 char *p = fmt;
8210 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
8212 *p++ = '%';
8213 if(fmtfl & FMTFLAG_showpos)
8214 *p++ = '+';
8215 if(fmtfl & FMTFLAG_showbase)
8216 *p++ = '#';
8217 *p++ = '.';
8218 *p++ = '*';
8219 if(spec)
8220 *p++ = spec;
8222 if(type == FMTFLAG_fixed)
8223 *p++ = 'f';
8224 else if(type == FMTFLAG_scientific)
8225 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
8226 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
8227 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
8228 else
8229 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
8231 *p++ = '\0';
8232 return fmt;
8235 /* ?_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 */
8236 /* ?_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 */
8237 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8238 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, size_t bef_point,
8239 size_t aft_point, size_t trailing, size_t count)
8241 FIXME("(%p %p %p %d %p %Iu %Iu %Iu %Iu) stub\n", this, ret, base,
8242 fill, buf, bef_point, aft_point, trailing, count);
8243 return NULL;
8246 /* ?_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 */
8247 /* ?_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 */
8248 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8249 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, size_t bef_point,
8250 size_t aft_point, size_t trailing, size_t count)
8252 FIXME("(%p %p %p %d %p %Iu %Iu %Iu %Iu) stub\n", this, ret, base,
8253 fill, buf, bef_point, aft_point, trailing, count);
8254 return NULL;
8257 #if _MSVCP_VER < 110
8258 static void num_put_wchar_wide_put(const num_put *this,
8259 ostreambuf_iterator_wchar *dest, ios_base *base,
8260 const char *buf, size_t count)
8262 num_put_wchar__Putc(this, dest, *dest, buf, count);
8264 #else
8265 static void num_put_wchar_wide_put(const num_put *this,
8266 ostreambuf_iterator_wchar *dest, ios_base *base,
8267 const char *buf, size_t count)
8269 ctype_wchar *ctype;
8270 size_t i;
8272 ctype = ctype_wchar_use_facet(IOS_LOCALE(base));
8273 for(i=0; i<count; i++)
8274 ostreambuf_iterator_wchar_put(dest, ctype_wchar_widen_ch(ctype, buf[i]));
8276 #endif
8278 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
8279 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8280 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8281 size_t count, numpunct_wchar *numpunct)
8283 basic_string_char grouping_bstr;
8284 const char *grouping;
8285 char *p, dec_point = *localeconv()->decimal_point;
8286 wchar_t sep = 0;
8287 int cur_group = 0, group_size = 0;
8288 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8289 size_t i, pad;
8291 TRACE("(%p %p %p %d %s %Iu)\n", this, ret, base, fill, buf, count);
8293 for(p=buf; p<buf+count; p++) {
8294 if(*p == dec_point)
8295 break;
8297 p--;
8299 /* Add separators to number */
8300 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8301 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8302 #if _MSVCP_VER >= 70
8303 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
8304 #endif
8306 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8307 group_size++;
8308 if(group_size == grouping[cur_group]) {
8309 group_size = 0;
8310 if(grouping[cur_group+1])
8311 cur_group++;
8313 memmove(p+1, p, buf+count-p);
8314 *p = '\0'; /* mark thousands separator positions */
8315 count++;
8318 MSVCP_basic_string_char_dtor(&grouping_bstr);
8320 /* Display number with padding */
8321 if(count >= base->wide)
8322 pad = 0;
8323 else
8324 pad = base->wide-count;
8325 base->wide = 0;
8327 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8328 num_put_wchar_wide_put(this, &dest, base, buf, 1);
8329 buf++;
8331 if(adjustfield != FMTFLAG_left) {
8332 num_put_wchar__Rep(this, ret, dest, fill, pad);
8333 pad = 0;
8336 for(i=0; i<count; i++) {
8337 if(buf[i] == dec_point)
8338 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
8339 else if(!buf[i])
8340 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8341 else
8342 num_put_wchar_wide_put(this, &dest, base, buf+i, 1);
8345 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8348 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
8349 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8350 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
8351 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8352 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
8354 int base = fmtfl & FMTFLAG_basefield;
8355 char *p = fmt;
8357 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
8359 *p++ = '%';
8360 if(fmtfl & FMTFLAG_showpos)
8361 *p++ = '+';
8362 if(fmtfl & FMTFLAG_showbase)
8363 *p++ = '#';
8365 *p++ = *spec++;
8366 if(*spec == 'l')
8367 *p++ = *spec++;
8369 if(base == FMTFLAG_oct)
8370 *p++ = 'o';
8371 else if(base == FMTFLAG_hex)
8372 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
8373 else
8374 *p++ = *spec;
8376 *p++ = '\0';
8377 return fmt;
8380 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8381 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8382 size_t count, numpunct_wchar *numpunct)
8384 basic_string_char grouping_bstr;
8385 const char *grouping;
8386 char *p;
8387 wchar_t sep;
8388 int cur_group = 0, group_size = 0;
8389 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8390 size_t i, pad;
8392 TRACE("(%p %p %p %d %s %Iu)\n", this, ret, base, fill, buf, count);
8394 /* Add separators to number */
8395 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8396 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8397 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
8399 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8400 group_size++;
8401 if(group_size == grouping[cur_group]) {
8402 group_size = 0;
8403 if(grouping[cur_group+1])
8404 cur_group++;
8406 memmove(p+1, p, buf+count-p);
8407 *p = '\0'; /* mark thousands separator positions */
8408 count++;
8411 MSVCP_basic_string_char_dtor(&grouping_bstr);
8413 /* Display number with padding */
8414 if(count >= base->wide)
8415 pad = 0;
8416 else
8417 pad = base->wide-count;
8418 base->wide = 0;
8420 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8421 num_put_wchar_wide_put(this, &dest, base, buf, 1);
8422 buf++;
8423 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
8424 num_put_wchar_wide_put(this, &dest, base, buf, 2);
8425 buf += 2;
8427 if(adjustfield != FMTFLAG_left) {
8428 num_put_wchar__Rep(this, ret, dest, fill, pad);
8429 pad = 0;
8432 for(i=0; i<count; i++) {
8433 if(!buf[i])
8434 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8435 else
8436 num_put_wchar_wide_put(this, &dest, base, buf+i, 1);
8439 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8442 /* ?_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 */
8443 /* ?_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 */
8444 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8445 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, size_t count)
8447 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(IOS_LOCALE(base)));
8450 /* ?_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 */
8451 /* ?_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 */
8452 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8453 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, size_t count)
8455 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(IOS_LOCALE(base)));
8458 /* ?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 */
8459 /* ?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 */
8460 #if _MSVCP_VER <= 100
8461 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8462 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8463 (this, ret, dest, base, fill, v))
8464 #else
8465 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_wchar*, \
8466 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8467 (this, ret, dest, base, fill, v))
8468 #endif
8469 #if _MSVCP_VER != 80
8470 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
8471 #else
8472 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 32)
8473 #endif
8474 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8475 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8477 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8478 char fmt[7]; /* strlen("%+#lld")+1 */
8480 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8482 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8483 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8486 /* ?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 */
8487 /* ?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 */
8488 #if _MSVCP_VER != 80
8489 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
8490 #else
8491 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 32)
8492 #endif
8493 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8494 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8496 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8497 char fmt[7]; /* strlen("%+#lld")+1 */
8499 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8501 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8502 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8505 /* ?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 */
8506 /* ?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 */
8507 /* ?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 */
8508 /* ?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 */
8509 #if _MSVCP_VER != 80
8510 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
8511 #else
8512 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 32)
8513 #endif
8514 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8515 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8517 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8518 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
8521 /* ?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 */
8522 /* ?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 */
8523 #if _MSVCP_VER <= 100
8524 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8525 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8526 (this, ret, dest, base, fill, v))
8527 #else
8528 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8529 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8530 (this, ret, dest, base, fill, v))
8531 #endif
8532 #if _MSVCP_VER != 80
8533 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
8534 #else
8535 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 32)
8536 #endif
8537 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8538 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8540 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8541 char fmt[7]; /* strlen("%+#lld")+1 */
8543 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8545 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8546 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8549 /* ?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 */
8550 /* ?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 */
8551 #if _MSVCP_VER != 80
8552 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
8553 #else
8554 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 32)
8555 #endif
8556 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8557 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8559 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8560 char fmt[7]; /* strlen("%+#lld")+1 */
8562 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8564 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8565 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8568 /* ?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 */
8569 /* ?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 */
8570 /* ?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 */
8571 /* ?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 */
8572 #if _MSVCP_VER != 80
8573 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
8574 #else
8575 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 32)
8576 #endif
8577 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8578 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8580 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8581 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
8584 /* ?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 */
8585 /* ?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 */
8586 /* ?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 */
8587 /* ?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 */
8588 #if _MSVCP_VER <= 100
8589 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8590 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8591 (this, ret, dest, base, fill, v))
8592 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
8593 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8594 (this, ret, dest, base, fill, v))
8595 #else
8596 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8597 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8598 (this, ret, dest, base, fill, v))
8599 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8600 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8601 (this, ret, dest, base, fill, v))
8602 #endif
8603 #if _MSVCP_VER != 80
8604 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
8605 #else
8606 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 36)
8607 #endif
8608 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8609 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8611 char *tmp;
8612 char fmt[8]; /* strlen("%+#.*lg")+1 */
8613 int size;
8614 unsigned prec;
8616 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8618 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8619 prec = get_precision(base);
8620 size = _scprintf(fmt, prec, v);
8622 /* TODO: don't use dynamic allocation */
8623 tmp = MSVCRT_operator_new(size*2);
8624 if(!tmp) {
8625 ERR("Out of memory\n");
8626 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8628 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8629 numpunct_wchar_use_facet(IOS_LOCALE(base)));
8630 MSVCRT_operator_delete(tmp);
8631 return ret;
8634 /* ?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 */
8635 /* ?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 */
8636 /* ?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 */
8637 /* ?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 */
8638 #if _MSVCP_VER != 80
8639 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
8640 #else
8641 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 36)
8642 #endif
8643 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8644 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8646 char *tmp;
8647 char fmt[8]; /* strlen("%+#.*lg")+1 */
8648 int size;
8649 unsigned prec;
8651 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8653 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8654 prec = get_precision(base);
8655 size = _scprintf(fmt, prec, v);
8657 /* TODO: don't use dynamic allocation */
8658 tmp = MSVCRT_operator_new(size*2);
8659 if(!tmp) {
8660 ERR("Out of memory\n");
8661 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8663 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8664 numpunct_short_use_facet(IOS_LOCALE(base)));
8665 MSVCRT_operator_delete(tmp);
8666 return ret;
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@_WN@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@_WN@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@GN@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@GN@Z */
8673 #if _MSVCP_VER != 80
8674 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
8675 #else
8676 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 36)
8677 #endif
8678 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8679 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8681 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8682 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
8685 /* ?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 */
8686 /* ?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 */
8687 /* ?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 */
8688 /* ?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 */
8689 #if _MSVCP_VER != 80
8690 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
8691 #else
8692 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 36)
8693 #endif
8694 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
8695 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8697 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8698 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
8701 /* ?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 */
8702 /* ?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 */
8703 #if _MSVCP_VER <= 100
8704 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
8705 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8706 (this, ret, dest, base, fill, v))
8707 #else
8708 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8709 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8710 (this, ret, dest, base, fill, v))
8711 #endif
8712 #if _MSVCP_VER != 80
8713 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
8714 #else
8715 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 32)
8716 #endif
8717 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8718 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8720 char tmp[17]; /* 8(16^8==2^64)*2(separators between every digit) + 1 */
8722 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8724 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8727 /* ?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 */
8728 /* ?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 */
8729 #if _MSVCP_VER != 80
8730 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
8731 #else
8732 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 32)
8733 #endif
8734 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8735 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8737 char tmp[17]; /* 8(16^8==2^64)*2(separators between every digit) + 1 */
8739 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8741 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8744 /* ?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 */
8745 /* ?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 */
8746 /* ?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 */
8747 /* ?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 */
8748 #if _MSVCP_VER != 80
8749 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
8750 #else
8751 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 32)
8752 #endif
8753 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8754 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8756 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8757 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
8760 /* ?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 */
8761 /* ?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 */
8762 #if _MSVCP_VER <= 100
8763 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8764 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8765 (this, ret, dest, base, fill, v))
8766 #else
8767 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8768 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8769 (this, ret, dest, base, fill, v))
8770 #endif
8771 #if _MSVCP_VER != 80
8772 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
8773 #else
8774 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 36)
8775 #endif
8776 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8777 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8779 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8780 char fmt[7]; /* strlen("%+#lld")+1 */
8782 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8784 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8785 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8788 /* ?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 */
8789 /* ?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 */
8790 #if _MSVCP_VER != 80
8791 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
8792 #else
8793 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 36)
8794 #endif
8795 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8796 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8798 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8799 char fmt[7]; /* strlen("%+#lld")+1 */
8801 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8803 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8804 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8807 /* ?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 */
8808 /* ?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 */
8809 /* ?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 */
8810 /* ?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 */
8811 #if _MSVCP_VER != 80
8812 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
8813 #else
8814 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 36)
8815 #endif
8816 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8817 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8819 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8820 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
8823 /* ?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 */
8824 /* ?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 */
8825 #if _MSVCP_VER <= 100
8826 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8827 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8828 (this, ret, dest, base, fill, v))
8829 #else
8830 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8831 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8832 (this, ret, dest, base, fill, v))
8833 #endif
8834 #if _MSVCP_VER != 80
8835 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
8836 #else
8837 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 36)
8838 #endif
8839 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8840 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8842 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8843 char fmt[7]; /* strlen("%+#lld")+1 */
8845 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8847 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8848 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8851 /* ?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 */
8852 /* ?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 */
8853 #if _MSVCP_VER != 80
8854 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
8855 #else
8856 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 36)
8857 #endif
8858 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8859 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8861 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8862 char fmt[7]; /* strlen("%+#lld")+1 */
8864 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8866 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8867 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8870 /* ?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 */
8871 /* ?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 */
8872 /* ?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 */
8873 /* ?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 */
8874 #if _MSVCP_VER != 80
8875 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
8876 #else
8877 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 36)
8878 #endif
8879 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8880 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8882 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8883 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
8886 /* ?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 */
8887 /* ?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 */
8888 #if _MSVCP_VER <= 100
8889 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8890 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, bool), \
8891 (this, ret, dest, base, fill, v))
8892 #else
8893 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_wchar*, \
8894 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, bool), \
8895 (this, ret, dest, base, fill, v))
8896 #endif
8897 #if _MSVCP_VER != 80
8898 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
8899 #else
8900 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 32)
8901 #endif
8902 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8903 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, bool v)
8905 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8907 if(base->fmtfl & FMTFLAG_boolalpha) {
8908 numpunct_wchar *numpunct = numpunct_wchar_use_facet(IOS_LOCALE(base));
8909 basic_string_wchar str;
8910 size_t pad, len;
8912 if(v)
8913 numpunct_wchar_truename(numpunct, &str);
8914 else
8915 numpunct_wchar_falsename(numpunct, &str);
8917 len = MSVCP_basic_string_wchar_length(&str);
8918 pad = (len>base->wide ? 0 : base->wide-len);
8919 base->wide = 0;
8921 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8922 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8923 pad = 0;
8925 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8926 MSVCP_basic_string_wchar_dtor(&str);
8927 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8930 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8933 /* ?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 */
8934 /* ?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 */
8935 #if _MSVCP_VER != 80
8936 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
8937 #else
8938 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 32)
8939 #endif
8940 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8941 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, bool v)
8943 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8945 if(base->fmtfl & FMTFLAG_boolalpha) {
8946 numpunct_wchar *numpunct = numpunct_short_use_facet(IOS_LOCALE(base));
8947 basic_string_wchar str;
8948 size_t pad, len;
8950 if(v)
8951 numpunct_wchar_truename(numpunct, &str);
8952 else
8953 numpunct_wchar_falsename(numpunct, &str);
8955 len = MSVCP_basic_string_wchar_length(&str);
8956 pad = (len>base->wide ? 0 : base->wide-len);
8957 base->wide = 0;
8959 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8960 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8961 pad = 0;
8963 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8964 MSVCP_basic_string_wchar_dtor(&str);
8965 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8968 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8971 /* ?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 */
8972 /* ?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 */
8973 /* ?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 */
8974 /* ?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 */
8975 #if _MSVCP_VER != 80
8976 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
8977 #else
8978 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 32)
8979 #endif
8980 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8981 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, bool v)
8983 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8984 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
8987 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
8988 locale_id time_put_char_id = {0};
8990 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
8991 extern const vtable_ptr MSVCP_time_put_char_vtable;
8993 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8994 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8995 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
8996 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
8998 TRACE("(%p %p)\n", this, locinfo);
8999 _Locinfo__Gettnames(locinfo, &this->time);
9000 #if _MSVCP_VER <= 100
9001 _Locinfo__Getcvt(locinfo, &this->cvt);
9002 #endif
9005 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9006 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9007 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
9008 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, size_t refs)
9010 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
9011 locale_facet_ctor_refs(&this->facet, refs);
9012 this->facet.vtable = &MSVCP_time_put_char_vtable;
9013 time_put_char__Init(this, locinfo);
9014 return this;
9017 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
9018 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
9019 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
9020 time_put* __thiscall time_put_char_ctor_refs(time_put *this, size_t refs)
9022 _Locinfo locinfo;
9024 TRACE("(%p %Iu)\n", this, refs);
9026 _Locinfo_ctor(&locinfo);
9027 time_put_char_ctor_locinfo(this, &locinfo, refs);
9028 _Locinfo_dtor(&locinfo);
9029 return this;
9032 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
9033 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
9034 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
9035 time_put* __thiscall time_put_char_ctor(time_put *this)
9037 return time_put_char_ctor_refs(this, 0);
9040 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
9041 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
9042 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
9043 void __thiscall time_put_char_dtor(time_put *this)
9045 TRACE("(%p)\n", this);
9046 _Timevec_dtor(&this->time);
9049 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
9050 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
9052 TRACE("(%p %x)\n", this, flags);
9053 if(flags & 2) {
9054 /* we have an array, with the number of elements stored before the first object */
9055 INT_PTR i, *ptr = (INT_PTR *)this-1;
9057 for(i=*ptr-1; i>=0; i--)
9058 time_put_char_dtor(this+i);
9059 MSVCRT_operator_delete(ptr);
9060 } else {
9061 time_put_char_dtor(this);
9062 if(flags & 1)
9063 MSVCRT_operator_delete(this);
9066 return this;
9069 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9070 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9071 size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *loc)
9073 TRACE("(%p %p)\n", facet, loc);
9075 if(facet && !*facet) {
9076 _Locinfo locinfo;
9078 *facet = MSVCRT_operator_new(sizeof(time_put));
9079 if(!*facet) {
9080 ERR("Out of memory\n");
9081 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9082 return 0;
9085 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9086 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
9087 _Locinfo_dtor(&locinfo);
9090 return LC_TIME;
9093 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9094 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9095 size_t __cdecl time_put_char__Getcat_old(const locale_facet **facet)
9097 return time_put_char__Getcat(facet, locale_classic());
9100 static time_put* time_put_char_use_facet(const locale *loc)
9102 static time_put *obj = NULL;
9104 _Lockit lock;
9105 const locale_facet *fac;
9107 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9108 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id));
9109 if(fac) {
9110 _Lockit_dtor(&lock);
9111 return (time_put*)fac;
9114 if(obj) {
9115 _Lockit_dtor(&lock);
9116 return obj;
9119 time_put_char__Getcat(&fac, loc);
9120 obj = (time_put*)fac;
9121 call_locale_facet__Incref(&obj->facet);
9122 locale_facet_register(&obj->facet);
9123 _Lockit_dtor(&lock);
9125 return obj;
9128 #if _MSVCP_VER >= 70
9130 /* ?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 */
9131 /* ?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 */
9132 #if _MSVCP_VER != 80
9133 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 36)
9134 #else
9135 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 40)
9136 #endif
9137 #if _MSVCP_VER <= 100
9138 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9139 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
9140 (this, ret, dest, base, fill, t, spec, mod))
9141 #else
9142 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
9143 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
9144 (this, ret, dest, base, fill, t, spec, mod))
9145 #endif
9146 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9147 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
9149 char buf[64], fmt[4], *p = fmt;
9150 size_t i, len;
9152 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9154 *p++ = '%';
9155 if(mod)
9156 *p++ = mod;
9157 *p++ = spec;
9158 *p++ = 0;
9160 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9161 for(i=0; i<len; i++)
9162 ostreambuf_iterator_char_put(&dest, buf[i]);
9164 *ret = dest;
9165 return ret;
9168 /* ?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 */
9169 /* ?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 */
9170 #if _MSVCP_VER != 80
9171 DEFINE_THISCALL_WRAPPER(time_put_char_put, 36)
9172 #else
9173 DEFINE_THISCALL_WRAPPER(time_put_char_put, 40)
9174 #endif
9175 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9176 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
9178 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9179 return call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod);
9182 /* ?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 */
9183 /* ?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 */
9184 #if _MSVCP_VER != 80
9185 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 36)
9186 #else
9187 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 40)
9188 #endif
9189 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9190 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, const char *pat, const char *pat_end)
9192 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_an(pat, pat_end-pat));
9194 while(pat < pat_end) {
9195 if(*pat != '%') {
9196 ostreambuf_iterator_char_put(&dest, *pat++);
9197 }else if(++pat == pat_end) {
9198 ostreambuf_iterator_char_put(&dest, '%');
9199 }else if(*pat=='#' && pat+1==pat_end) {
9200 ostreambuf_iterator_char_put(&dest, '%');
9201 ostreambuf_iterator_char_put(&dest, *pat++);
9202 }else {
9203 char mod;
9205 if(*pat == '#') {
9206 mod = '#';
9207 pat++;
9208 }else {
9209 mod = 0;
9212 time_put_char_put(this, &dest, dest, base, fill, t, *pat++, mod);
9216 *ret = dest;
9217 return ret;
9220 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9222 /* ?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 */
9223 /* ?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 */
9224 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
9225 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9226 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
9227 (this, ret, dest, base, t, spec, mod))
9228 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9229 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9231 char buf[64], fmt[4], *p = fmt;
9232 size_t i, len;
9234 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9236 *p++ = '%';
9237 if(mod)
9238 *p++ = mod;
9239 *p++ = spec;
9240 *p++ = 0;
9242 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9243 for(i=0; i<len; i++)
9244 ostreambuf_iterator_char_put(&dest, buf[i]);
9246 *ret = dest;
9247 return ret;
9250 /* ?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 */
9251 /* ?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 */
9252 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
9253 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9254 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9256 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9257 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
9260 /* ?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 */
9261 /* ?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 */
9262 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
9263 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9264 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
9266 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
9268 while(pat < pat_end) {
9269 if(*pat != '%') {
9270 ostreambuf_iterator_char_put(&dest, *pat++);
9271 }else if(++pat == pat_end) {
9272 ostreambuf_iterator_char_put(&dest, '%');
9273 }else if(*pat=='#' && pat+1==pat_end) {
9274 ostreambuf_iterator_char_put(&dest, '%');
9275 ostreambuf_iterator_char_put(&dest, *pat++);
9276 }else {
9277 char mod;
9279 if(*pat == '#') {
9280 mod = '#';
9281 pat++;
9282 }else {
9283 mod = 0;
9286 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
9290 *ret = dest;
9291 return ret;
9294 #endif /* MSVCP_VER >= 70 */
9296 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
9297 locale_id time_put_wchar_id = {0};
9298 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
9299 locale_id time_put_short_id = {0};
9301 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
9302 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
9303 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
9304 extern const vtable_ptr MSVCP_time_put_short_vtable;
9306 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9307 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9308 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9309 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9310 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
9311 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
9313 TRACE("(%p %p)\n", this, locinfo);
9314 _Locinfo__Gettnames(locinfo, &this->time);
9315 #if _MSVCP_VER <= 100
9316 _Locinfo__Getcvt(locinfo, &this->cvt);
9317 #endif
9320 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9321 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9322 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
9323 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, size_t refs)
9325 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
9326 locale_facet_ctor_refs(&this->facet, refs);
9327 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
9328 time_put_wchar__Init(this, locinfo);
9329 return this;
9332 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9333 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9334 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
9335 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, size_t refs)
9337 time_put_wchar_ctor_locinfo(this, locinfo, refs);
9338 this->facet.vtable = &MSVCP_time_put_short_vtable;
9339 return this;
9342 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
9343 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
9344 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
9345 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, size_t refs)
9347 _Locinfo locinfo;
9349 TRACE("(%p %s %Iu)\n", this, debugstr_a(name), refs);
9351 _Locinfo_ctor_cstr(&locinfo, name);
9352 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9353 _Locinfo_dtor(&locinfo);
9354 return this;
9357 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
9358 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
9359 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
9360 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, size_t refs)
9362 time_put_wchar_ctor_name(this, name, refs);
9363 this->facet.vtable = &MSVCP_time_put_short_vtable;
9364 return this;
9367 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
9368 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
9369 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
9370 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, size_t refs)
9372 _Locinfo locinfo;
9374 TRACE("(%p %Iu)\n", this, refs);
9376 _Locinfo_ctor(&locinfo);
9377 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9378 _Locinfo_dtor(&locinfo);
9379 return this;
9382 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
9383 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
9384 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
9385 time_put* __thiscall time_put_short_ctor_refs(time_put *this, size_t refs)
9387 time_put_wchar_ctor_refs(this, refs);
9388 this->facet.vtable = &MSVCP_time_put_short_vtable;
9389 return this;
9392 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
9393 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
9394 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
9395 time_put* __thiscall time_put_wchar_ctor(time_put *this)
9397 return time_put_wchar_ctor_refs(this, 0);
9400 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
9401 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
9402 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
9403 time_put* __thiscall time_put_short_ctor(time_put *this)
9405 time_put_wchar_ctor(this);
9406 this->facet.vtable = &MSVCP_time_put_short_vtable;
9407 return this;
9410 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
9411 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
9412 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
9413 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
9414 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
9415 void __thiscall time_put_wchar_dtor(time_put *this)
9417 TRACE("(%p)\n", this);
9418 _Timevec_dtor(&this->time);
9421 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
9422 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
9424 TRACE("(%p %x)\n", this, flags);
9425 if(flags & 2) {
9426 /* we have an array, with the number of elements stored before the first object */
9427 INT_PTR i, *ptr = (INT_PTR *)this-1;
9429 for(i=*ptr-1; i>=0; i--)
9430 time_put_wchar_dtor(this+i);
9431 MSVCRT_operator_delete(ptr);
9432 } else {
9433 time_put_wchar_dtor(this);
9434 if(flags & 1)
9435 MSVCRT_operator_delete(this);
9438 return this;
9441 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9442 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9443 size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
9445 TRACE("(%p %p)\n", facet, loc);
9447 if(facet && !*facet) {
9448 *facet = MSVCRT_operator_new(sizeof(time_put));
9449 if(!*facet) {
9450 ERR("Out of memory\n");
9451 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9452 return 0;
9454 time_put_wchar_ctor_name((time_put*)*facet,
9455 locale_string_char_c_str(&loc->ptr->name), 0);
9458 return LC_TIME;
9461 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9462 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9463 size_t __cdecl time_put_wchar__Getcat_old(const locale_facet **facet)
9465 return time_put_wchar__Getcat(facet, locale_classic());
9468 static time_put* time_put_wchar_use_facet(const locale *loc)
9470 static time_put *obj = NULL;
9472 _Lockit lock;
9473 const locale_facet *fac;
9475 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9476 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id));
9477 if(fac) {
9478 _Lockit_dtor(&lock);
9479 return (time_put*)fac;
9482 if(obj) {
9483 _Lockit_dtor(&lock);
9484 return obj;
9487 time_put_wchar__Getcat(&fac, loc);
9488 obj = (time_put*)fac;
9489 call_locale_facet__Incref(&obj->facet);
9490 locale_facet_register(&obj->facet);
9491 _Lockit_dtor(&lock);
9493 return obj;
9496 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9497 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9498 size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale *loc)
9500 TRACE("(%p %p)\n", facet, loc);
9502 if(facet && !*facet) {
9503 *facet = MSVCRT_operator_new(sizeof(time_put));
9504 if(!*facet) {
9505 ERR("Out of memory\n");
9506 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9507 return 0;
9509 time_put_short_ctor_name((time_put*)*facet,
9510 locale_string_char_c_str(&loc->ptr->name), 0);
9513 return LC_TIME;
9516 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9517 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9518 size_t __cdecl time_put_short__Getcat_old(const locale_facet **facet)
9520 return time_put_short__Getcat(facet, locale_classic());
9523 static time_put* time_put_short_use_facet(const locale *loc)
9525 static time_put *obj = NULL;
9527 _Lockit lock;
9528 const locale_facet *fac;
9530 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9531 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id));
9532 if(fac) {
9533 _Lockit_dtor(&lock);
9534 return (time_put*)fac;
9537 if(obj) {
9538 _Lockit_dtor(&lock);
9539 return obj;
9542 time_put_short__Getcat(&fac, loc);
9543 obj = (time_put*)fac;
9544 call_locale_facet__Incref(&obj->facet);
9545 locale_facet_register(&obj->facet);
9546 _Lockit_dtor(&lock);
9548 return obj;
9551 #if _MSVCP_VER >= 70
9553 /* ?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 */
9554 /* ?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 */
9555 /* ?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 */
9556 /* ?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 */
9557 #if _MSVCP_VER != 80
9558 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 36)
9559 #else
9560 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 40)
9561 #endif
9562 #if _MSVCP_VER <= 100
9563 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9564 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9565 (this, ret, dest, base, fill, t, spec, mod))
9566 #else
9567 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
9568 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9569 (this, ret, dest, base, fill, t, spec, mod))
9570 #endif
9571 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9572 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9573 wchar_t fill, const struct tm *t, char spec, char mod)
9575 char buf[64], fmt[4], *p = fmt;
9576 size_t i, len;
9577 const _Cvtvec *cvt;
9578 wchar_t c;
9580 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9582 *p++ = '%';
9583 if(mod)
9584 *p++ = mod;
9585 *p++ = spec;
9586 *p++ = 0;
9588 #if _MSVCP_VER <= 100
9589 cvt = &this->cvt;
9590 #else
9591 cvt = &ctype_wchar_use_facet(base->loc)->cvt;
9592 #endif
9594 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9595 for(i=0; i<len; i++) {
9596 c = mb_to_wc(buf[i], cvt);
9597 ostreambuf_iterator_wchar_put(&dest, c);
9600 *ret = dest;
9601 return ret;
9604 /* ?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 */
9605 /* ?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 */
9606 /* ?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 */
9607 /* ?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 */
9608 #if _MSVCP_VER != 80
9609 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 36)
9610 #else
9611 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 40)
9612 #endif
9613 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9614 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9615 wchar_t fill, const struct tm *t, char spec, char mod)
9617 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9618 return call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod);
9621 /* ?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 */
9622 /* ?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 */
9623 /* ?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 */
9624 /* ?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 */
9625 #if _MSVCP_VER != 80
9626 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 36)
9627 #else
9628 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 40)
9629 #endif
9630 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9631 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9632 wchar_t fill, const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9634 wchar_t percent;
9635 char c[MB_LEN_MAX];
9636 const _Cvtvec *cvt;
9638 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_wn(pat, pat_end-pat));
9640 #if _MSVCP_VER <= 100
9641 cvt = &this->cvt;
9642 #else
9643 cvt = &ctype_wchar_use_facet(base->loc)->cvt;
9644 #endif
9646 percent = mb_to_wc('%', cvt);
9647 while(pat < pat_end) {
9648 if(*pat != percent) {
9649 ostreambuf_iterator_wchar_put(&dest, *pat++);
9650 }else if(++pat == pat_end) {
9651 ostreambuf_iterator_wchar_put(&dest, percent);
9652 }else if(_Wcrtomb(c, *pat, NULL, cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9653 ostreambuf_iterator_wchar_put(&dest, percent);
9654 ostreambuf_iterator_wchar_put(&dest, *pat++);
9655 }else {
9656 pat++;
9657 if(*c == '#') {
9658 if(_Wcrtomb(c, *pat++, NULL, cvt) != 1) {
9659 ostreambuf_iterator_wchar_put(&dest, percent);
9660 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9661 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9662 }else {
9663 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, '#');
9665 }else {
9666 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, 0);
9671 *ret = dest;
9672 return ret;
9675 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9677 /* ?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 */
9678 /* ?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 */
9679 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
9680 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9681 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
9682 (this, ret, dest, base, t, spec, mod))
9683 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9684 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9685 const struct tm *t, char spec, char mod)
9687 char buf[64], fmt[4], *p = fmt;
9688 size_t i, len;
9689 wchar_t c;
9691 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9693 *p++ = '%';
9694 if(mod)
9695 *p++ = mod;
9696 *p++ = spec;
9697 *p++ = 0;
9699 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9700 for(i=0; i<len; i++) {
9701 c = mb_to_wc(buf[i], &this->cvt);
9702 ostreambuf_iterator_wchar_put(&dest, c);
9705 *ret = dest;
9706 return ret;
9709 /* ?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 */
9710 /* ?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 */
9711 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
9712 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9713 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9714 const struct tm *t, char spec, char mod)
9716 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9717 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
9720 /* ?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 */
9721 /* ?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 */
9722 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
9723 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9724 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9725 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9727 wchar_t percent = mb_to_wc('%', &this->cvt);
9728 char c[MB_LEN_MAX];
9730 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
9732 while(pat < pat_end) {
9733 if(*pat != percent) {
9734 ostreambuf_iterator_wchar_put(&dest, *pat++);
9735 }else if(++pat == pat_end) {
9736 ostreambuf_iterator_wchar_put(&dest, percent);
9737 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9738 ostreambuf_iterator_wchar_put(&dest, percent);
9739 ostreambuf_iterator_wchar_put(&dest, *pat++);
9740 }else {
9741 pat++;
9742 if(*c == '#') {
9743 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
9744 ostreambuf_iterator_wchar_put(&dest, percent);
9745 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9746 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9747 }else {
9748 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
9750 }else {
9751 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
9756 *ret = dest;
9757 return ret;
9760 #endif /* _MSVCP_VER >= 70 */
9762 /* ?id@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
9763 locale_id time_get_char_id = {0};
9765 /* ??_7?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
9766 extern const vtable_ptr MSVCP_time_get_char_vtable;
9768 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9769 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9770 DEFINE_THISCALL_WRAPPER(time_get_char__Init, 8)
9771 void __thiscall time_get_char__Init(time_get_char *this, const _Locinfo *locinfo)
9773 const char *months;
9774 const char *days;
9775 int len;
9777 TRACE("(%p %p)\n", this, locinfo);
9779 days = _Locinfo__Getdays(locinfo);
9780 len = strlen(days)+1;
9781 this->days = MSVCRT_operator_new(len);
9782 if(!this->days)
9784 ERR("Out of memory\n");
9785 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9787 memcpy((char*)this->days, days, len);
9789 months = _Locinfo__Getmonths(locinfo);
9790 len = strlen(months)+1;
9791 this->months = MSVCRT_operator_new(len);
9792 if(!this->months)
9794 MSVCRT_operator_delete((char*)this->days);
9796 ERR("Out of memory\n");
9797 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9799 memcpy((char*)this->months, months, len);
9801 this->dateorder = _Locinfo__Getdateorder(locinfo);
9802 _Locinfo__Getcvt(locinfo, &this->cvt);
9805 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9806 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9807 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_locinfo, 12)
9808 time_get_char* __thiscall time_get_char_ctor_locinfo(time_get_char *this,
9809 const _Locinfo *locinfo, size_t refs)
9811 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
9812 locale_facet_ctor_refs(&this->facet, refs);
9813 this->facet.vtable = &MSVCP_time_get_char_vtable;
9814 time_get_char__Init(this, locinfo);
9815 return this;
9818 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAE@PBDI@Z */
9819 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAA@PEBD_K@Z */
9820 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_name, 12)
9821 time_get_char* __thiscall time_get_char_ctor_name(time_get_char *this, const char *name, size_t refs)
9823 _Locinfo locinfo;
9825 TRACE("(%p %s %Iu)\n", this, name, refs);
9827 _Locinfo_ctor_cstr(&locinfo, name);
9828 time_get_char_ctor_locinfo(this, &locinfo, refs);
9829 _Locinfo_dtor(&locinfo);
9830 return this;
9833 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
9834 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
9835 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_refs, 8)
9836 time_get_char* __thiscall time_get_char_ctor_refs(time_get_char *this, size_t refs)
9838 _Locinfo locinfo;
9840 TRACE("(%p %Iu)\n", this, refs);
9842 _Locinfo_ctor(&locinfo);
9843 time_get_char_ctor_locinfo(this, &locinfo, refs);
9844 _Locinfo_dtor(&locinfo);
9845 return this;
9848 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
9849 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
9850 DEFINE_THISCALL_WRAPPER(time_get_char_ctor, 4)
9851 time_get_char* __thiscall time_get_char_ctor(time_get_char *this)
9853 return time_get_char_ctor_refs(this, 0);
9856 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AAEXXZ */
9857 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEAAXXZ */
9858 DEFINE_THISCALL_WRAPPER(time_get_char__Tidy, 4)
9859 void __thiscall time_get_char__Tidy(time_get_char *this)
9861 TRACE("(%p)\n", this);
9863 MSVCRT_operator_delete((char*)this->days);
9864 MSVCRT_operator_delete((char*)this->months);
9867 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
9868 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
9869 DEFINE_THISCALL_WRAPPER(time_get_char_dtor, 4) /* virtual */
9870 void __thiscall time_get_char_dtor(time_get_char *this)
9872 TRACE("(%p)\n", this);
9874 time_get_char__Tidy(this);
9877 DEFINE_THISCALL_WRAPPER(time_get_char_vector_dtor, 8)
9878 time_get_char* __thiscall time_get_char_vector_dtor(time_get_char *this, unsigned int flags)
9880 TRACE("(%p %x)\n", this, flags);
9881 if(flags & 2) {
9882 /* we have an array, with the number of elements stored before the first object */
9883 INT_PTR i, *ptr = (INT_PTR *)this-1;
9885 for(i=*ptr-1; i>=0; i--)
9886 time_get_char_dtor(this+i);
9887 MSVCRT_operator_delete(ptr);
9888 } else {
9889 time_get_char_dtor(this);
9890 if(flags & 1)
9891 MSVCRT_operator_delete(this);
9894 return this;
9897 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9898 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9899 unsigned int __cdecl time_get_char__Getcat(const locale_facet **facet, const locale *loc)
9901 TRACE("(%p %p)\n", facet, loc);
9903 if(facet && !*facet) {
9904 _Locinfo locinfo;
9906 *facet = MSVCRT_operator_new(sizeof(time_get_char));
9907 if(!*facet) {
9908 ERR("Out of memory\n");
9909 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9910 return 0;
9913 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9914 time_get_char_ctor_locinfo((time_get_char*)*facet, &locinfo, 0);
9915 _Locinfo_dtor(&locinfo);
9918 return LC_TIME;
9921 static time_get_char* time_get_char_use_facet(const locale *loc)
9923 static time_get_char *obj = NULL;
9925 _Lockit lock;
9926 const locale_facet *fac;
9928 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9929 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_get_char_id));
9930 if(fac) {
9931 _Lockit_dtor(&lock);
9932 return (time_get_char*)fac;
9935 if(obj) {
9936 _Lockit_dtor(&lock);
9937 return obj;
9940 time_get_char__Getcat(&fac, loc);
9941 obj = (time_get_char*)fac;
9942 call_locale_facet__Incref(&obj->facet);
9943 locale_facet_register(&obj->facet);
9944 _Lockit_dtor(&lock);
9946 return obj;
9949 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAAH@Z */
9950 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAEAH@Z */
9951 int __cdecl time_get_char__Getint(const time_get_char *this,
9952 istreambuf_iterator_char *b, istreambuf_iterator_char *e,
9953 int min_val, int max_val, int *val)
9955 BOOL got_digit = FALSE;
9956 int len = 0, ret = 0;
9957 char buf[16];
9959 TRACE("(%p %p %p %d %d %p)\n", this, b, e, min_val, max_val, val);
9961 istreambuf_iterator_char_val(b);
9962 if(b->strbuf && (b->val == '-' || b->val == '+'))
9964 buf[len++] = b->val;
9965 istreambuf_iterator_char_inc(b);
9968 if (b->strbuf && b->val == '0')
9970 got_digit = TRUE;
9971 buf[len++] = '0';
9972 istreambuf_iterator_char_inc(b);
9974 while (b->strbuf && b->val == '0')
9975 istreambuf_iterator_char_inc(b);
9977 for (; b->strbuf && b->val >= '0' && b->val <= '9';
9978 istreambuf_iterator_char_inc(b))
9980 if(len < ARRAY_SIZE(buf)-1)
9981 buf[len] = b->val;
9982 got_digit = TRUE;
9983 len++;
9986 if (!b->strbuf)
9987 ret |= IOSTATE_eofbit;
9988 if (got_digit && len < ARRAY_SIZE(buf)-1)
9990 int v, err;
9992 buf[len] = 0;
9993 v = _Stolx(buf, NULL, 10, &err);
9994 if(err || v < min_val || v > max_val)
9995 ret |= IOSTATE_failbit;
9996 else
9997 *val = v;
9999 else
10000 ret |= IOSTATE_failbit;
10001 return ret;
10004 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AW4dateorder@time_base@2@XZ */
10005 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AW4dateorder@time_base@2@XZ */
10006 DEFINE_THISCALL_WRAPPER(time_get_char_do_date_order, 4) /* virtual */
10007 #if _MSVCP_VER <= 100
10008 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 4, dateorder, (const time_get_char*), (this))
10009 #else
10010 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 12, dateorder, (const time_get_char*), (this))
10011 #endif
10012 dateorder __thiscall time_get_char_do_date_order(const time_get_char *this)
10014 TRACE("(%p)\n", this);
10015 return this->dateorder;
10018 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ */
10019 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AW4dateorder@time_base@2@XZ */
10020 DEFINE_THISCALL_WRAPPER(time_get_char_date_order, 4)
10021 dateorder __thiscall time_get_char_date_order(const time_get_char *this)
10023 return call_time_get_char_do_date_order(this);
10026 static int find_longest_match_char(istreambuf_iterator_char *iter, const char *str)
10028 int i, len = 0, last_match = -1, match = -1;
10029 const char *p, *end;
10030 char buf[64];
10032 for(istreambuf_iterator_char_val(iter); iter->strbuf && len<ARRAY_SIZE(buf);
10033 istreambuf_iterator_char_inc(iter))
10035 BOOL got_prefix = FALSE;
10037 buf[len++] = iter->val;
10038 last_match = match;
10039 match = -1;
10040 for(p=str+1, i=0; *p; p = (*end ? end+1 : end), i++)
10042 end = strchr(p, ':');
10043 if (!end)
10044 end = p + strlen(p);
10046 if (end-p >= len && !memcmp(p, buf, len))
10048 if (end-p == len)
10049 match = i;
10050 else
10051 got_prefix = TRUE;
10055 if (!got_prefix)
10057 if (match != -1)
10059 istreambuf_iterator_char_inc(iter);
10060 return match;
10062 break;
10065 if (len == ARRAY_SIZE(buf))
10066 FIXME("temporary buffer is too small\n");
10067 if (!iter->strbuf)
10068 return match;
10069 return last_match;
10072 /* ?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 */
10073 /* ?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 */
10074 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_monthname, 36) /* virtual */
10075 #if _MSVCP_VER <= 100
10076 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
10077 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10078 (this, ret, s, e, base, err, t))
10079 #else
10080 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
10081 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10082 (this, ret, s, e, base, err, t))
10083 #endif
10084 istreambuf_iterator_char* __thiscall time_get_char_do_get_monthname(const time_get_char *this,
10085 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10086 ios_base *base, int *err, struct tm *t)
10088 int match;
10090 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
10092 if ((match = find_longest_match_char(&s, this->months)) != -1)
10093 t->tm_mon = match / 2;
10094 else
10095 *err |= IOSTATE_failbit;
10097 *ret = s;
10098 return ret;
10101 /* ?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 */
10102 /* ?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 */
10103 DEFINE_THISCALL_WRAPPER(time_get_char_get_monthname, 36)
10104 istreambuf_iterator_char* __thiscall time_get_char_get_monthname(const time_get_char *this,
10105 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10106 ios_base *base, int *err, struct tm *t)
10108 return call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t);
10111 /* ?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 */
10112 /* ?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 */
10113 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_time, 36) /* virtual */
10114 #if _MSVCP_VER <= 100
10115 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
10116 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10117 (this, ret, s, e, base, err, t))
10118 #else
10119 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
10120 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10121 (this, ret, s, e, base, err, t))
10122 #endif
10123 istreambuf_iterator_char* __thiscall time_get_char_do_get_time(const time_get_char *this,
10124 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10125 ios_base *base, int *err, struct tm *t)
10127 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
10129 *err |= time_get_char__Getint(this, &s, &e, 0, 23, &t->tm_hour);
10130 if (*err || istreambuf_iterator_char_val(&s)!=':')
10131 *err |= IOSTATE_failbit;
10133 if (!*err)
10135 istreambuf_iterator_char_inc(&s);
10136 *err |= time_get_char__Getint(this, &s, &e, 0, 59, &t->tm_min);
10138 if (*err || istreambuf_iterator_char_val(&s)!=':')
10139 *err |= IOSTATE_failbit;
10141 if (!*err)
10143 istreambuf_iterator_char_inc(&s);
10144 *err |= time_get_char__Getint(this, &s, &e, 0, 59, &t->tm_sec);
10147 *ret = s;
10148 return ret;
10151 /* ?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 */
10152 /* ?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 */
10153 DEFINE_THISCALL_WRAPPER(time_get_char_get_time, 36)
10154 istreambuf_iterator_char* __thiscall time_get_char_get_time(const time_get_char *this,
10155 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10156 ios_base *base, int *err, struct tm *t)
10158 return call_time_get_char_do_get_time(this, ret, s, e, base, err, t);
10161 /* ?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 */
10162 /* ?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 */
10163 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_weekday, 36) /* virtual */
10164 #if _MSVCP_VER <= 100
10165 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
10166 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10167 (this, ret, s, e, base, err, t))
10168 #else
10169 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
10170 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10171 (this, ret, s, e, base, err, t))
10172 #endif
10173 istreambuf_iterator_char* __thiscall time_get_char_do_get_weekday(const time_get_char *this,
10174 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10175 ios_base *base, int *err, struct tm *t)
10177 int match;
10179 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
10181 if ((match = find_longest_match_char(&s, this->days)) != -1)
10182 t->tm_wday = match / 2;
10183 else
10184 *err |= IOSTATE_failbit;
10186 *ret = s;
10187 return ret;
10190 /* ?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 */
10191 /* ?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 */
10192 DEFINE_THISCALL_WRAPPER(time_get_char_get_weekday, 36)
10193 istreambuf_iterator_char* __thiscall time_get_char_get_weekday(const time_get_char *this,
10194 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10195 ios_base *base, int *err, struct tm *t)
10197 return call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t);
10200 /* ?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 */
10201 /* ?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 */
10202 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_year, 36) /* virtual */
10203 #if _MSVCP_VER <= 100
10204 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
10205 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10206 (this, ret, s, e, base, err, t))
10207 #else
10208 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
10209 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10210 (this, ret, s, e, base, err, t))
10211 #endif
10212 istreambuf_iterator_char* __thiscall time_get_char_do_get_year(const time_get_char *this,
10213 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10214 ios_base *base, int *err, struct tm *t)
10216 int year;
10218 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
10220 /* The function supports only dates from [1900-2035] range */
10221 *err |= time_get_char__Getint(this, &s, &e, 0, 2035, &year);
10222 if (!(*err & IOSTATE_failbit))
10224 if (year >= 1900)
10225 year -= 1900;
10226 if (year > 135)
10227 *err |= IOSTATE_failbit;
10228 else
10229 t->tm_year = year;
10232 *ret = s;
10233 return ret;
10236 /* ?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 */
10237 /* ?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 */
10238 DEFINE_THISCALL_WRAPPER(time_get_char_get_year, 36)
10239 istreambuf_iterator_char* __thiscall time_get_char_get_year(const time_get_char *this,
10240 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10241 ios_base *base, int *err, struct tm *t)
10243 return call_time_get_char_do_get_year(this, ret, s, e, base, err, t);
10246 static void skip_ws_char(ctype_char *ctype, istreambuf_iterator_char *iter)
10248 istreambuf_iterator_char_val(iter);
10249 while(iter->strbuf && ctype_char_is_ch(ctype, _SPACE, iter->val))
10250 istreambuf_iterator_char_inc(iter);
10253 static void skip_date_delim_char(ctype_char *ctype, istreambuf_iterator_char *iter)
10255 skip_ws_char(ctype, iter);
10256 if(iter->strbuf && (iter->val == '/' || iter->val == ':'))
10257 istreambuf_iterator_char_inc(iter);
10258 skip_ws_char(ctype, iter);
10261 /* ?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 */
10262 /* ?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 */
10263 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_date, 36) /* virtual */
10264 #if _MSVCP_VER <= 100
10265 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
10266 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10267 (this, ret, s, e, base, err, t))
10268 #else
10269 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
10270 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10271 (this, ret, s, e, base, err, t))
10272 #endif
10273 istreambuf_iterator_char* __thiscall time_get_char_do_get_date(const time_get_char *this,
10274 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10275 ios_base *base, int *err, struct tm *t)
10277 ctype_char *ctype;
10278 dateorder order;
10280 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
10282 ctype = ctype_char_use_facet(IOS_LOCALE(base));
10284 order = time_get_char_date_order(this);
10285 if(order == DATEORDER_no_order)
10286 order = DATEORDER_mdy;
10288 switch(order) {
10289 case DATEORDER_dmy:
10290 *err |= time_get_char__Getint(this, &s, &e, 1, 31, &t->tm_mday);
10291 skip_date_delim_char(ctype, &s);
10292 if(!s.strbuf) {
10293 *err |= IOSTATE_failbit;
10294 break;
10296 if(s.strbuf && ctype_char_is_ch(ctype, _DIGIT, s.val)) {
10297 *err |= time_get_char__Getint(this, &s, &e, 1, 12, &t->tm_mon);
10298 t->tm_mon--;
10299 } else {
10300 time_get_char_get_monthname(this, &s, s, e, base, err, t);
10302 skip_date_delim_char(ctype, &s);
10303 if(!s.strbuf) {
10304 *err |= IOSTATE_failbit;
10305 break;
10307 time_get_char_get_year(this, &s, s, e, base, err, t);
10308 break;
10309 case DATEORDER_mdy:
10310 istreambuf_iterator_char_val(&s);
10311 if(s.strbuf && ctype_char_is_ch(ctype, _DIGIT, s.val)) {
10312 *err |= time_get_char__Getint(this, &s, &e, 1, 12, &t->tm_mon);
10313 t->tm_mon--;
10314 } else {
10315 time_get_char_get_monthname(this, &s, s, e, base, err, t);
10317 skip_date_delim_char(ctype, &s);
10318 if(!s.strbuf) {
10319 *err |= IOSTATE_failbit;
10320 break;
10322 *err |= time_get_char__Getint(this, &s, &e, 1, 31, &t->tm_mday);
10323 skip_date_delim_char(ctype, &s);
10324 if(!s.strbuf) {
10325 *err |= IOSTATE_failbit;
10326 break;
10328 time_get_char_get_year(this, &s, s, e, base, err, t);
10329 break;
10330 case DATEORDER_ymd:
10331 time_get_char_get_year(this, &s, s, e, base, err, t);
10332 skip_date_delim_char(ctype, &s);
10333 if(!s.strbuf) {
10334 *err |= IOSTATE_failbit;
10335 break;
10337 if(ctype_char_is_ch(ctype, _DIGIT, s.val)) {
10338 *err |= time_get_char__Getint(this, &s, &e, 1, 12, &t->tm_mon);
10339 t->tm_mon--;
10340 } else {
10341 time_get_char_get_monthname(this, &s, s, e, base, err, t);
10343 skip_date_delim_char(ctype, &s);
10344 if(!s.strbuf) {
10345 *err |= IOSTATE_failbit;
10346 break;
10348 *err |= time_get_char__Getint(this, &s, &e, 1, 31, &t->tm_mday);
10349 break;
10350 case DATEORDER_ydm:
10351 time_get_char_get_year(this, &s, s, e, base, err, t);
10352 skip_date_delim_char(ctype, &s);
10353 if(!s.strbuf) {
10354 *err |= IOSTATE_failbit;
10355 break;
10357 *err |= time_get_char__Getint(this, &s, &e, 1, 31, &t->tm_mday);
10358 skip_date_delim_char(ctype, &s);
10359 if(!s.strbuf) {
10360 *err |= IOSTATE_failbit;
10361 break;
10363 if(ctype_char_is_ch(ctype, _DIGIT, s.val)) {
10364 *err |= time_get_char__Getint(this, &s, &e, 1, 12, &t->tm_mon);
10365 t->tm_mon--;
10366 } else {
10367 time_get_char_get_monthname(this, &s, s, e, base, err, t);
10369 break;
10370 default:
10371 ERR("incorrect order value: %d\n", order);
10372 break;
10375 if(!s.strbuf)
10376 *err |= IOSTATE_eofbit;
10377 *ret = s;
10378 return ret;
10381 /* ?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 */
10382 /* ?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 */
10383 DEFINE_THISCALL_WRAPPER(time_get_char_get_date, 36)
10384 istreambuf_iterator_char* __thiscall time_get_char_get_date(const time_get_char *this,
10385 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10386 ios_base *base, int *err, struct tm *t)
10388 return call_time_get_char_do_get_date(this, ret, s, e, base, err, t);
10391 istreambuf_iterator_char* __thiscall time_get_char_get(const time_get_char*,
10392 istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char,
10393 ios_base*, int*, struct tm*, char, char);
10395 /* ?_Getfmt@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHPAUtm@@PBD@Z */
10396 /* ?_Getfmt@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHPEAUtm@@PEBD@Z */
10397 DEFINE_THISCALL_WRAPPER(time_get_char__Getfmt, 40)
10398 istreambuf_iterator_char* __thiscall time_get_char__Getfmt(const time_get_char *this,
10399 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10400 ios_base *base, int *err, struct tm *t, const char *fmt)
10402 ctype_char *ctype;
10404 TRACE("(%p %p %p %p %p %s)\n", this, ret, base, err, t, fmt);
10406 ctype = ctype_char_use_facet(IOS_LOCALE(base));
10407 istreambuf_iterator_char_val(&s);
10409 while(*fmt) {
10410 if(ctype_char_is_ch(ctype, _SPACE, *fmt)) {
10411 skip_ws_char(ctype, &s);
10412 fmt++;
10413 continue;
10416 if(!s.strbuf) {
10417 *err |= IOSTATE_failbit;
10418 break;
10421 if(*fmt == '%') {
10422 fmt++;
10423 time_get_char_get(this, &s, s, e, base, err, t, *fmt, 0);
10424 } else {
10425 if(s.val != *fmt)
10426 *err |= IOSTATE_failbit;
10427 else
10428 istreambuf_iterator_char_inc(&s);
10431 if(*err & IOSTATE_failbit)
10432 break;
10433 fmt++;
10436 if(!s.strbuf)
10437 *err |= IOSTATE_eofbit;
10438 *ret = s;
10439 return ret;
10442 /* ?do_get@?$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@@DD@Z */
10443 /* ?do_get@?$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@@DD@Z */
10444 DEFINE_THISCALL_WRAPPER(time_get_char_do_get, 44) /* virtual */
10445 #if _MSVCP_VER <= 100
10446 #define call_time_get_char_do_get(this, ret, s, e, base, err, t, fmt, mod) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
10447 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*, char, char), \
10448 (this, ret, s, e, base, err, t, fmt, mod))
10449 #else
10450 #define call_time_get_char_do_get(this, ret, s, e, base, err, t, fmt, mod) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
10451 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*, char, char), \
10452 (this, ret, s, e, base, err, t, fmt, mod))
10453 #endif
10454 istreambuf_iterator_char* __thiscall time_get_char_do_get(const time_get_char *this,
10455 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10456 ios_base *base, int *err, struct tm *t, char fmt, char mod)
10458 ctype_char *ctype;
10460 TRACE("(%p %p %p %p %p %c %c)\n", this, ret, base, err, t, fmt, mod);
10462 ctype = ctype_char_use_facet(IOS_LOCALE(base));
10464 switch(fmt) {
10465 case 'a':
10466 case 'A':
10467 time_get_char_get_weekday(this, &s, s, e, base, err, t);
10468 break;
10469 case 'b':
10470 case 'B':
10471 case 'h':
10472 time_get_char_get_monthname(this, &s, s, e, base, err, t);
10473 break;
10474 case 'c':
10475 time_get_char__Getfmt(this, &s, s, e, base, err, t, "%b %d %H:%M:%S %Y");
10476 break;
10477 case 'C':
10478 *err |= time_get_char__Getint(this, &s, &e, 0, 99, &t->tm_year);
10479 if(!(*err & IOSTATE_failbit))
10480 t->tm_year = t->tm_year * 100 - 1900;
10481 break;
10482 case 'd':
10483 case 'e':
10484 if(fmt == 'e') skip_ws_char(ctype, &s);
10485 *err |= time_get_char__Getint(this, &s, &e, 1, 31, &t->tm_mday);
10486 break;
10487 case 'D':
10488 time_get_char__Getfmt(this, &s, s, e, base, err, t, "%m/%d/%y");
10489 break;
10490 case 'F':
10491 time_get_char__Getfmt(this, &s, s, e, base, err, t, "%Y-%m-%d");
10492 break;
10493 case 'H':
10494 *err |= time_get_char__Getint(this, &s, &e, 0, 23, &t->tm_hour);
10495 break;
10496 case 'I':
10497 *err |= time_get_char__Getint(this, &s, &e, 0, 11, &t->tm_hour);
10498 break;
10499 case 'j':
10500 *err |= time_get_char__Getint(this, &s, &e, 1, 366, &t->tm_yday);
10501 break;
10502 case 'm':
10503 *err |= time_get_char__Getint(this, &s, &e, 1, 12, &t->tm_mon);
10504 if(!(*err & IOSTATE_failbit))
10505 t->tm_mon--;
10506 break;
10507 case 'M':
10508 *err = time_get_char__Getint(this, &s, &e, 0, 59, &t->tm_min);
10509 break;
10510 case 'n':
10511 case 't':
10512 skip_ws_char(ctype, &s);
10513 break;
10514 case 'p': {
10515 BOOL pm = FALSE;
10517 istreambuf_iterator_char_val(&s);
10518 if(s.strbuf && (s.val=='P' || s.val=='p'))
10519 pm = TRUE;
10520 else if (!s.strbuf || (s.val!='A' && s.val!='a')) {
10521 *err |= IOSTATE_failbit;
10522 break;
10524 istreambuf_iterator_char_inc(&s);
10525 if(!s.strbuf || (s.val!='M' && s.val!='m')) {
10526 *err |= IOSTATE_failbit;
10527 break;
10529 istreambuf_iterator_char_inc(&s);
10531 if(pm)
10532 t->tm_hour += 12;
10533 break;
10535 case 'r':
10536 time_get_char__Getfmt(this, &s, s, e, base, err, t, "%I:%M:%S %p");
10537 break;
10538 case 'R':
10539 time_get_char__Getfmt(this, &s, s, e, base, err, t, "%H:%M");
10540 break;
10541 case 'S':
10542 *err |= time_get_char__Getint(this, &s, &e, 0, 59, &t->tm_sec);
10543 break;
10544 case 'T':
10545 case 'X':
10546 time_get_char__Getfmt(this, &s, s, e, base, err, t, "%H:%M:%S");
10547 break;
10548 case 'u':
10549 *err |= time_get_char__Getint(this, &s, &e, 1, 7, &t->tm_wday);
10550 if(!(*err & IOSTATE_failbit) && t->tm_wday==7)
10551 t->tm_wday = 0;
10552 break;
10553 case 'w':
10554 *err |= time_get_char__Getint(this, &s, &e, 0, 6, &t->tm_wday);
10555 break;
10556 case 'x':
10557 time_get_char_get_date(this, &s, s, e, base, err, t);
10558 break;
10559 case 'y':
10560 *err |= time_get_char__Getint(this, &s, &e, 0, 99, &t->tm_year);
10561 if(!(*err & IOSTATE_failbit) && t->tm_year<69)
10562 t->tm_year += 100;
10563 break;
10564 case 'Y':
10565 time_get_char_get_year(this, &s, s, e, base, err, t);
10566 break;
10567 default:
10568 FIXME("unrecognized format: %c\n", fmt);
10569 *err |= IOSTATE_failbit;
10572 if(!s.strbuf)
10573 *err |= IOSTATE_eofbit;
10574 *ret = s;
10575 return ret;
10578 /* ?get@?$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@@DD@Z */
10579 /* ?get@?$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@@DD@Z */
10580 DEFINE_THISCALL_WRAPPER(time_get_char_get, 44)
10581 istreambuf_iterator_char* __thiscall time_get_char_get(const time_get_char *this,
10582 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10583 ios_base *base, int *err, struct tm *t, char fmt, char mod)
10585 return call_time_get_char_do_get(this, ret, s, e, base, err, t, fmt, mod);
10588 /* ?get@?$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@@PBD4@Z */
10589 /* ?get@?$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@@PEBD4@Z */
10590 DEFINE_THISCALL_WRAPPER(time_get_char_get_fmt, 44)
10591 istreambuf_iterator_char* __thiscall time_get_char_get_fmt(const time_get_char *this,
10592 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10593 ios_base *base, int *err, struct tm *t, const char *fmtstart, const char *fmtend)
10595 ctype_char *ctype;
10597 TRACE("(%p %p %p %p %p %s)\n", this, ret, base, err, t, wine_dbgstr_an(fmtstart, fmtend-fmtstart));
10599 ctype = ctype_char_use_facet(IOS_LOCALE(base));
10600 istreambuf_iterator_char_val(&s);
10602 while(fmtstart < fmtend) {
10603 if(ctype_char_is_ch(ctype, _SPACE, *fmtstart)) {
10604 skip_ws_char(ctype, &s);
10605 fmtstart++;
10606 continue;
10609 if(!s.strbuf) {
10610 *err |= IOSTATE_failbit;
10611 break;
10614 if(*fmtstart != '%' || fmtstart+1 >= fmtend || fmtstart[1] == '%') {
10615 if(s.val != *fmtstart)
10616 *err |= IOSTATE_failbit;
10617 else
10618 istreambuf_iterator_char_inc(&s);
10619 if(*fmtstart == '%')
10620 fmtstart++;
10621 } else {
10622 fmtstart++;
10623 time_get_char_get(this, &s, s, e, base, err, t, *fmtstart, 0);
10626 if(*err & IOSTATE_failbit)
10627 break;
10628 fmtstart++;
10631 if(!s.strbuf)
10632 *err |= IOSTATE_eofbit;
10633 *ret = s;
10634 return ret;
10637 /* ?id@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
10638 locale_id time_get_wchar_id = {0};
10640 /* ??_7?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
10641 extern const vtable_ptr MSVCP_time_get_wchar_vtable;
10643 #if _MSVCP_VER >=110
10644 static wchar_t* create_time_get_str(const wchar_t *str)
10646 wchar_t *ret;
10647 int len;
10649 len = lstrlenW(str)+1;
10650 ret = MSVCRT_operator_new(len * sizeof(wchar_t));
10651 if(ret)
10652 memcpy(ret, str, len*sizeof(wchar_t));
10653 return ret;
10655 #else
10656 static wchar_t* create_time_get_str(const char *str, const _Locinfo *locinfo)
10658 wchar_t *ret;
10659 _Cvtvec cvt;
10660 int len;
10662 _Locinfo__Getcvt(locinfo, &cvt);
10663 len = MultiByteToWideChar(cvt.page, 0, str, -1, NULL, 0);
10664 ret = MSVCRT_operator_new(len*sizeof(WCHAR));
10665 if(ret)
10666 MultiByteToWideChar(cvt.page, 0, str, -1, ret, len);
10667 return ret;
10669 #endif
10671 /* ?_Init@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
10672 /* ?_Init@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
10673 DEFINE_THISCALL_WRAPPER(time_get_wchar__Init, 8)
10674 void __thiscall time_get_wchar__Init(time_get_wchar *this, const _Locinfo *locinfo)
10676 TRACE("(%p %p)\n", this, locinfo);
10678 #if _MSVCP_VER >=110
10679 this->days = create_time_get_str(_Locinfo__W_Getdays(locinfo));
10680 #else
10681 this->days = create_time_get_str(_Locinfo__Getdays(locinfo), locinfo);
10682 #endif
10683 if(!this->days)
10685 ERR("Out of memory\n");
10686 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10689 #if _MSVCP_VER >=110
10690 this->months = create_time_get_str(_Locinfo__W_Getmonths(locinfo));
10691 #else
10692 this->months = create_time_get_str(_Locinfo__Getmonths(locinfo), locinfo);
10693 #endif
10694 if(!this->months)
10696 MSVCRT_operator_delete((wchar_t*)this->days);
10698 ERR("Out of memory\n");
10699 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10702 this->dateorder = _Locinfo__Getdateorder(locinfo);
10703 _Locinfo__Getcvt(locinfo, &this->cvt);
10706 /* ??0?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
10707 /* ??0?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
10708 DEFINE_THISCALL_WRAPPER(time_get_wchar_ctor_locinfo, 12)
10709 time_get_wchar* __thiscall time_get_wchar_ctor_locinfo(time_get_wchar *this,
10710 const _Locinfo *locinfo, size_t refs)
10712 TRACE("(%p %p %Iu)\n", this, locinfo, refs);
10713 locale_facet_ctor_refs(&this->facet, refs);
10714 this->facet.vtable = &MSVCP_time_get_wchar_vtable;
10715 time_get_wchar__Init(this, locinfo);
10716 return this;
10719 /* ??0?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
10720 /* ??0?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
10721 DEFINE_THISCALL_WRAPPER(time_get_wchar_ctor_name, 12)
10722 time_get_wchar* __thiscall time_get_wchar_ctor_name(time_get_wchar *this, const char *name, size_t refs)
10724 _Locinfo locinfo;
10726 TRACE("(%p %s %Iu)\n", this, name, refs);
10728 _Locinfo_ctor_cstr(&locinfo, name);
10729 time_get_wchar_ctor_locinfo(this, &locinfo, refs);
10730 _Locinfo_dtor(&locinfo);
10731 return this;
10734 /* ??0?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
10735 /* ??0?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
10736 DEFINE_THISCALL_WRAPPER(time_get_wchar_ctor_refs, 8)
10737 time_get_wchar* __thiscall time_get_wchar_ctor_refs(time_get_wchar *this, size_t refs)
10739 _Locinfo locinfo;
10741 TRACE("(%p %Iu)\n", this, refs);
10743 _Locinfo_ctor(&locinfo);
10744 time_get_wchar_ctor_locinfo(this, &locinfo, refs);
10745 _Locinfo_dtor(&locinfo);
10746 return this;
10749 /* ??_F?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
10750 /* ??_F?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
10751 DEFINE_THISCALL_WRAPPER(time_get_wchar_ctor, 4)
10752 time_get_wchar* __thiscall time_get_wchar_ctor(time_get_wchar *this)
10754 return time_get_wchar_ctor_refs(this, 0);
10757 /* ?_Tidy@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AAEXXZ */
10758 /* ?_Tidy@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEAAXXZ */
10759 DEFINE_THISCALL_WRAPPER(time_get_wchar__Tidy, 4)
10760 void __thiscall time_get_wchar__Tidy(time_get_wchar *this)
10762 TRACE("(%p)\n", this);
10764 MSVCRT_operator_delete((wchar_t*)this->days);
10765 MSVCRT_operator_delete((wchar_t*)this->months);
10768 /* ??1?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
10769 /* ??1?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
10770 DEFINE_THISCALL_WRAPPER(time_get_wchar_dtor, 4) /* virtual */
10771 void __thiscall time_get_wchar_dtor(time_get_wchar *this)
10773 TRACE("(%p)\n", this);
10775 time_get_wchar__Tidy(this);
10778 DEFINE_THISCALL_WRAPPER(time_get_wchar_vector_dtor, 8)
10779 time_get_wchar* __thiscall time_get_wchar_vector_dtor(time_get_wchar *this, unsigned int flags)
10781 TRACE("(%p %x)\n", this, flags);
10782 if(flags & 2) {
10783 /* we have an array, with the number of elements stored before the first object */
10784 INT_PTR i, *ptr = (INT_PTR *)this-1;
10786 for(i=*ptr-1; i>=0; i--)
10787 time_get_wchar_dtor(this+i);
10788 MSVCRT_operator_delete(ptr);
10789 } else {
10790 time_get_wchar_dtor(this);
10791 if(flags & 1)
10792 MSVCRT_operator_delete(this);
10795 return this;
10798 /* ?_Getcat@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
10799 /* ?_Getcat@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
10800 unsigned int __cdecl time_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
10802 TRACE("(%p %p)\n", facet, loc);
10804 if(facet && !*facet) {
10805 _Locinfo locinfo;
10807 *facet = MSVCRT_operator_new(sizeof(time_get_wchar));
10808 if(!*facet) {
10809 ERR("Out of memory\n");
10810 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10811 return 0;
10814 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
10815 time_get_wchar_ctor_locinfo((time_get_wchar*)*facet, &locinfo, 0);
10816 _Locinfo_dtor(&locinfo);
10819 return LC_TIME;
10822 static time_get_wchar* time_get_wchar_use_facet(const locale *loc)
10824 static time_get_wchar *obj = NULL;
10826 _Lockit lock;
10827 const locale_facet *fac;
10829 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10830 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_get_wchar_id));
10831 if(fac) {
10832 _Lockit_dtor(&lock);
10833 return (time_get_wchar*)fac;
10836 if(obj) {
10837 _Lockit_dtor(&lock);
10838 return obj;
10841 time_get_wchar__Getcat(&fac, loc);
10842 obj = (time_get_wchar*)fac;
10843 call_locale_facet__Incref(&obj->facet);
10844 locale_facet_register(&obj->facet);
10845 _Lockit_dtor(&lock);
10847 return obj;
10850 /* ?_Getint@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAHAAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@0HHAAH@Z */
10851 /* ?_Getint@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@0HHAEAH@Z */
10852 int __cdecl time_get_wchar__Getint(const time_get_wchar *this,
10853 istreambuf_iterator_wchar *b, istreambuf_iterator_wchar *e,
10854 int min_val, int max_val, int *val)
10856 BOOL got_digit = FALSE;
10857 int len = 0, ret = 0;
10858 char buf[16];
10860 TRACE("(%p %p %p %d %d %p)\n", this, b, e, min_val, max_val, val);
10862 istreambuf_iterator_wchar_val(b);
10863 if(b->strbuf && (b->val == '-' || b->val == '+'))
10865 buf[len++] = b->val;
10866 istreambuf_iterator_wchar_inc(b);
10869 if (b->strbuf && b->val == '0')
10871 got_digit = TRUE;
10872 buf[len++] = '0';
10873 istreambuf_iterator_wchar_inc(b);
10875 while (b->strbuf && b->val == '0')
10876 istreambuf_iterator_wchar_inc(b);
10878 for (; b->strbuf && b->val >= '0' && b->val <= '9';
10879 istreambuf_iterator_wchar_inc(b))
10881 if(len < ARRAY_SIZE(buf)-1)
10882 buf[len] = b->val;
10883 got_digit = TRUE;
10884 len++;
10887 if (!b->strbuf)
10888 ret |= IOSTATE_eofbit;
10889 if (got_digit && len < ARRAY_SIZE(buf)-1)
10891 int v, err;
10893 buf[len] = 0;
10894 v = _Stolx(buf, NULL, 10, &err);
10895 if(err || v < min_val || v > max_val)
10896 ret |= IOSTATE_failbit;
10897 else
10898 *val = v;
10900 else
10901 ret |= IOSTATE_failbit;
10902 return ret;
10905 /* ?do_date_order@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AW4dateorder@time_base@2@XZ */
10906 /* ?do_date_order@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AW4dateorder@time_base@2@XZ */
10907 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_date_order, 4) /* virtual */
10908 #if _MSVCP_VER <= 100
10909 #define call_time_get_wchar_do_date_order(this) CALL_VTBL_FUNC(this, 4, dateorder, (const time_get_wchar*), (this))
10910 #else
10911 #define call_time_get_wchar_do_date_order(this) CALL_VTBL_FUNC(this, 12, dateorder, (const time_get_wchar*), (this))
10912 #endif
10913 dateorder __thiscall time_get_wchar_do_date_order(const time_get_wchar *this)
10915 TRACE("(%p)\n", this);
10916 return this->dateorder;
10919 /* ?date_order@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ */
10920 /* ?date_order@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AW4dateorder@time_base@2@XZ */
10921 DEFINE_THISCALL_WRAPPER(time_get_wchar_date_order, 4)
10922 dateorder __thiscall time_get_wchar_date_order(const time_get_wchar *this)
10924 return call_time_get_wchar_do_date_order(this);
10927 static int find_longest_match_wchar(istreambuf_iterator_wchar *iter, const wchar_t *str)
10929 int i, len = 0, last_match = -1, match = -1;
10930 const wchar_t *p, *end;
10931 wchar_t buf[64];
10933 for(istreambuf_iterator_wchar_val(iter); iter->strbuf && len<ARRAY_SIZE(buf);
10934 istreambuf_iterator_wchar_inc(iter))
10936 BOOL got_prefix = FALSE;
10938 buf[len++] = iter->val;
10939 last_match = match;
10940 match = -1;
10941 for(p=str+1, i=0; *p; p = (*end ? end+1 : end), i++)
10943 end = wcschr(p, ':');
10944 if (!end)
10945 end = p + lstrlenW(p);
10947 if (end-p >= len && !memcmp(p, buf, len*sizeof(wchar_t)))
10949 if (end-p == len)
10950 match = i;
10951 else
10952 got_prefix = TRUE;
10956 if (!got_prefix)
10958 if (match != -1)
10960 istreambuf_iterator_wchar_inc(iter);
10961 return match;
10963 break;
10966 if (len == ARRAY_SIZE(buf))
10967 FIXME("temporary buffer is too small\n");
10968 if (!iter->strbuf)
10969 return match;
10970 return last_match;
10973 /* ?do_get_monthname@?$time_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@AAHPAUtm@@@Z */
10974 /* ?do_get_monthname@?$time_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@AEAHPEAUtm@@@Z */
10975 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_get_monthname, 36) /* virtual */
10976 #if _MSVCP_VER <= 100
10977 #define call_time_get_wchar_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
10978 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
10979 (this, ret, s, e, base, err, t))
10980 #else
10981 #define call_time_get_wchar_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
10982 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
10983 (this, ret, s, e, base, err, t))
10984 #endif
10985 istreambuf_iterator_wchar* __thiscall time_get_wchar_do_get_monthname(const time_get_wchar *this,
10986 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
10987 ios_base *base, int *err, struct tm *t)
10989 int match;
10991 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
10993 if ((match = find_longest_match_wchar(&s, this->months)) != -1)
10994 t->tm_mon = match / 2;
10995 else
10996 *err |= IOSTATE_failbit;
10998 *ret = s;
10999 return ret;
11002 /* ?get_monthname@?$time_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@AAHPAUtm@@@Z */
11003 /* ?get_monthname@?$time_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@AEAHPEAUtm@@@Z */
11004 DEFINE_THISCALL_WRAPPER(time_get_wchar_get_monthname, 36)
11005 istreambuf_iterator_wchar* __thiscall time_get_wchar_get_monthname(const time_get_wchar *this,
11006 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11007 ios_base *base, int *err, struct tm *t)
11009 return call_time_get_wchar_do_get_monthname(this, ret, s, e, base, err, t);
11012 /* ?do_get_time@?$time_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@AAHPAUtm@@@Z */
11013 /* ?do_get_time@?$time_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@AEAHPEAUtm@@@Z */
11014 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_get_time, 36) /* virtual */
11015 #if _MSVCP_VER <= 100
11016 #define call_time_get_wchar_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
11017 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11018 (this, ret, s, e, base, err, t))
11019 #else
11020 #define call_time_get_wchar_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
11021 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11022 (this, ret, s, e, base, err, t))
11023 #endif
11024 istreambuf_iterator_wchar* __thiscall time_get_wchar_do_get_time(const time_get_wchar *this,
11025 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11026 ios_base *base, int *err, struct tm *t)
11028 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
11030 *err |= time_get_wchar__Getint(this, &s, &e, 0, 23, &t->tm_hour);
11031 if (*err || istreambuf_iterator_wchar_val(&s)!=':')
11032 *err |= IOSTATE_failbit;
11034 if (!*err)
11036 istreambuf_iterator_wchar_inc(&s);
11037 *err |= time_get_wchar__Getint(this, &s, &e, 0, 59, &t->tm_min);
11039 if (*err || istreambuf_iterator_wchar_val(&s)!=':')
11040 *err |= IOSTATE_failbit;
11042 if (!*err)
11044 istreambuf_iterator_wchar_inc(&s);
11045 *err |= time_get_wchar__Getint(this, &s, &e, 0, 59, &t->tm_sec);
11048 *ret = s;
11049 return ret;
11052 /* ?get_time@?$time_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@AAHPAUtm@@@Z */
11053 /* ?get_time@?$time_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@AEAHPEAUtm@@@Z */
11054 DEFINE_THISCALL_WRAPPER(time_get_wchar_get_time, 36)
11055 istreambuf_iterator_wchar* __thiscall time_get_wchar_get_time(const time_get_wchar *this,
11056 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11057 ios_base *base, int *err, struct tm *t)
11059 return call_time_get_wchar_do_get_time(this, ret, s, e, base, err, t);
11062 /* ?do_get_weekday@?$time_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@AAHPAUtm@@@Z */
11063 /* ?do_get_weekday@?$time_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@AEAHPEAUtm@@@Z */
11064 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_get_weekday, 36) /* virtual */
11065 #if _MSVCP_VER <= 100
11066 #define call_time_get_wchar_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
11067 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11068 (this, ret, s, e, base, err, t))
11069 #else
11070 #define call_time_get_wchar_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
11071 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11072 (this, ret, s, e, base, err, t))
11073 #endif
11074 istreambuf_iterator_wchar* __thiscall time_get_wchar_do_get_weekday(const time_get_wchar *this,
11075 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11076 ios_base *base, int *err, struct tm *t)
11078 int match;
11080 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
11082 if ((match = find_longest_match_wchar(&s, this->days)) != -1)
11083 t->tm_wday = match / 2;
11084 else
11085 *err |= IOSTATE_failbit;
11087 *ret = s;
11088 return ret;
11091 /* ?get_weekday@?$time_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@AAHPAUtm@@@Z */
11092 /* ?get_weekday@?$time_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@AEAHPEAUtm@@@Z */
11093 DEFINE_THISCALL_WRAPPER(time_get_wchar_get_weekday, 36)
11094 istreambuf_iterator_wchar* __thiscall time_get_wchar_get_weekday(const time_get_wchar *this,
11095 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11096 ios_base *base, int *err, struct tm *t)
11098 return call_time_get_wchar_do_get_weekday(this, ret, s, e, base, err, t);
11101 /* ?do_get_year@?$time_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@AAHPAUtm@@@Z */
11102 /* ?do_get_year@?$time_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@AEAHPEAUtm@@@Z */
11103 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_get_year, 36) /* virtual */
11104 #if _MSVCP_VER <= 100
11105 #define call_time_get_wchar_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
11106 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11107 (this, ret, s, e, base, err, t))
11108 #else
11109 #define call_time_get_wchar_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
11110 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11111 (this, ret, s, e, base, err, t))
11112 #endif
11113 istreambuf_iterator_wchar* __thiscall time_get_wchar_do_get_year(const time_get_wchar *this,
11114 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11115 ios_base *base, int *err, struct tm *t)
11117 int year;
11119 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
11121 /* The function supports only dates from [1900-2035] range */
11122 *err |= time_get_wchar__Getint(this, &s, &e, 0, 2035, &year);
11123 if (!(*err & IOSTATE_failbit))
11125 if (year >= 1900)
11126 year -= 1900;
11127 if (year > 135)
11128 *err |= IOSTATE_failbit;
11129 else
11130 t->tm_year = year;
11133 *ret = s;
11134 return ret;
11137 /* ?get_year@?$time_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@AAHPAUtm@@@Z */
11138 /* ?get_year@?$time_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@AEAHPEAUtm@@@Z */
11139 DEFINE_THISCALL_WRAPPER(time_get_wchar_get_year, 36)
11140 istreambuf_iterator_wchar* __thiscall time_get_wchar_get_year(const time_get_wchar *this,
11141 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11142 ios_base *base, int *err, struct tm *t)
11144 return call_time_get_wchar_do_get_year(this, ret, s, e, base, err, t);
11147 static void skip_ws_wchar(ctype_wchar *ctype, istreambuf_iterator_wchar *iter)
11149 istreambuf_iterator_wchar_val(iter);
11150 while(iter->strbuf && ctype_wchar_is_ch(ctype, _SPACE, iter->val))
11151 istreambuf_iterator_wchar_inc(iter);
11154 static void skip_date_delim_wchar(ctype_wchar *ctype, istreambuf_iterator_wchar *iter)
11156 skip_ws_wchar(ctype, iter);
11157 if(iter->strbuf && (iter->val == '/' || iter->val == ':'))
11158 istreambuf_iterator_wchar_inc(iter);
11159 skip_ws_wchar(ctype, iter);
11162 /* ?do_get_date@?$time_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@AAHPAUtm@@@Z */
11163 /* ?do_get_date@?$time_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@AEAHPEAUtm@@@Z */
11164 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_get_date, 36) /* virtual */
11165 #if _MSVCP_VER <= 100
11166 #define call_time_get_wchar_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
11167 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11168 (this, ret, s, e, base, err, t))
11169 #else
11170 #define call_time_get_wchar_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
11171 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*), \
11172 (this, ret, s, e, base, err, t))
11173 #endif
11174 istreambuf_iterator_wchar* __thiscall time_get_wchar_do_get_date(const time_get_wchar *this,
11175 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11176 ios_base *base, int *err, struct tm *t)
11178 ctype_wchar *ctype;
11179 dateorder order;
11181 TRACE("(%p %p %p %p %p)\n", this, ret, base, err, t);
11183 ctype = ctype_wchar_use_facet(IOS_LOCALE(base));
11185 order = time_get_wchar_date_order(this);
11186 if(order == DATEORDER_no_order)
11187 order = DATEORDER_mdy;
11189 switch(order) {
11190 case DATEORDER_dmy:
11191 *err |= time_get_wchar__Getint(this, &s, &e, 1, 31, &t->tm_mday);
11192 skip_date_delim_wchar(ctype, &s);
11193 if(!s.strbuf) {
11194 *err |= IOSTATE_failbit;
11195 break;
11197 if(s.strbuf && ctype_wchar_is_ch(ctype, _DIGIT, s.val)) {
11198 *err |= time_get_wchar__Getint(this, &s, &e, 1, 12, &t->tm_mon);
11199 t->tm_mon--;
11200 } else {
11201 time_get_wchar_get_monthname(this, &s, s, e, base, err, t);
11203 skip_date_delim_wchar(ctype, &s);
11204 if(!s.strbuf) {
11205 *err |= IOSTATE_failbit;
11206 break;
11208 time_get_wchar_get_year(this, &s, s, e, base, err, t);
11209 break;
11210 case DATEORDER_mdy:
11211 istreambuf_iterator_wchar_val(&s);
11212 if(s.strbuf && ctype_wchar_is_ch(ctype, _DIGIT, s.val)) {
11213 *err |= time_get_wchar__Getint(this, &s, &e, 1, 12, &t->tm_mon);
11214 t->tm_mon--;
11215 } else {
11216 time_get_wchar_get_monthname(this, &s, s, e, base, err, t);
11218 skip_date_delim_wchar(ctype, &s);
11219 if(!s.strbuf) {
11220 *err |= IOSTATE_failbit;
11221 break;
11223 *err |= time_get_wchar__Getint(this, &s, &e, 1, 31, &t->tm_mday);
11224 skip_date_delim_wchar(ctype, &s);
11225 if(!s.strbuf) {
11226 *err |= IOSTATE_failbit;
11227 break;
11229 time_get_wchar_get_year(this, &s, s, e, base, err, t);
11230 break;
11231 case DATEORDER_ymd:
11232 time_get_wchar_get_year(this, &s, s, e, base, err, t);
11233 skip_date_delim_wchar(ctype, &s);
11234 if(!s.strbuf) {
11235 *err |= IOSTATE_failbit;
11236 break;
11238 if(ctype_wchar_is_ch(ctype, _DIGIT, s.val)) {
11239 *err |= time_get_wchar__Getint(this, &s, &e, 1, 12, &t->tm_mon);
11240 t->tm_mon--;
11241 } else {
11242 time_get_wchar_get_monthname(this, &s, s, e, base, err, t);
11244 skip_date_delim_wchar(ctype, &s);
11245 if(!s.strbuf) {
11246 *err |= IOSTATE_failbit;
11247 break;
11249 *err |= time_get_wchar__Getint(this, &s, &e, 1, 31, &t->tm_mday);
11250 break;
11251 case DATEORDER_ydm:
11252 time_get_wchar_get_year(this, &s, s, e, base, err, t);
11253 skip_date_delim_wchar(ctype, &s);
11254 if(!s.strbuf) {
11255 *err |= IOSTATE_failbit;
11256 break;
11258 *err |= time_get_wchar__Getint(this, &s, &e, 1, 31, &t->tm_mday);
11259 skip_date_delim_wchar(ctype, &s);
11260 if(!s.strbuf) {
11261 *err |= IOSTATE_failbit;
11262 break;
11264 if(ctype_wchar_is_ch(ctype, _DIGIT, s.val)) {
11265 *err |= time_get_wchar__Getint(this, &s, &e, 1, 12, &t->tm_mon);
11266 t->tm_mon--;
11267 } else {
11268 time_get_wchar_get_monthname(this, &s, s, e, base, err, t);
11270 break;
11271 default:
11272 ERR("incorrect order value: %d\n", order);
11273 break;
11276 if(!s.strbuf)
11277 *err |= IOSTATE_eofbit;
11278 *ret = s;
11279 return ret;
11282 /* ?get_date@?$time_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@AAHPAUtm@@@Z */
11283 /* ?get_date@?$time_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@AEAHPEAUtm@@@Z */
11284 DEFINE_THISCALL_WRAPPER(time_get_wchar_get_date, 36)
11285 istreambuf_iterator_wchar* __thiscall time_get_wchar_get_date(const time_get_wchar *this,
11286 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11287 ios_base *base, int *err, struct tm *t)
11289 return call_time_get_wchar_do_get_date(this, ret, s, e, base, err, t);
11292 istreambuf_iterator_wchar* __thiscall time_get_wchar_get(const time_get_wchar*,
11293 istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar,
11294 ios_base*, int*, struct tm*, char, char);
11296 /* ?_Getfmt@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHPAUtm@@PBD@Z */
11297 /* ?_Getfmt@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHPEAUtm@@PEBD@Z */
11298 DEFINE_THISCALL_WRAPPER(time_get_wchar__Getfmt, 40)
11299 istreambuf_iterator_wchar* __thiscall time_get_wchar__Getfmt(const time_get_wchar *this,
11300 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11301 ios_base *base, int *err, struct tm *t, const char *fmt)
11303 ctype_wchar *ctype;
11305 TRACE("(%p %p %p %p %p %s)\n", this, ret, base, err, t, fmt);
11307 ctype = ctype_wchar_use_facet(IOS_LOCALE(base));
11308 istreambuf_iterator_wchar_val(&s);
11310 while(*fmt) {
11311 if(*fmt == ' ') {
11312 skip_ws_wchar(ctype, &s);
11313 fmt++;
11314 continue;
11317 if(!s.strbuf) {
11318 *err |= IOSTATE_failbit;
11319 break;
11322 if(*fmt == '%') {
11323 fmt++;
11324 time_get_wchar_get(this, &s, s, e, base, err, t, *fmt, 0);
11325 } else {
11326 if(s.val != *fmt)
11327 *err |= IOSTATE_failbit;
11328 else
11329 istreambuf_iterator_wchar_inc(&s);
11332 if(*err & IOSTATE_failbit)
11333 break;
11334 fmt++;
11337 if(!s.strbuf)
11338 *err |= IOSTATE_eofbit;
11339 *ret = s;
11340 return ret;
11343 /* ?do_get@?$time_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@AAHPAUtm@@DD@Z */
11344 /* ?do_get@?$time_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@AEAHPEAUtm@@DD@Z */
11345 DEFINE_THISCALL_WRAPPER(time_get_wchar_do_get, 44) /* virtual */
11346 #if _MSVCP_VER <= 100
11347 #define call_time_get_wchar_do_get(this, ret, s, e, base, err, t, fmt, mod) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
11348 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*, char, char), \
11349 (this, ret, s, e, base, err, t, fmt, mod))
11350 #else
11351 #define call_time_get_wchar_do_get(this, ret, s, e, base, err, t, fmt, mod) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
11352 (const time_get_wchar*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, struct tm*, char, char), \
11353 (this, ret, s, e, base, err, t, fmt, mod))
11354 #endif
11355 istreambuf_iterator_wchar* __thiscall time_get_wchar_do_get(const time_get_wchar *this,
11356 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11357 ios_base *base, int *err, struct tm *t, char fmt, char mod)
11359 ctype_wchar *ctype;
11361 TRACE("(%p %p %p %p %p %c %c)\n", this, ret, base, err, t, fmt, mod);
11363 ctype = ctype_wchar_use_facet(IOS_LOCALE(base));
11365 switch(fmt) {
11366 case 'a':
11367 case 'A':
11368 time_get_wchar_get_weekday(this, &s, s, e, base, err, t);
11369 break;
11370 case 'b':
11371 case 'B':
11372 case 'h':
11373 time_get_wchar_get_monthname(this, &s, s, e, base, err, t);
11374 break;
11375 case 'c':
11376 time_get_wchar__Getfmt(this, &s, s, e, base, err, t, "%b %d %H:%M:%S %Y");
11377 break;
11378 case 'C':
11379 *err |= time_get_wchar__Getint(this, &s, &e, 0, 99, &t->tm_year);
11380 if(!(*err & IOSTATE_failbit))
11381 t->tm_year = t->tm_year * 100 - 1900;
11382 break;
11383 case 'd':
11384 case 'e':
11385 if(fmt == 'e') skip_ws_wchar(ctype, &s);
11386 *err |= time_get_wchar__Getint(this, &s, &e, 1, 31, &t->tm_mday);
11387 break;
11388 case 'D':
11389 time_get_wchar__Getfmt(this, &s, s, e, base, err, t, "%m/%d/%y");
11390 break;
11391 case 'F':
11392 time_get_wchar__Getfmt(this, &s, s, e, base, err, t, "%Y-%m-%d");
11393 break;
11394 case 'H':
11395 *err |= time_get_wchar__Getint(this, &s, &e, 0, 23, &t->tm_hour);
11396 break;
11397 case 'I':
11398 *err |= time_get_wchar__Getint(this, &s, &e, 0, 11, &t->tm_hour);
11399 break;
11400 case 'j':
11401 *err |= time_get_wchar__Getint(this, &s, &e, 1, 366, &t->tm_yday);
11402 break;
11403 case 'm':
11404 *err |= time_get_wchar__Getint(this, &s, &e, 1, 12, &t->tm_mon);
11405 if(!(*err & IOSTATE_failbit))
11406 t->tm_mon--;
11407 break;
11408 case 'M':
11409 *err = time_get_wchar__Getint(this, &s, &e, 0, 59, &t->tm_min);
11410 break;
11411 case 'n':
11412 case 't':
11413 skip_ws_wchar(ctype, &s);
11414 break;
11415 case 'p': {
11416 BOOL pm = FALSE;
11418 istreambuf_iterator_wchar_val(&s);
11419 if(s.strbuf && (s.val=='P' || s.val=='p'))
11420 pm = TRUE;
11421 else if (!s.strbuf || (s.val!='A' && s.val!='a')) {
11422 *err |= IOSTATE_failbit;
11423 break;
11425 istreambuf_iterator_wchar_inc(&s);
11426 if(!s.strbuf || (s.val!='M' && s.val!='m')) {
11427 *err |= IOSTATE_failbit;
11428 break;
11430 istreambuf_iterator_wchar_inc(&s);
11432 if(pm)
11433 t->tm_hour += 12;
11434 break;
11436 case 'r':
11437 time_get_wchar__Getfmt(this, &s, s, e, base, err, t, "%I:%M:%S %p");
11438 break;
11439 case 'R':
11440 time_get_wchar__Getfmt(this, &s, s, e, base, err, t, "%H:%M");
11441 break;
11442 case 'S':
11443 *err |= time_get_wchar__Getint(this, &s, &e, 0, 59, &t->tm_sec);
11444 break;
11445 case 'T':
11446 case 'X':
11447 time_get_wchar__Getfmt(this, &s, s, e, base, err, t, "%H:%M:%S");
11448 break;
11449 case 'u':
11450 *err |= time_get_wchar__Getint(this, &s, &e, 1, 7, &t->tm_wday);
11451 if(!(*err & IOSTATE_failbit) && t->tm_wday==7)
11452 t->tm_wday = 0;
11453 break;
11454 case 'w':
11455 *err |= time_get_wchar__Getint(this, &s, &e, 0, 6, &t->tm_wday);
11456 break;
11457 case 'x':
11458 time_get_wchar_get_date(this, &s, s, e, base, err, t);
11459 break;
11460 case 'y':
11461 *err |= time_get_wchar__Getint(this, &s, &e, 0, 99, &t->tm_year);
11462 if(!(*err & IOSTATE_failbit) && t->tm_year<69)
11463 t->tm_year += 100;
11464 break;
11465 case 'Y':
11466 time_get_wchar_get_year(this, &s, s, e, base, err, t);
11467 break;
11468 default:
11469 FIXME("unrecognized format: %c\n", fmt);
11470 *err |= IOSTATE_failbit;
11473 if(!s.strbuf)
11474 *err |= IOSTATE_eofbit;
11475 *ret = s;
11476 return ret;
11479 /* ?get@?$time_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@AAHPAUtm@@DD@Z */
11480 /* ?get@?$time_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@AEAHPEAUtm@@DD@Z */
11481 DEFINE_THISCALL_WRAPPER(time_get_wchar_get, 44)
11482 istreambuf_iterator_wchar* __thiscall time_get_wchar_get(const time_get_wchar *this,
11483 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11484 ios_base *base, int *err, struct tm *t, char fmt, char mod)
11486 return call_time_get_wchar_do_get(this, ret, s, e, base, err, t, fmt, mod);
11489 /* ?get@?$time_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@AAHPAUtm@@PB_W4@Z */
11490 /* ?get@?$time_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@AEAHPEAUtm@@PEB_W4@Z */
11491 DEFINE_THISCALL_WRAPPER(time_get_wchar_get_fmt, 44)
11492 istreambuf_iterator_wchar* __thiscall time_get_wchar_get_fmt(const time_get_wchar *this,
11493 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar s, istreambuf_iterator_wchar e,
11494 ios_base *base, int *err, struct tm *t, const wchar_t *fmtstart, const wchar_t *fmtend)
11496 ctype_wchar *ctype;
11498 TRACE("(%p %p %p %p %p %s)\n", this, ret, base, err, t, wine_dbgstr_wn(fmtstart, fmtend-fmtstart));
11500 ctype = ctype_wchar_use_facet(IOS_LOCALE(base));
11501 istreambuf_iterator_wchar_val(&s);
11503 while(fmtstart < fmtend) {
11504 if(ctype_wchar_is_ch(ctype, _SPACE, *fmtstart)) {
11505 skip_ws_wchar(ctype, &s);
11506 fmtstart++;
11507 continue;
11510 if(!s.strbuf) {
11511 *err |= IOSTATE_failbit;
11512 break;
11515 if(*fmtstart != '%' || fmtstart+1 >= fmtend || fmtstart[1] == '%') {
11516 if(s.val != *fmtstart)
11517 *err |= IOSTATE_failbit;
11518 else
11519 istreambuf_iterator_wchar_inc(&s);
11520 if(*fmtstart == '%')
11521 fmtstart++;
11522 } else {
11523 fmtstart++;
11524 time_get_wchar_get(this, &s, s, e, base, err, t, *fmtstart, 0);
11527 if(*err & IOSTATE_failbit)
11528 break;
11529 fmtstart++;
11532 if(!s.strbuf)
11533 *err |= IOSTATE_eofbit;
11534 *ret = s;
11535 return ret;
11538 /* ??_7_Locimp@locale@std@@6B@ */
11539 extern const vtable_ptr MSVCP_locale__Locimp_vtable;
11541 /* ??0_Locimp@locale@std@@AAE@_N@Z */
11542 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
11543 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
11544 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, bool transparent)
11546 TRACE("(%p %d)\n", this, transparent);
11548 memset(this, 0, sizeof(locale__Locimp));
11549 locale_facet_ctor_refs(&this->facet, 1);
11550 this->facet.vtable = &MSVCP_locale__Locimp_vtable;
11551 this->transparent = transparent;
11552 locale_string_char_ctor_cstr(&this->name, "*");
11553 return this;
11556 /* ??_F_Locimp@locale@std@@QAEXXZ */
11557 /* ??_F_Locimp@locale@std@@QEAAXXZ */
11558 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
11559 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
11561 return locale__Locimp_ctor_transparent(this, FALSE);
11564 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
11565 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
11566 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
11567 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
11569 _Lockit lock;
11570 size_t i;
11572 TRACE("(%p %p)\n", this, copy);
11574 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
11575 memcpy(this, copy, sizeof(locale__Locimp));
11576 locale_facet_ctor_refs(&this->facet, 1);
11577 this->facet.vtable = &MSVCP_locale__Locimp_vtable;
11578 if(copy->facetvec) {
11579 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
11580 if(!this->facetvec) {
11581 _Lockit_dtor(&lock);
11582 ERR("Out of memory\n");
11583 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11584 return NULL;
11586 for(i=0; i<this->facet_cnt; i++)
11588 this->facetvec[i] = copy->facetvec[i];
11589 if(this->facetvec[i])
11590 call_locale_facet__Incref(this->facetvec[i]);
11593 locale_string_char_copy_ctor(&this->name, &copy->name);
11594 _Lockit_dtor(&lock);
11595 return this;
11598 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
11599 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
11600 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
11602 return locale__Locimp_copy_ctor(this, copy);
11605 /* ??1_Locimp@locale@std@@MAE@XZ */
11606 /* ??1_Locimp@locale@std@@MEAA@XZ */
11607 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
11608 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
11610 size_t i;
11612 TRACE("(%p)\n", this);
11614 locale_facet_dtor(&this->facet);
11615 for(i=0; i<this->facet_cnt; i++)
11616 if(this->facetvec[i] && call_locale_facet__Decref(this->facetvec[i]))
11617 call_locale_facet_vector_dtor(this->facetvec[i], 1);
11619 MSVCRT_operator_delete(this->facetvec);
11620 locale_string_char_dtor(&this->name);
11623 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
11624 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
11625 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
11627 locale__Locimp_dtor(this);
11630 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
11631 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
11633 TRACE("(%p %x)\n", this, flags);
11634 if(flags & 2) {
11635 /* we have an array, with the number of elements stored before the first object */
11636 INT_PTR i, *ptr = (INT_PTR *)this-1;
11638 for(i=*ptr-1; i>=0; i--)
11639 locale__Locimp_dtor(this+i);
11640 MSVCRT_operator_delete(ptr);
11641 } else {
11642 locale__Locimp_dtor(this);
11643 if(flags & 1)
11644 MSVCRT_operator_delete(this);
11647 return this;
11650 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@ABV123@@Z */
11651 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z */
11652 locale__Locimp* __cdecl locale__Locimp__New_Locimp(const locale__Locimp *copy)
11654 locale__Locimp *ret;
11656 TRACE("(%p)\n", copy);
11658 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
11659 if(!ret) {
11660 ERR("Out of memory\n");
11661 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11662 return NULL;
11664 return locale__Locimp_copy_ctor(ret, copy);
11667 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z */
11668 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z */
11669 locale__Locimp* __cdecl locale__Locimp__New_Locimp_transparent(bool transparent)
11671 locale__Locimp *ret;
11673 TRACE("(%x)\n", transparent);
11675 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
11676 if(!ret) {
11677 ERR("Out of memory\n");
11678 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11679 return NULL;
11681 return locale__Locimp_ctor_transparent(ret, transparent);
11684 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
11685 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
11686 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, size_t id)
11688 _Lockit lock;
11690 TRACE("(%p %p %Iu)\n", locimp, facet, id);
11692 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
11693 if(id >= locimp->facet_cnt) {
11694 size_t new_size = id+1;
11695 locale_facet **new_facetvec;
11697 if(new_size < 40)
11698 new_size = 40;
11700 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
11701 if(!new_facetvec) {
11702 _Lockit_dtor(&lock);
11703 ERR("Out of memory\n");
11704 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11705 return;
11708 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
11709 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
11710 MSVCRT_operator_delete(locimp->facetvec);
11711 locimp->facetvec = new_facetvec;
11712 locimp->facet_cnt = new_size;
11715 if(locimp->facetvec[id] && call_locale_facet__Decref(locimp->facetvec[id]))
11716 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
11718 locimp->facetvec[id] = facet;
11719 if(facet)
11720 call_locale_facet__Incref(facet);
11721 _Lockit_dtor(&lock);
11724 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
11725 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
11726 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
11727 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, size_t id)
11729 locale__Locimp__Locimp_Addfac(this, facet, id);
11732 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
11733 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
11734 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
11736 FIXME("stub\n");
11737 return NULL;
11740 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
11741 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
11742 /* List of missing facets:
11743 * messages, money_get, money_put, moneypunct, moneypunct, time_get
11745 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
11747 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
11749 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
11750 ctype_wchar *ctype;
11752 if(loc) {
11753 ctype = ctype_short_use_facet(loc);
11754 }else {
11755 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
11756 if(!ctype) {
11757 ERR("Out of memory\n");
11758 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11760 ctype_short_ctor_locinfo(ctype, locinfo, 0);
11762 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
11765 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
11766 num_get *numget;
11768 if(loc) {
11769 numget = num_get_short_use_facet(loc);
11770 }else {
11771 numget = MSVCRT_operator_new(sizeof(num_get));
11772 if(!numget) {
11773 ERR("Out of memory\n");
11774 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11776 num_get_short_ctor_locinfo(numget, locinfo, 0);
11778 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
11781 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
11782 num_put *numput;
11784 if(loc) {
11785 numput = num_put_short_use_facet(loc);
11786 }else {
11787 numput = MSVCRT_operator_new(sizeof(num_put));
11788 if(!numput) {
11789 ERR("Out of memory\n");
11790 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11792 num_put_short_ctor_locinfo(numput, locinfo, 0);
11794 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
11797 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
11798 numpunct_wchar *numpunct;
11800 if(loc) {
11801 numpunct = numpunct_short_use_facet(loc);
11802 }else {
11803 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
11804 if(!numpunct) {
11805 ERR("Out of memory\n");
11806 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11808 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
11810 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
11813 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
11814 collate *c;
11816 if(loc) {
11817 c = collate_short_use_facet(loc);
11818 }else {
11819 c = MSVCRT_operator_new(sizeof(collate));
11820 if(!c) {
11821 ERR("Out of memory\n");
11822 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11824 collate_short_ctor_locinfo(c, locinfo, 0);
11826 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
11829 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
11830 time_put *t;
11832 if(loc) {
11833 t = time_put_short_use_facet(loc);
11834 }else {
11835 t = MSVCRT_operator_new(sizeof(time_put));
11836 if(!t) {
11837 ERR("Out of memory\n");
11838 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11840 time_put_short_ctor_locinfo(t, locinfo, 0);
11842 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
11845 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
11846 codecvt_wchar *codecvt;
11848 if(loc) {
11849 codecvt = codecvt_short_use_facet(loc);
11850 }else {
11851 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
11852 if(!codecvt) {
11853 ERR("Out of memory\n");
11854 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11856 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
11858 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
11862 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
11863 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
11864 /* List of missing facets:
11865 * messages, money_get, money_put, moneypunct, moneypunct
11867 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
11869 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
11871 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
11872 ctype_wchar *ctype;
11874 if(loc) {
11875 ctype = ctype_wchar_use_facet(loc);
11876 }else {
11877 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
11878 if(!ctype) {
11879 ERR("Out of memory\n");
11880 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11882 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
11884 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
11887 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
11888 num_get *numget;
11890 if(loc) {
11891 numget = num_get_wchar_use_facet(loc);
11892 }else {
11893 numget = MSVCRT_operator_new(sizeof(num_get));
11894 if(!numget) {
11895 ERR("Out of memory\n");
11896 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11898 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
11900 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
11903 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
11904 num_put *numput;
11906 if(loc) {
11907 numput = num_put_wchar_use_facet(loc);
11908 }else {
11909 numput = MSVCRT_operator_new(sizeof(num_put));
11910 if(!numput) {
11911 ERR("Out of memory\n");
11912 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11914 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
11916 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
11919 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
11920 numpunct_wchar *numpunct;
11922 if(loc) {
11923 numpunct = numpunct_wchar_use_facet(loc);
11924 }else {
11925 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
11926 if(!numpunct) {
11927 ERR("Out of memory\n");
11928 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11930 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
11932 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
11935 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
11936 collate *c;
11938 if(loc) {
11939 c = collate_wchar_use_facet(loc);
11940 }else {
11941 c = MSVCRT_operator_new(sizeof(collate));
11942 if(!c) {
11943 ERR("Out of memory\n");
11944 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11946 collate_wchar_ctor_locinfo(c, locinfo, 0);
11948 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
11951 if(cat & (1<<(time_get_wchar__Getcat(NULL, NULL)-1))) {
11952 time_get_wchar *t;
11954 if(loc) {
11955 t = time_get_wchar_use_facet(loc);
11956 }else {
11957 t = MSVCRT_operator_new(sizeof(time_get_wchar));
11958 if(!t) {
11959 ERR("Out of memory\n");
11960 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11962 time_get_wchar_ctor_locinfo(t, locinfo, 0);
11964 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_get_wchar_id));
11967 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
11968 time_put *t;
11970 if(loc) {
11971 t = time_put_wchar_use_facet(loc);
11972 }else {
11973 t = MSVCRT_operator_new(sizeof(time_put));
11974 if(!t) {
11975 ERR("Out of memory\n");
11976 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11978 time_put_wchar_ctor_locinfo(t, locinfo, 0);
11980 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
11983 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
11984 codecvt_wchar *codecvt;
11986 if(loc) {
11987 codecvt = codecvt_wchar_use_facet(loc);
11988 }else {
11989 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
11990 if(!codecvt) {
11991 ERR("Out of memory\n");
11992 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11994 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
11996 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
12000 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
12001 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
12002 /* List of missing facets:
12003 * messages, money_get, money_put, moneypunct, moneypunct
12005 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
12007 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
12009 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
12010 ctype_char *ctype;
12012 if(loc) {
12013 ctype = ctype_char_use_facet(loc);
12014 }else {
12015 ctype = MSVCRT_operator_new(sizeof(ctype_char));
12016 if(!ctype) {
12017 ERR("Out of memory\n");
12018 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12020 ctype_char_ctor_locinfo(ctype, locinfo, 0);
12022 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
12025 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
12026 num_get *numget;
12028 if(loc) {
12029 numget = num_get_char_use_facet(loc);
12030 }else {
12031 numget = MSVCRT_operator_new(sizeof(num_get));
12032 if(!numget) {
12033 ERR("Out of memory\n");
12034 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12036 num_get_char_ctor_locinfo(numget, locinfo, 0);
12038 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
12041 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
12042 num_put *numput;
12044 if(loc) {
12045 numput = num_put_char_use_facet(loc);
12046 }else {
12047 numput = MSVCRT_operator_new(sizeof(num_put));
12048 if(!numput) {
12049 ERR("Out of memory\n");
12050 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12052 num_put_char_ctor_locinfo(numput, locinfo, 0);
12054 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
12057 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
12058 numpunct_char *numpunct;
12060 if(loc) {
12061 numpunct = numpunct_char_use_facet(loc);
12062 }else {
12063 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
12064 if(!numpunct) {
12065 ERR("Out of memory\n");
12066 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12068 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
12070 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
12073 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
12074 collate *c;
12076 if(loc) {
12077 c = collate_char_use_facet(loc);
12078 }else {
12079 c = MSVCRT_operator_new(sizeof(collate));
12080 if(!c) {
12081 ERR("Out of memory\n");
12082 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12084 collate_char_ctor_locinfo(c, locinfo, 0);
12086 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
12089 if(cat & (1<<(time_get_char__Getcat(NULL, NULL)-1))) {
12090 time_get_char *t;
12092 if(loc) {
12093 t = time_get_char_use_facet(loc);
12094 }else {
12095 t = MSVCRT_operator_new(sizeof(time_get_char));
12096 if(!t) {
12097 ERR("Out of memory\n");
12098 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12100 time_get_char_ctor_locinfo(t, locinfo, 0);
12102 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_get_char_id));
12105 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
12106 time_put *t;
12108 if(loc) {
12109 t = time_put_char_use_facet(loc);
12110 }else {
12111 t = MSVCRT_operator_new(sizeof(time_put));
12112 if(!t) {
12113 ERR("Out of memory\n");
12114 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12116 time_put_char_ctor_locinfo(t, locinfo, 0);
12118 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
12121 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
12122 codecvt_char *codecvt;
12124 if(loc) {
12125 codecvt = codecvt_char_use_facet(loc);
12126 }else {
12127 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
12128 if(!codecvt) {
12129 ERR("Out of memory\n");
12130 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12132 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
12134 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
12138 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
12139 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
12140 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
12142 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
12144 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
12145 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
12146 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
12148 locimp->catmask |= cat;
12149 locale_string_char_assign(&locimp->name, &locinfo->newlocname);
12150 return locimp;
12153 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
12154 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
12155 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
12156 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
12158 TRACE("(%p %p)\n", this, locimp);
12159 /* Don't change locimp reference counter */
12160 this->ptr = locimp;
12161 return this;
12164 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
12165 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
12166 locale__Locimp* __cdecl locale__Init(void)
12168 _Lockit lock;
12170 TRACE("\n");
12172 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
12173 if(global_locale) {
12174 _Lockit_dtor(&lock);
12175 return global_locale;
12178 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
12179 if(!global_locale) {
12180 _Lockit_dtor(&lock);
12181 ERR("Out of memory\n");
12182 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12183 return NULL;
12186 locale__Locimp_ctor(global_locale);
12187 global_locale->catmask = (1<<(LC_MAX+1))-1;
12188 locale_string_char_dtor(&global_locale->name);
12189 locale_string_char_ctor_cstr(&global_locale->name, "C");
12191 locale__Locimp__Clocptr = global_locale;
12192 global_locale->facet.refs++;
12193 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
12194 _Lockit_dtor(&lock);
12196 return global_locale;
12199 /* ?_Init@locale@std@@CAPAV_Locimp@12@_N@Z */
12200 /* ?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z */
12201 locale__Locimp* __cdecl locale__Init_ref(bool inc_ref)
12203 locale__Locimp *ret;
12204 _Lockit lock;
12206 TRACE("(%x)\n", inc_ref);
12208 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
12209 if(inc_ref && global_locale) {
12210 call_locale_facet__Incref(&global_locale->facet);
12211 _Lockit_dtor(&lock);
12212 return global_locale;
12215 ret = locale__Init();
12216 _Lockit_dtor(&lock);
12217 return ret;
12220 /* ?_Iscloc@locale@std@@QBE_NXZ */
12221 /* ?_Iscloc@locale@std@@QEBA_NXZ */
12222 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
12223 bool __thiscall locale__Iscloc(const locale *this)
12225 TRACE("(%p)\n", this);
12226 return this->ptr == locale__Locimp__Clocptr;
12229 /* ??0locale@std@@QAE@ABV01@0H@Z */
12230 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
12231 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
12232 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
12234 _Locinfo locinfo;
12236 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
12238 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
12239 if(!this->ptr) {
12240 ERR("Out of memory\n");
12241 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12243 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
12245 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, locale_string_char_c_str(&loc->ptr->name));
12246 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, locale_string_char_c_str(&other->ptr->name));
12247 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
12248 _Locinfo_dtor(&locinfo);
12250 return this;
12253 /* ??0locale@std@@QAE@ABV01@@Z */
12254 /* ??0locale@std@@QEAA@AEBV01@@Z */
12255 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
12256 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
12258 TRACE("(%p %p)\n", this, copy);
12259 this->ptr = copy->ptr;
12260 call_locale_facet__Incref(&this->ptr->facet);
12261 return this;
12264 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
12265 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
12266 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
12267 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
12269 _Locinfo locinfo;
12271 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
12273 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
12274 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
12275 _Locinfo_dtor(&locinfo);
12276 MSVCRT_operator_delete(this->ptr);
12277 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
12280 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
12281 if(!this->ptr) {
12282 ERR("Out of memory\n");
12283 _Locinfo_dtor(&locinfo);
12284 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12286 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
12288 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
12289 _Locinfo_dtor(&locinfo);
12290 return this;
12293 /* ??0locale@std@@QAE@PBDH@Z */
12294 /* ??0locale@std@@QEAA@PEBDH@Z */
12295 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
12296 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
12298 _Locinfo locinfo;
12300 TRACE("(%p %s %d)\n", this, locname, cat);
12302 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
12303 if(!this->ptr) {
12304 ERR("Out of memory\n");
12305 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12307 locale__Locimp_ctor(this->ptr);
12309 locale__Init();
12311 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
12312 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
12313 _Locinfo_dtor(&locinfo);
12314 MSVCRT_operator_delete(this->ptr);
12315 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
12318 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
12319 _Locinfo_dtor(&locinfo);
12321 return this;
12324 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
12325 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
12326 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
12327 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
12329 TRACE("(%p)\n", this);
12330 this->ptr = NULL;
12331 return this;
12334 /* ??0locale@std@@QAE@XZ */
12335 /* ??0locale@std@@QEAA@XZ */
12336 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
12337 locale* __thiscall locale_ctor(locale *this)
12339 TRACE("(%p)\n", this);
12340 this->ptr = locale__Init();
12341 call_locale_facet__Incref(&this->ptr->facet);
12342 return this;
12345 /* ??1locale@std@@QAE@XZ */
12346 /* ??1locale@std@@QEAA@XZ */
12347 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
12348 void __thiscall locale_dtor(locale *this)
12350 TRACE("(%p)\n", this);
12351 if(this->ptr && call_locale_facet__Decref(&this->ptr->facet))
12353 locale__Locimp_dtor(this->ptr);
12354 MSVCRT_operator_delete(this->ptr);
12358 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
12359 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
12360 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
12361 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
12363 FIXME("(%p %p) stub\n", this, loc);
12364 return NULL;
12367 /* ??8locale@std@@QBE_NABV01@@Z */
12368 /* ??8locale@std@@QEBA_NAEBV01@@Z */
12369 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
12370 bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
12372 FIXME("(%p %p) stub\n", this, loc);
12373 return 0;
12376 /* ??9locale@std@@QBE_NABV01@@Z */
12377 /* ??9locale@std@@QEBA_NAEBV01@@Z */
12378 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
12379 bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
12381 FIXME("(%p %p) stub\n", this, loc);
12382 return 0;
12385 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
12386 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
12387 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
12388 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, size_t id, size_t catmask)
12390 TRACE("(%p %p %Iu %Iu)\n", this, facet, id, catmask);
12392 if(this->ptr->facet.refs > 1) {
12393 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
12394 if(!new_ptr) {
12395 ERR("Out of memory\n");
12396 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12397 return NULL;
12399 locale__Locimp_copy_ctor(new_ptr, this->ptr);
12400 call_locale_facet__Decref(&this->ptr->facet);
12401 this->ptr = new_ptr;
12404 locale__Locimp__Addfac(this->ptr, facet, id);
12406 if(catmask) {
12407 locale_string_char_dtor(&this->ptr->name);
12408 locale_string_char_ctor_cstr(&this->ptr->name, "*");
12410 return this;
12413 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
12414 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
12415 DEFINE_THISCALL_WRAPPER(locale__Getfacet_bool, 12)
12416 const locale_facet* __thiscall locale__Getfacet_bool(const locale *this,
12417 size_t id, bool allow_transparent)
12419 locale_facet *fac;
12421 TRACE("(%p %Iu)\n", this, id);
12423 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
12424 if(fac || !this->ptr->transparent || !allow_transparent)
12425 return fac;
12427 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
12430 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
12431 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
12432 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
12433 const locale_facet* __thiscall locale__Getfacet(const locale *this, size_t id)
12435 return locale__Getfacet_bool( this, id, TRUE );
12438 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
12439 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
12440 locale__Locimp* __cdecl locale__Getgloballocale(void)
12442 TRACE("\n");
12443 return global_locale;
12446 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
12447 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
12448 void __cdecl locale__Setgloballocale(void *locimp)
12450 TRACE("(%p)\n", locimp);
12451 global_locale = locimp;
12454 /* ?classic@locale@std@@SAABV12@XZ */
12455 /* ?classic@locale@std@@SAAEBV12@XZ */
12456 const locale* __cdecl locale_classic(void)
12458 TRACE("\n");
12459 locale__Init();
12460 return &classic_locale;
12463 /* ?empty@locale@std@@SA?AV12@XZ */
12464 locale* __cdecl locale_empty(locale *ret)
12466 TRACE("\n");
12468 locale__Init();
12470 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
12471 if(!ret->ptr) {
12472 ERR("Out of memory\n");
12473 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
12475 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
12476 return ret;
12479 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
12480 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
12481 locale* __cdecl locale_global(locale *ret, const locale *loc)
12483 _Lockit lock;
12484 int i;
12486 TRACE("(%p %p)\n", loc, ret);
12488 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
12489 locale_ctor(ret);
12491 if(loc->ptr != global_locale) {
12492 call_locale_facet__Decref(&global_locale->facet);
12493 global_locale = loc->ptr;
12494 call_locale_facet__Incref(&global_locale->facet);
12496 for(i=LC_ALL+1; i<=LC_MAX; i++) {
12497 if((global_locale->catmask & (1<<(i-1))) == 0)
12498 continue;
12499 setlocale(i, locale_string_char_c_str(&global_locale->name));
12502 _Lockit_dtor(&lock);
12503 return ret;
12506 #if _MSVCP_VER < 100
12508 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12509 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12510 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
12511 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
12513 TRACE("(%p)\n", this);
12515 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
12516 return ret;
12519 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12520 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12521 DEFINE_THISCALL_WRAPPER(locale_name, 8)
12522 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
12524 TRACE( "(%p)\n", this);
12525 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
12526 return ret;
12529 #else
12531 /* ?_Getname@_Locinfo@std@@QBEPBDXZ */
12532 /* ?_Getname@_Locinfo@std@@QEBAPEBDXZ */
12533 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 4)
12534 const char * __thiscall _Locinfo__Getname( const _Locinfo *this )
12536 return locale_string_char_c_str( &this->newlocname );
12539 #endif /* _MSVCP_VER < 100 */
12541 /* wctrans */
12542 wctrans_t __cdecl wctrans(const char *property)
12544 static const char str_tolower[] = "tolower";
12545 static const char str_toupper[] = "toupper";
12547 if(!strcmp(property, str_tolower))
12548 return 2;
12549 if(!strcmp(property, str_toupper))
12550 return 1;
12551 return 0;
12554 /* towctrans */
12555 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
12557 if(category == 1)
12558 return towupper(c);
12559 return towlower(c);
12562 #if _MSVCP_VER <= 71
12563 /* btowc */
12564 wint_t __cdecl btowc(int c)
12566 wchar_t ret;
12567 int state = 0;
12568 char ch = c;
12570 if (c == EOF || _Mbrtowc( &ret, &ch, 1, &state, NULL ) != 1) return WEOF;
12571 return ret;
12574 /* mbrlen */
12575 size_t __cdecl mbrlen(const char *str, size_t n, mbstate_t *state)
12577 static int local_state;
12579 if (!state) state = &local_state;
12580 return _Mbrtowc( NULL, str, n, state, NULL );
12583 /* mbrtowc */
12584 size_t __cdecl mbrtowc(wchar_t *dst, const char *str, size_t n, mbstate_t *state)
12586 static int local_state;
12588 if (!state) state = &local_state;
12589 return _Mbrtowc( dst, str, n, state, NULL );
12592 /* mbsrtowcs */
12593 size_t __cdecl mbsrtowcs(wchar_t *dst, const char **pstr, size_t n, mbstate_t *state)
12595 static int local_state;
12596 size_t ret = 0;
12597 wchar_t wc;
12598 const char *src;
12600 src = *pstr;
12601 if (!state) state = &local_state;
12603 while (!dst || n > ret)
12605 int len = _Mbrtowc( &wc, src, 2, state, NULL );
12606 if (len < 0) return -1;
12607 if (!len) break;
12608 if (dst) dst[ret] = wc;
12609 ret++;
12610 if (!wc) break;
12611 src += len;
12613 return ret;
12616 /* wctob */
12617 int __cdecl wctob(wint_t wc)
12619 char ret[MB_LEN_MAX];
12621 if (wc == WEOF || _Wcrtomb( ret, wc, NULL, NULL ) != 1) return EOF;
12622 return ret[0];
12625 /* wcrtomb */
12626 size_t __cdecl wcrtomb(char *dst, wchar_t wc, mbstate_t *state)
12628 return _Wcrtomb( dst, wc, state, NULL );
12631 /* wcsrtombs */
12632 size_t __cdecl wcsrtombs(char *dst, const wchar_t **pstr, size_t n, mbstate_t *state)
12634 const wchar_t *src;
12635 char buffer[MB_LEN_MAX];
12636 size_t ret = 0;
12638 src = *pstr;
12640 while (!dst || n > ret)
12642 int len = _Wcrtomb( buffer, *src, state, NULL );
12643 if (len <= 0) return -1;
12644 if (n < ret + len) break;
12645 memcpy( dst + ret, buffer, len );
12646 ret += len;
12647 if (!buffer[0]) break;
12648 src++;
12650 return ret;
12652 #endif
12654 int __cdecl _To_byte(const wchar_t *src, char *dst)
12656 TRACE("(%s %p)\n", debugstr_w(src), dst);
12657 return WideCharToMultiByte(CP_ACP, 0, src, -1, dst, MAX_PATH, NULL, NULL);
12660 int __cdecl _To_wide(const char *src, wchar_t *dst)
12662 TRACE("(%s %p)\n", debugstr_a(src), dst);
12663 return MultiByteToWideChar(CP_ACP, 0, src, -1, dst, MAX_PATH);
12666 size_t __cdecl _Strxfrm(char *dest, char *dest_end,
12667 const char *src, const char *src_end, _Collvec *coll)
12669 size_t dest_len = dest_end - dest;
12670 size_t src_len = src_end - src;
12671 _Collvec cv;
12672 WCHAR *buf;
12673 LCID lcid;
12674 int len;
12676 TRACE("(%p %p %p %p %p)\n", dest, dest_end, src, src_end, coll);
12678 if (coll) cv = *coll;
12679 else getcoll(&cv);
12681 #if _MSVCP_VER < 110
12682 lcid = cv.handle;
12683 #else
12684 lcid = LocaleNameToLCID(cv.lc_name, 0);
12685 #endif
12687 if (!lcid && !cv.page)
12689 if (src_len > dest_len) return src_len;
12690 memcpy(dest, src, src_len);
12691 return src_len;
12694 len = MultiByteToWideChar(cv.page, MB_ERR_INVALID_CHARS, src, src_len, NULL, 0);
12695 if (!len) return INT_MAX;
12696 buf = heap_alloc(len * sizeof(WCHAR));
12697 if (!buf) return INT_MAX;
12698 MultiByteToWideChar(cv.page, MB_ERR_INVALID_CHARS, src, src_len, buf, len);
12700 len = LCMapStringW(lcid, LCMAP_SORTKEY, buf, len, NULL, 0);
12701 if (len <= dest_len)
12702 LCMapStringW(lcid, LCMAP_SORTKEY, buf, len, (WCHAR*)dest, dest_len);
12703 heap_free(buf);
12704 return len;
12707 size_t __cdecl _Wcsxfrm(wchar_t *dest, wchar_t *dest_end,
12708 const wchar_t *src, const wchar_t *src_end, _Collvec *coll)
12710 size_t dest_len = dest_end - dest;
12711 size_t src_len = src_end - src;
12712 _Collvec cv;
12713 LCID lcid;
12714 int i, len;
12716 TRACE("(%p %p %p %p %p)\n", dest, dest_end, src, src_end, coll);
12718 if (coll) cv = *coll;
12719 else getcoll(&cv);
12721 #if _MSVCP_VER < 110
12722 lcid = cv.handle;
12723 #else
12724 lcid = LocaleNameToLCID(cv.lc_name, 0);
12725 #endif
12727 if (!lcid)
12729 if (src_len > dest_len) return src_len;
12730 memcpy(dest, src, src_len * sizeof(wchar_t));
12731 return src_len;
12734 len = LCMapStringW(lcid, LCMAP_SORTKEY, src, src_len, NULL, 0);
12735 if (!len) return INT_MAX;
12736 if (len > dest_len) return len;
12738 LCMapStringW(lcid, LCMAP_SORTKEY, src, src_len, dest, dest_len);
12739 for (i = len - 1; i >= 0; i--)
12740 dest[i] = ((BYTE*)dest)[i];
12741 return len;
12744 DEFINE_RTTI_DATA0(_Facet_base, 0, ".?AV_Facet_base@std@@")
12745 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
12746 DEFINE_RTTI_DATA1(locale__Locimp, 0, &locale_facet_rtti_base_descriptor, ".?AV_Locimp@locale@std@@")
12747 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
12748 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
12749 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
12750 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
12751 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
12752 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
12753 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
12754 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
12755 #if _MSVCP_VER >= 140
12756 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDU_Mbstatet@@@std@@")
12757 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDU_Mbstatet@@@std@@")
12758 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDU_Mbstatet@@@std@@")
12759 #else
12760 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
12761 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
12762 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
12763 #endif
12764 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
12765 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
12766 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
12767 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@@")
12768 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@@")
12769 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@@")
12770 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@@")
12771 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@@")
12772 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@@")
12773 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@@")
12774 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@@")
12775 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@@")
12776 DEFINE_RTTI_DATA1(time_base, 0, &locale_facet_rtti_base_descriptor, ".?AUtime_base@std@@")
12777 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@@")
12778 DEFINE_RTTI_DATA2(time_get_wchar, 0, &time_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@")
12780 __ASM_BLOCK_BEGIN(locale_vtables)
12781 __ASM_VTABLE(_Facet_base,
12782 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
12783 VTABLE_ADD_FUNC(locale_facet__Incref)
12784 VTABLE_ADD_FUNC(locale_facet__Incref)
12786 __ASM_VTABLE(locale_facet,
12787 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
12788 #if _MSVCP_VER >= 110
12789 VTABLE_ADD_FUNC(locale_facet__Incref)
12790 VTABLE_ADD_FUNC(locale_facet__Decref)
12791 #endif
12793 __ASM_VTABLE(locale__Locimp,
12794 VTABLE_ADD_FUNC(locale__Locimp_vector_dtor)
12795 #if _MSVCP_VER >= 110
12796 VTABLE_ADD_FUNC(locale_facet__Incref)
12797 VTABLE_ADD_FUNC(locale_facet__Decref)
12798 #endif
12800 __ASM_VTABLE(collate_char,
12801 VTABLE_ADD_FUNC(collate_char_vector_dtor)
12802 #if _MSVCP_VER >= 110
12803 VTABLE_ADD_FUNC(locale_facet__Incref)
12804 VTABLE_ADD_FUNC(locale_facet__Decref)
12805 #endif
12806 VTABLE_ADD_FUNC(collate_char_do_compare)
12807 VTABLE_ADD_FUNC(collate_char_do_transform)
12808 VTABLE_ADD_FUNC(collate_char_do_hash));
12809 __ASM_VTABLE(collate_wchar,
12810 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
12811 #if _MSVCP_VER >= 110
12812 VTABLE_ADD_FUNC(locale_facet__Incref)
12813 VTABLE_ADD_FUNC(locale_facet__Decref)
12814 #endif
12815 VTABLE_ADD_FUNC(collate_wchar_do_compare)
12816 VTABLE_ADD_FUNC(collate_wchar_do_transform)
12817 VTABLE_ADD_FUNC(collate_wchar_do_hash));
12818 __ASM_VTABLE(collate_short,
12819 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
12820 #if _MSVCP_VER >= 110
12821 VTABLE_ADD_FUNC(locale_facet__Incref)
12822 VTABLE_ADD_FUNC(locale_facet__Decref)
12823 #endif
12824 VTABLE_ADD_FUNC(collate_wchar_do_compare)
12825 VTABLE_ADD_FUNC(collate_wchar_do_transform)
12826 VTABLE_ADD_FUNC(collate_wchar_do_hash));
12827 __ASM_VTABLE(ctype_base,
12828 VTABLE_ADD_FUNC(ctype_base_vector_dtor)
12829 #if _MSVCP_VER >= 110
12830 VTABLE_ADD_FUNC(locale_facet__Incref)
12831 VTABLE_ADD_FUNC(locale_facet__Decref)
12832 #endif
12834 __ASM_VTABLE(ctype_char,
12835 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
12836 #if _MSVCP_VER >= 110
12837 VTABLE_ADD_FUNC(locale_facet__Incref)
12838 VTABLE_ADD_FUNC(locale_facet__Decref)
12839 #endif
12840 VTABLE_ADD_FUNC(ctype_char_do_tolower)
12841 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
12842 VTABLE_ADD_FUNC(ctype_char_do_toupper)
12843 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
12844 VTABLE_ADD_FUNC(ctype_char_do_widen)
12845 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
12846 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
12847 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
12848 VTABLE_ADD_FUNC(ctype_char_do_narrow)
12849 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
12850 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s)
12851 #else
12852 VTABLE_ADD_FUNC(ctype_char_do_narrow)
12853 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
12854 #endif
12856 __ASM_VTABLE(ctype_wchar,
12857 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
12858 #if _MSVCP_VER >= 110
12859 VTABLE_ADD_FUNC(locale_facet__Incref)
12860 VTABLE_ADD_FUNC(locale_facet__Decref)
12861 #endif
12862 VTABLE_ADD_FUNC(ctype_wchar_do_is)
12863 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
12864 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
12865 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
12866 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
12867 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
12868 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
12869 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
12870 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
12871 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
12872 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
12873 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
12874 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
12875 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
12876 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
12877 #else
12878 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
12879 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
12880 #endif
12882 __ASM_VTABLE(ctype_short,
12883 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
12884 #if _MSVCP_VER >= 110
12885 VTABLE_ADD_FUNC(locale_facet__Incref)
12886 VTABLE_ADD_FUNC(locale_facet__Decref)
12887 #endif
12888 VTABLE_ADD_FUNC(ctype_wchar_do_is)
12889 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
12890 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
12891 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
12892 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
12893 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
12894 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
12895 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
12896 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
12897 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
12898 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
12899 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
12900 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
12901 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
12902 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
12903 #else
12904 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
12905 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
12906 #endif
12908 __ASM_VTABLE(codecvt_base,
12909 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
12910 #if _MSVCP_VER >= 110
12911 VTABLE_ADD_FUNC(locale_facet__Incref)
12912 VTABLE_ADD_FUNC(locale_facet__Decref)
12913 #endif
12914 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
12915 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
12916 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
12917 __ASM_VTABLE(codecvt_char,
12918 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
12919 #if _MSVCP_VER >= 110
12920 VTABLE_ADD_FUNC(locale_facet__Incref)
12921 VTABLE_ADD_FUNC(locale_facet__Decref)
12922 VTABLE_ADD_FUNC(codecvt_char_do_always_noconv)
12923 #else
12924 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
12925 #endif
12926 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
12927 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
12928 VTABLE_ADD_FUNC(codecvt_char_do_in)
12929 VTABLE_ADD_FUNC(codecvt_char_do_out)
12930 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
12931 VTABLE_ADD_FUNC(codecvt_char_do_length));
12932 __ASM_VTABLE(codecvt_wchar,
12933 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
12934 #if _MSVCP_VER >= 110
12935 VTABLE_ADD_FUNC(locale_facet__Incref)
12936 VTABLE_ADD_FUNC(locale_facet__Decref)
12937 #endif
12938 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
12939 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
12940 #if _MSVCP_VER >= 90 && _MSVCP_VER <= 100
12941 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
12942 #else
12943 VTABLE_ADD_FUNC(codecvt_wchar_do_encoding)
12944 #endif
12945 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
12946 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
12947 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
12948 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
12949 __ASM_VTABLE(codecvt_short,
12950 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
12951 #if _MSVCP_VER >= 110
12952 VTABLE_ADD_FUNC(locale_facet__Incref)
12953 VTABLE_ADD_FUNC(locale_facet__Decref)
12954 #endif
12955 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
12956 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
12957 #if _MSVCP_VER >= 90 && _MSVCP_VER <= 100
12958 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
12959 #else
12960 VTABLE_ADD_FUNC(codecvt_wchar_do_encoding)
12961 #endif
12962 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
12963 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
12964 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
12965 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
12966 __ASM_VTABLE(numpunct_char,
12967 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
12968 #if _MSVCP_VER >= 110
12969 VTABLE_ADD_FUNC(locale_facet__Incref)
12970 VTABLE_ADD_FUNC(locale_facet__Decref)
12971 #endif
12972 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
12973 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
12974 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
12975 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
12976 VTABLE_ADD_FUNC(numpunct_char_do_truename));
12977 __ASM_VTABLE(numpunct_wchar,
12978 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
12979 #if _MSVCP_VER >= 110
12980 VTABLE_ADD_FUNC(locale_facet__Incref)
12981 VTABLE_ADD_FUNC(locale_facet__Decref)
12982 #endif
12983 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
12984 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
12985 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
12986 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
12987 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
12988 __ASM_VTABLE(numpunct_short,
12989 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
12990 #if _MSVCP_VER >= 110
12991 VTABLE_ADD_FUNC(locale_facet__Incref)
12992 VTABLE_ADD_FUNC(locale_facet__Decref)
12993 #endif
12994 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
12995 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
12996 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
12997 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
12998 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
12999 __ASM_VTABLE(num_get_char,
13000 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
13001 #if _MSVCP_VER >= 110
13002 VTABLE_ADD_FUNC(locale_facet__Incref)
13003 VTABLE_ADD_FUNC(locale_facet__Decref)
13004 #endif
13005 VTABLE_ADD_FUNC(num_get_char_do_get_void)
13006 VTABLE_ADD_FUNC(num_get_char_do_get_double)
13007 VTABLE_ADD_FUNC(num_get_char_do_get_double)
13008 VTABLE_ADD_FUNC(num_get_char_do_get_float)
13009 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
13010 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
13011 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
13012 VTABLE_ADD_FUNC(num_get_char_do_get_long)
13013 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
13014 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
13015 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
13016 __ASM_VTABLE(num_get_short,
13017 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
13018 #if _MSVCP_VER >= 110
13019 VTABLE_ADD_FUNC(locale_facet__Incref)
13020 VTABLE_ADD_FUNC(locale_facet__Decref)
13021 #endif
13022 VTABLE_ADD_FUNC(num_get_short_do_get_void)
13023 VTABLE_ADD_FUNC(num_get_short_do_get_double)
13024 VTABLE_ADD_FUNC(num_get_short_do_get_double)
13025 VTABLE_ADD_FUNC(num_get_short_do_get_float)
13026 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
13027 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
13028 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
13029 VTABLE_ADD_FUNC(num_get_short_do_get_long)
13030 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
13031 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
13032 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
13033 __ASM_VTABLE(num_get_wchar,
13034 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
13035 #if _MSVCP_VER >= 110
13036 VTABLE_ADD_FUNC(locale_facet__Incref)
13037 VTABLE_ADD_FUNC(locale_facet__Decref)
13038 #endif
13039 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
13040 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
13041 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
13042 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
13043 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
13044 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
13045 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
13046 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
13047 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
13048 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
13049 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
13050 __ASM_VTABLE(num_put_char,
13051 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
13052 #if _MSVCP_VER >= 110
13053 VTABLE_ADD_FUNC(locale_facet__Incref)
13054 VTABLE_ADD_FUNC(locale_facet__Decref)
13055 #endif
13056 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
13057 VTABLE_ADD_FUNC(num_put_char_do_put_double)
13058 VTABLE_ADD_FUNC(num_put_char_do_put_double)
13059 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
13060 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
13061 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
13062 VTABLE_ADD_FUNC(num_put_char_do_put_long)
13063 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
13064 __ASM_VTABLE(num_put_wchar,
13065 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
13066 #if _MSVCP_VER >= 110
13067 VTABLE_ADD_FUNC(locale_facet__Incref)
13068 VTABLE_ADD_FUNC(locale_facet__Decref)
13069 #endif
13070 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
13071 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
13072 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
13073 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
13074 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
13075 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
13076 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
13077 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
13078 __ASM_VTABLE(num_put_short,
13079 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
13080 #if _MSVCP_VER >= 110
13081 VTABLE_ADD_FUNC(locale_facet__Incref)
13082 VTABLE_ADD_FUNC(locale_facet__Decref)
13083 #endif
13084 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
13085 VTABLE_ADD_FUNC(num_put_short_do_put_double)
13086 VTABLE_ADD_FUNC(num_put_short_do_put_double)
13087 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
13088 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
13089 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
13090 VTABLE_ADD_FUNC(num_put_short_do_put_long)
13091 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
13092 __ASM_VTABLE(time_put_char,
13093 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
13094 #if _MSVCP_VER >= 110
13095 VTABLE_ADD_FUNC(locale_facet__Incref)
13096 VTABLE_ADD_FUNC(locale_facet__Decref)
13097 #endif
13098 VTABLE_ADD_FUNC(time_put_char_do_put));
13099 __ASM_VTABLE(time_put_wchar,
13100 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
13101 #if _MSVCP_VER >= 110
13102 VTABLE_ADD_FUNC(locale_facet__Incref)
13103 VTABLE_ADD_FUNC(locale_facet__Decref)
13104 #endif
13105 VTABLE_ADD_FUNC(time_put_wchar_do_put));
13106 __ASM_VTABLE(time_put_short,
13107 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
13108 #if _MSVCP_VER >= 110
13109 VTABLE_ADD_FUNC(locale_facet__Incref)
13110 VTABLE_ADD_FUNC(locale_facet__Decref)
13111 #endif
13112 VTABLE_ADD_FUNC(time_put_wchar_do_put));
13113 __ASM_VTABLE(time_get_char,
13114 VTABLE_ADD_FUNC(time_get_char_vector_dtor)
13115 #if _MSVCP_VER >= 110
13116 VTABLE_ADD_FUNC(locale_facet__Incref)
13117 VTABLE_ADD_FUNC(locale_facet__Decref)
13118 #endif
13119 VTABLE_ADD_FUNC(time_get_char_do_date_order)
13120 VTABLE_ADD_FUNC(time_get_char_do_get_time)
13121 VTABLE_ADD_FUNC(time_get_char_do_get_date)
13122 VTABLE_ADD_FUNC(time_get_char_do_get_weekday)
13123 VTABLE_ADD_FUNC(time_get_char_do_get_monthname)
13124 VTABLE_ADD_FUNC(time_get_char_do_get_year)
13125 #if _MSVCP_VER >= 100
13126 VTABLE_ADD_FUNC(time_get_char_do_get)
13127 #endif
13129 __ASM_VTABLE(time_get_wchar,
13130 VTABLE_ADD_FUNC(time_get_wchar_vector_dtor)
13131 #if _MSVCP_VER >= 110
13132 VTABLE_ADD_FUNC(locale_facet__Incref)
13133 VTABLE_ADD_FUNC(locale_facet__Decref)
13134 #endif
13135 VTABLE_ADD_FUNC(time_get_wchar_do_date_order)
13136 VTABLE_ADD_FUNC(time_get_wchar_do_get_time)
13137 VTABLE_ADD_FUNC(time_get_wchar_do_get_date)
13138 VTABLE_ADD_FUNC(time_get_wchar_do_get_weekday)
13139 VTABLE_ADD_FUNC(time_get_wchar_do_get_monthname)
13140 VTABLE_ADD_FUNC(time_get_wchar_do_get_year)
13141 #if _MSVCP_VER >= 100
13142 VTABLE_ADD_FUNC(time_get_wchar_do_get)
13143 #endif
13145 __ASM_BLOCK_END
13147 void init_locale(void *base)
13149 #ifdef __x86_64__
13150 init__Facet_base_rtti(base);
13151 init_locale_facet_rtti(base);
13152 init_locale__Locimp_rtti(base);
13153 init_collate_char_rtti(base);
13154 init_collate_wchar_rtti(base);
13155 init_collate_short_rtti(base);
13156 init_ctype_base_rtti(base);
13157 init_ctype_char_rtti(base);
13158 init_ctype_wchar_rtti(base);
13159 init_ctype_short_rtti(base);
13160 init_codecvt_base_rtti(base);
13161 init_codecvt_char_rtti(base);
13162 init_codecvt_wchar_rtti(base);
13163 init_codecvt_short_rtti(base);
13164 init_numpunct_char_rtti(base);
13165 init_numpunct_wchar_rtti(base);
13166 init_numpunct_short_rtti(base);
13167 init_num_get_char_rtti(base);
13168 init_num_get_wchar_rtti(base);
13169 init_num_get_short_rtti(base);
13170 init_num_put_char_rtti(base);
13171 init_num_put_wchar_rtti(base);
13172 init_num_put_short_rtti(base);
13173 init_time_put_char_rtti(base);
13174 init_time_put_wchar_rtti(base);
13175 init_time_put_short_rtti(base);
13176 init_time_base_rtti(base);
13177 init_time_get_char_rtti(base);
13178 init_time_get_wchar_rtti(base);
13179 #endif
13182 void free_locale(void)
13184 facets_elem *iter, *safe;
13186 if(global_locale) {
13187 locale_dtor(&classic_locale);
13188 locale__Locimp_dtor(global_locale);
13189 MSVCRT_operator_delete(global_locale);
13192 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
13193 list_remove(&iter->entry);
13194 if(call_locale_facet__Decref(iter->fac))
13195 call_locale_facet_vector_dtor(iter->fac, 1);
13196 MSVCRT_operator_delete(iter);