usp10: Fall back to 'dflt' language if shaping language tag isn't found.
[wine.git] / dlls / msvcp90 / locale.c
blob70c3677281442b109c0b19e1fa5d3e6a34134621
1 /*
2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
23 #include "assert.h"
24 #include "locale.h"
25 #include "errno.h"
26 #include "limits.h"
27 #include "math.h"
28 #include "mbctype.h"
29 #include "stdio.h"
30 #include "wchar.h"
31 #include "wctype.h"
32 #include "time.h"
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winnls.h"
36 #include "msvcp90.h"
37 #include "wine/unicode.h"
38 #include "wine/list.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
43 typedef enum {
44 DATEORDER_no_order,
45 DATEORDER_dmy,
46 DATEORDER_mdy,
47 DATEORDER_ymd,
48 DATEORDER_ydm
49 } dateorder;
51 char* __cdecl _Getdays(void);
52 wchar_t* __cdecl _W_Getdays(void);
53 char* __cdecl _Getmonths(void);
54 wchar_t* __cdecl _W_Getmonths(void);
55 void* __cdecl _Gettnames(void);
56 unsigned int __cdecl ___lc_codepage_func(void);
57 int __cdecl ___lc_collate_cp_func(void);
58 const unsigned short* __cdecl __pctype_func(void);
59 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t);
60 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
61 const struct tm*, struct __lc_time_data*);
62 const locale* __cdecl locale_classic(void);
64 #if _MSVCP_VER >= 110
65 wchar_t ** __cdecl ___lc_locale_name_func(void);
66 #else
67 LCID* __cdecl ___lc_handle_func(void);
68 #endif
70 #if _MSVCP_VER < 100
71 #define locale_string basic_string_char
72 #define locale_string_char_ctor(this) MSVCP_basic_string_char_ctor(this)
73 #define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
74 #define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
75 #define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
76 #define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
77 #define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
78 #else
79 #define locale_string _Yarn_char
80 #define locale_string_char_ctor(this) _Yarn_char_ctor(this)
81 #define locale_string_char_ctor_cstr(this,str) _Yarn_char_ctor_cstr(this,str)
82 #define locale_string_char_copy_ctor(this,copy) _Yarn_char_copy_ctor(this,copy)
83 #define locale_string_char_dtor(this) _Yarn_char_dtor(this)
84 #define locale_string_char_c_str(this) _Yarn_char_c_str(this)
85 #define locale_string_char_assign(this,assign) _Yarn_char_op_assign(this,assign)
87 #define locale_string_wchar _Yarn_wchar
88 #define locale_string_wchar_ctor(this) _Yarn_wchar_ctor(this)
89 #define locale_string_wchar_dtor(this) _Yarn_wchar_dtor(this)
90 #define locale_string_wchar_c_str(this) _Yarn_wchar__C_str(this)
91 #define locale_string_wchar_assign(this,str) _Yarn_wchar_op_assign_cstr(this,str)
92 #endif
94 typedef int category;
96 typedef struct {
97 MSVCP_size_t id;
98 } locale_id;
100 typedef struct _locale__Locimp {
101 locale_facet facet;
102 locale_facet **facetvec;
103 MSVCP_size_t facet_cnt;
104 category catmask;
105 MSVCP_bool transparent;
106 locale_string name;
107 } locale__Locimp;
109 typedef struct {
110 void *timeptr;
111 } _Timevec;
113 typedef struct {
114 _Lockit lock;
115 locale_string days;
116 locale_string months;
117 #if _MSVCP_VER >= 110
118 locale_string_wchar wdays;
119 locale_string_wchar wmonths;
120 #endif
121 locale_string oldlocname;
122 locale_string newlocname;
123 } _Locinfo;
125 typedef struct {
126 #if _MSVCP_VER < 110
127 LCID handle;
128 #endif
129 unsigned page;
130 #if _MSVCP_VER >= 110
131 wchar_t *lc_name;
132 #endif
133 } _Collvec;
135 typedef struct {
136 locale_facet facet;
137 _Collvec coll;
138 } collate;
140 typedef struct {
141 locale_facet facet;
142 const char *grouping;
143 char dp;
144 char sep;
145 const char *false_name;
146 const char *true_name;
147 } numpunct_char;
149 typedef struct {
150 locale_facet facet;
151 const char *grouping;
152 wchar_t dp;
153 wchar_t sep;
154 const wchar_t *false_name;
155 const wchar_t *true_name;
156 } numpunct_wchar;
158 typedef struct {
159 locale_facet facet;
160 _Timevec time;
161 #if _MSVCP_VER <= 100
162 _Cvtvec cvt;
163 #endif
164 } time_put;
166 typedef struct {
167 locale_facet facet;
168 const char *days;
169 const char *months;
170 dateorder dateorder;
171 _Cvtvec cvt;
172 } time_get_char;
174 /* ?_Id_cnt@id@locale@std@@0HA */
175 int locale_id__Id_cnt = 0;
177 static locale classic_locale;
179 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
180 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
181 locale__Locimp *global_locale = NULL;
183 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
184 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
185 locale__Locimp *locale__Locimp__Clocptr = NULL;
187 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
189 if(this->strbuf && !this->got) {
190 int c = basic_streambuf_char_sgetc(this->strbuf);
191 if(c == EOF)
192 this->strbuf = NULL;
193 else
194 this->val = c;
197 this->got = TRUE;
198 return this->val;
201 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
203 if(this->strbuf && !this->got) {
204 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
205 if(c == WEOF)
206 this->strbuf = NULL;
207 else
208 this->val = c;
211 this->got = TRUE;
212 return this->val;
215 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
217 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
218 this->strbuf = NULL;
219 this->got = TRUE;
220 }else {
221 this->got = FALSE;
222 istreambuf_iterator_char_val(this);
226 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
228 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
229 this->strbuf = NULL;
230 this->got = TRUE;
231 }else {
232 this->got = FALSE;
233 istreambuf_iterator_wchar_val(this);
237 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
239 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
240 this->failed = TRUE;
243 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
245 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
246 this->failed = TRUE;
249 /* ??1facet@locale@std@@UAE@XZ */
250 /* ??1facet@locale@std@@UEAA@XZ */
251 /* ??1facet@locale@std@@MAA@XZ */
252 /* ??1facet@locale@std@@MAE@XZ */
253 /* ??1facet@locale@std@@MEAA@XZ */
254 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
255 void __thiscall locale_facet_dtor(locale_facet *this)
257 TRACE("(%p)\n", this);
260 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
261 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
262 locale_facet*, (locale_facet*, unsigned int), (this, flags))
263 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
265 TRACE("(%p %x)\n", this, flags);
266 if(flags & 2) {
267 /* we have an array, with the number of elements stored before the first object */
268 INT_PTR i, *ptr = (INT_PTR *)this-1;
270 for(i=*ptr-1; i>=0; i--)
271 locale_facet_dtor(this+i);
272 MSVCRT_operator_delete(ptr);
273 } else {
274 locale_facet_dtor(this);
275 if(flags & 1)
276 MSVCRT_operator_delete(this);
279 return this;
282 typedef struct
284 locale_facet *fac;
285 struct list entry;
286 } facets_elem;
287 static struct list lazy_facets = LIST_INIT(lazy_facets);
289 /* Not exported from msvcp90 */
290 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
291 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
292 void __cdecl locale_facet_register(locale_facet *add)
294 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
295 if(!head) {
296 ERR("Out of memory\n");
297 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
300 head->fac = add;
301 list_add_head(&lazy_facets, &head->entry);
304 /* Not exported from msvcp90 */
305 /* ?_Register@facet@locale@std@@QAEXXZ */
306 /* ?_Register@facet@locale@std@@QEAAXXZ */
307 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
308 void __thiscall locale_facet__Register(locale_facet *this)
310 TRACE("(%p)\n", this);
311 locale_facet_register(this);
314 /* Not exported from msvcp90 */
315 /* ??_7facet@locale@std@@6B@ */
316 extern const vtable_ptr MSVCP_locale_facet_vtable;
318 /* ??0id@locale@std@@QAE@I@Z */
319 /* ??0id@locale@std@@QEAA@_K@Z */
320 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
321 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
323 TRACE("(%p %lu)\n", this, id);
325 this->id = id;
326 return this;
329 /* ??_Fid@locale@std@@QAEXXZ */
330 /* ??_Fid@locale@std@@QEAAXXZ */
331 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
332 locale_id* __thiscall locale_id_ctor(locale_id *this)
334 TRACE("(%p)\n", this);
336 this->id = 0;
337 return this;
340 /* ??Bid@locale@std@@QAEIXZ */
341 /* ??Bid@locale@std@@QEAA_KXZ */
342 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
343 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
345 _Lockit lock;
347 TRACE("(%p)\n", this);
349 if(!this->id) {
350 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
351 this->id = ++locale_id__Id_cnt;
352 _Lockit_dtor(&lock);
355 return this->id;
358 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
359 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
360 int* __cdecl locale_id__Id_cnt_func(void)
362 TRACE("\n");
363 return &locale_id__Id_cnt;
366 /* ??_Ffacet@locale@std@@QAEXXZ */
367 /* ??_Ffacet@locale@std@@QEAAXXZ */
368 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
369 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
371 TRACE("(%p)\n", this);
372 this->vtable = &MSVCP_locale_facet_vtable;
373 this->refs = 0;
374 return this;
377 /* ??0facet@locale@std@@IAE@I@Z */
378 /* ??0facet@locale@std@@IEAA@_K@Z */
379 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
380 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
382 TRACE("(%p %lu)\n", this, refs);
383 this->vtable = &MSVCP_locale_facet_vtable;
384 this->refs = refs;
385 return this;
388 /* ?_Incref@facet@locale@std@@QAEXXZ */
389 /* ?_Incref@facet@locale@std@@QEAAXXZ */
390 /* ?_Incref@facet@locale@std@@UAEXXZ */
391 /* ?_Incref@facet@locale@std@@UEAAXXZ */
392 #if _MSVCP_VER >= 110
393 #define call_locale_facet__Incref(this) CALL_VTBL_FUNC(this, 4, void, (locale_facet*), (this))
394 #else
395 #define call_locale_facet__Incref locale_facet__Incref
396 #endif
397 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
398 void __thiscall locale_facet__Incref(locale_facet *this)
400 _Lockit lock;
402 TRACE("(%p)\n", this);
404 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
405 this->refs++;
406 _Lockit_dtor(&lock);
409 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
410 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
411 /* ?_Decref@facet@locale@std@@UAEPAV_Facet_base@3@XZ */
412 /* ?_Decref@facet@locale@std@@UEAAPEAV_Facet_base@3@XZ */
413 #if _MSVCP_VER >= 110
414 #define call_locale_facet__Decref(this) CALL_VTBL_FUNC(this, 8, \
415 locale_facet*, (locale_facet*), (this))
416 #else
417 #define call_locale_facet__Decref locale_facet__Decref
418 #endif
419 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
420 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
422 _Lockit lock;
423 locale_facet *ret;
425 TRACE("(%p)\n", this);
427 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
428 if(this->refs)
429 this->refs--;
431 ret = this->refs ? NULL : this;
432 _Lockit_dtor(&lock);
434 return ret;
437 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
438 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
439 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
441 TRACE("(%p %p)\n", facet, loc);
442 return -1;
445 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@@Z */
446 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@@Z */
447 MSVCP_size_t __cdecl locale_facet__Getcat_old(const locale_facet **facet)
449 TRACE("(%p)\n", facet);
450 return -1;
453 /* ??0_Timevec@std@@QAE@ABV01@@Z */
454 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
455 /* This copy constructor modifies copied object */
456 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
457 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
459 TRACE("(%p %p)\n", this, copy);
460 this->timeptr = copy->timeptr;
461 copy->timeptr = NULL;
462 return this;
465 /* ??0_Timevec@std@@QAE@PAX@Z */
466 /* ??0_Timevec@std@@QEAA@PEAX@Z */
467 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
468 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
470 TRACE("(%p %p)\n", this, timeptr);
471 this->timeptr = timeptr;
472 return this;
475 /* ??_F_Timevec@std@@QAEXXZ */
476 /* ??_F_Timevec@std@@QEAAXXZ */
477 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
478 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
480 TRACE("(%p)\n", this);
481 this->timeptr = NULL;
482 return this;
485 /* ??1_Timevec@std@@QAE@XZ */
486 /* ??1_Timevec@std@@QEAA@XZ */
487 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
488 void __thiscall _Timevec_dtor(_Timevec *this)
490 TRACE("(%p)\n", this);
491 free(this->timeptr);
494 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
495 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
496 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
497 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
499 TRACE("(%p %p)\n", this, right);
500 this->timeptr = right->timeptr;
501 right->timeptr = NULL;
502 return this;
505 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
506 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
507 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
508 void* __thiscall _Timevec__Getptr(_Timevec *this)
510 TRACE("(%p)\n", this);
511 return this->timeptr;
514 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
515 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
516 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
518 const char *locale = NULL;
520 /* This function is probably modifying more global objects */
521 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
523 if(!locstr)
524 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
526 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
527 locale_string_char_ctor(&locinfo->days);
528 locale_string_char_ctor(&locinfo->months);
529 #if _MSVCP_VER >= 110
530 locale_string_wchar_ctor(&locinfo->wdays);
531 locale_string_wchar_ctor(&locinfo->wmonths);
532 #endif
533 locale_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
535 if(category)
536 locale = setlocale(LC_ALL, locstr);
537 else
538 locale = setlocale(LC_ALL, NULL);
540 if(locale)
541 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
542 else
543 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
545 return locinfo;
548 /* ??0_Locinfo@std@@QAE@HPBD@Z */
549 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
550 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
551 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
553 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
556 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
557 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
558 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
560 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
563 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
564 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
565 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
566 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
568 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
571 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
572 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
573 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
575 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
578 /* ??0_Locinfo@std@@QAE@PBD@Z */
579 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
580 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
581 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
583 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
586 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
587 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
588 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
590 TRACE("(%p)\n", locinfo);
592 setlocale(LC_ALL, locale_string_char_c_str(&locinfo->oldlocname));
593 locale_string_char_dtor(&locinfo->days);
594 locale_string_char_dtor(&locinfo->months);
595 #if _MSVCP_VER >= 110
596 locale_string_wchar_dtor(&locinfo->wdays);
597 locale_string_wchar_dtor(&locinfo->wmonths);
598 #endif
599 locale_string_char_dtor(&locinfo->oldlocname);
600 locale_string_char_dtor(&locinfo->newlocname);
601 _Lockit_dtor(&locinfo->lock);
604 /* ??_F_Locinfo@std@@QAEXXZ */
605 /* ??_F_Locinfo@std@@QEAAXXZ */
606 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
607 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
609 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
612 /* ??1_Locinfo@std@@QAE@XZ */
613 /* ??1_Locinfo@std@@QEAA@XZ */
614 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
615 void __thiscall _Locinfo_dtor(_Locinfo *this)
617 _Locinfo__Locinfo_dtor(this);
620 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
621 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
622 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
624 const char *locale = NULL;
626 /* This function is probably modifying more global objects */
627 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
628 if(!locstr)
629 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
631 locale_string_char_dtor(&locinfo->newlocname);
633 if(category)
634 locale = setlocale(LC_ALL, locstr);
635 else
636 locale = setlocale(LC_ALL, NULL);
638 if(locale)
639 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
640 else
641 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
643 return locinfo;
646 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
647 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
648 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
649 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
651 return _Locinfo__Locinfo_Addcats(this, category, locstr);
654 static _Collvec* getcoll(_Collvec *ret)
656 TRACE("\n");
658 ret->page = ___lc_collate_cp_func();
659 #if _MSVCP_VER < 110
660 ret->handle = ___lc_handle_func()[LC_COLLATE];
661 #else
662 ret->lc_name = ___lc_locale_name_func()[LC_COLLATE];
663 #endif
664 return ret;
667 /* _Getcoll */
668 #if defined(__i386__) || _MSVCP_VER<110
669 ULONGLONG __cdecl _Getcoll(void)
671 ULONGLONG ret;
673 C_ASSERT(sizeof(_Collvec) <= sizeof(ULONGLONG));
675 getcoll((_Collvec*)&ret);
676 return ret;
678 #else
679 _Collvec* __cdecl _Getcoll(_Collvec *ret)
681 return getcoll(ret);
683 #endif
685 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
686 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
687 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
688 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
690 return getcoll(ret);
693 /* _Getctype */
694 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
696 short *table;
697 #if _MSVCP_VER >= 110
698 wchar_t *name;
699 MSVCP_size_t size;
700 #endif
702 TRACE("\n");
704 ret->page = ___lc_codepage_func();
705 #if _MSVCP_VER < 110
706 ret->handle = ___lc_handle_func()[LC_COLLATE];
707 #else
708 if((name = ___lc_locale_name_func()[LC_COLLATE])) {
709 size = wcslen(name)+1;
710 ret->name = malloc(size*sizeof(*name));
711 if(!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
712 memcpy(ret->name, name, size*sizeof(*name));
713 } else {
714 ret->name = NULL;
716 #endif
717 ret->delfl = TRUE;
718 table = malloc(sizeof(short[256]));
719 if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
720 memcpy(table, __pctype_func(), sizeof(short[256]));
721 ret->table = table;
722 return ret;
725 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
726 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
727 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
728 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
730 return _Getctype(ret);
733 /* _Getcvt */
734 #if _MSVCP_VER < 110
735 ULONGLONG __cdecl _Getcvt(void)
737 union {
738 _Cvtvec cvtvec;
739 ULONGLONG ull;
740 } ret;
742 TRACE("\n");
744 ret.cvtvec.page = ___lc_codepage_func();
745 ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
746 return ret.ull;
748 #else
749 _Cvtvec* __cdecl _Getcvt(_Cvtvec *ret)
751 int i;
753 TRACE("\n");
755 memset(ret, 0, sizeof(*ret));
756 ret->page = ___lc_codepage_func();
757 ret->mb_max = ___mb_cur_max_func();
759 if(ret->mb_max > 1) {
760 for(i=0; i<256; i++)
761 if(_ismbblead(i)) ret->isleadbyte[i/8] |= 1 << (i&7);
763 return ret;
765 #endif
767 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
768 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
769 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
770 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
772 #if _MSVCP_VER < 110
773 ULONGLONG ull = _Getcvt();
774 memcpy(ret, &ull, sizeof(ull));
775 #else
776 _Cvtvec cvtvec;
777 _Getcvt(&cvtvec);
778 memcpy(ret, &cvtvec, sizeof(cvtvec));
779 #endif
780 return ret;
783 int __cdecl _Getdateorder(void)
785 WCHAR date_fmt[2];
787 #if _MSVCP_VER < 110
788 if(!GetLocaleInfoW(___lc_handle_func()[LC_TIME], LOCALE_ILDATE,
789 date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
790 return DATEORDER_no_order;
791 #else
792 if(!GetLocaleInfoEx(___lc_locale_name_func()[LC_TIME], LOCALE_ILDATE,
793 date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
794 return DATEORDER_no_order;
795 #endif
797 if(*date_fmt == '0') return DATEORDER_mdy;
798 if(*date_fmt == '1') return DATEORDER_dmy;
799 if(*date_fmt == '2') return DATEORDER_ymd;
800 return DATEORDER_no_order;
803 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
804 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
805 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
806 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
808 TRACE("(%p)\n", this);
809 return _Getdateorder();
812 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
813 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
814 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
815 const char* __thiscall _Locinfo__Getdays(const _Locinfo *this)
817 char *days = _Getdays();
818 const char *ret;
820 TRACE("(%p)\n", this);
822 if(days) {
823 locale_string_char_dtor((locale_string *)&this->days);
824 locale_string_char_ctor_cstr((locale_string *)&this->days, days);
825 free(days);
828 ret = locale_string_char_c_str(&this->days);
829 if (!ret[0]) ret = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
830 return ret;
833 #if _MSVCP_VER >= 110
834 /* ?_W_Getdays@_Locinfo@std@@QBEPBGXZ */
835 /* ?_W_Getdays@_Locinfo@std@@QEBAPEBGXZ */
836 DEFINE_THISCALL_WRAPPER(_Locinfo__W_Getdays, 4)
837 const wchar_t* __thiscall _Locinfo__W_Getdays(const _Locinfo *this)
839 static const wchar_t defdays[] =
841 ':','S','u','n',':','S','u','n','d','a','y',
842 ':','M','o','n',':','M','o','n','d','a','y',
843 ':','T','u','e',':','T','u','e','s','d','a','y',
844 ':','W','e','d',':','W','e','d','n','e','s','d','a','y',
845 ':','T','h','u',':','T','h','u','r','s','d','a','y',
846 ':','F','r','i',':','F','r','i','d','a','y',
847 ':','S','a','t',':','S','a','t','u','r','d','a','y'
849 wchar_t *wdays = _W_Getdays();
850 const wchar_t *ret;
852 TRACE("(%p)\n", this);
854 if(wdays) {
855 locale_string_wchar_assign((locale_string_wchar *)&this->wdays, wdays);
856 free(wdays);
859 ret = locale_string_wchar_c_str(&this->wdays);
860 if (!ret[0]) ret = defdays;
861 return ret;
864 /* ?_W_Getmonths@_Locinfo@std@@QBEPBGXZ */
865 /* ?_W_Getmonths@_Locinfo@std@@QEBAPEBGXZ */
866 DEFINE_THISCALL_WRAPPER(_Locinfo__W_Getmonths, 4)
867 const wchar_t* __thiscall _Locinfo__W_Getmonths(const _Locinfo *this)
869 static const wchar_t defmonths[] =
871 ':','J','a','n',':','J','a','n','u','a','r','y',
872 ':','F','e','b',':','F','e','b','r','u','a','r','y',
873 ':','M','a','r',':','M','a','r','c','h',
874 ':','A','p','r',':','A','p','r','i','l',
875 ':','M','a','y',':','M','a','y',
876 ':','J','u','n',':','J','u','n','e',
877 ':','J','u','l',':','J','u','l','y',
878 ':','A','u','g',':','A','u','g','u','s','t',
879 ':','S','e','p',':','S','e','p','t','e','m','b','e','r',
880 ':','O','c','t',':','O','c','t','o','b','e','r',
881 ':','N','o','v',':','N','o','v','e','m','b','e','r',
882 ':','D','e','c',':','D','e','c','e','m','b','e','r'
884 wchar_t *wmonths = _W_Getmonths();
885 const wchar_t *ret;
887 TRACE("(%p)\n", this);
889 if(wmonths) {
890 locale_string_wchar_assign((locale_string_wchar *)&this->wmonths, wmonths);
891 free(wmonths);
894 ret = locale_string_wchar_c_str(&this->wmonths);
895 if (!ret[0]) ret = defmonths;
896 return ret;
898 #endif
900 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
901 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
902 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
903 const char* __thiscall _Locinfo__Getmonths(const _Locinfo *this)
905 char *months = _Getmonths();
906 const char *ret;
908 TRACE("(%p)\n", this);
910 if(months) {
911 locale_string_char_dtor((locale_string *)&this->months);
912 locale_string_char_ctor_cstr((locale_string *)&this->months, months);
913 free(months);
916 ret = locale_string_char_c_str(&this->months);
917 if (!ret[0]) ret = ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
918 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
919 return ret;
922 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
923 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
924 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
925 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
927 TRACE("(%p)\n", this);
928 return "false";
931 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
932 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
933 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
934 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
936 TRACE("(%p)\n", this);
937 return "true";
940 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
941 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
942 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
943 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
945 TRACE("(%p)\n", this);
946 return localeconv();
949 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
950 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
951 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
952 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
954 TRACE("(%p)\n", this);
956 _Timevec_ctor_timeptr(ret, _Gettnames());
957 return ret;
960 /* ?id@?$collate@D@std@@2V0locale@2@A */
961 locale_id collate_char_id = {0};
963 /* ??_7?$collate@D@std@@6B@ */
964 extern const vtable_ptr MSVCP_collate_char_vtable;
966 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
967 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
968 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
969 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
971 TRACE("(%p %p)\n", this, locinfo);
972 _Locinfo__Getcoll(locinfo, &this->coll);
975 /* ??0?$collate@D@std@@IAE@PBDI@Z */
976 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
977 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
978 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
980 _Locinfo locinfo;
982 TRACE("(%p %s %lu)\n", this, name, refs);
984 locale_facet_ctor_refs(&this->facet, refs);
985 this->facet.vtable = &MSVCP_collate_char_vtable;
987 _Locinfo_ctor_cstr(&locinfo, name);
988 collate_char__Init(this, &locinfo);
989 _Locinfo_dtor(&locinfo);
990 return this;
993 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
994 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
995 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
996 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
998 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1000 locale_facet_ctor_refs(&this->facet, refs);
1001 this->facet.vtable = &MSVCP_collate_char_vtable;
1002 collate_char__Init(this, locinfo);
1003 return this;
1006 /* ??0?$collate@D@std@@QAE@I@Z */
1007 /* ??0?$collate@D@std@@QEAA@_K@Z */
1008 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
1009 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
1011 return collate_char_ctor_name(this, "C", refs);
1014 /* ??1?$collate@D@std@@UAE@XZ */
1015 /* ??1?$collate@D@std@@UEAA@XZ */
1016 /* ??1?$collate@D@std@@MAE@XZ */
1017 /* ??1?$collate@D@std@@MEAA@XZ */
1018 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
1019 void __thiscall collate_char_dtor(collate *this)
1021 TRACE("(%p)\n", this);
1024 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
1025 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
1027 TRACE("(%p %x)\n", this, flags);
1028 if(flags & 2) {
1029 /* we have an array, with the number of elements stored before the first object */
1030 INT_PTR i, *ptr = (INT_PTR *)this-1;
1032 for(i=*ptr-1; i>=0; i--)
1033 collate_char_dtor(this+i);
1034 MSVCRT_operator_delete(ptr);
1035 } else {
1036 collate_char_dtor(this);
1037 if(flags & 1)
1038 MSVCRT_operator_delete(this);
1041 return this;
1044 /* ??_F?$collate@D@std@@QAEXXZ */
1045 /* ??_F?$collate@D@std@@QEAAXXZ */
1046 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
1047 collate* __thiscall collate_char_ctor(collate *this)
1049 return collate_char_ctor_name(this, "C", 0);
1052 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1053 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1054 MSVCP_size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
1056 TRACE("(%p %p)\n", facet, loc);
1058 if(facet && !*facet) {
1059 *facet = MSVCRT_operator_new(sizeof(collate));
1060 if(!*facet) {
1061 ERR("Out of memory\n");
1062 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1063 return 0;
1065 collate_char_ctor_name((collate*)*facet,
1066 locale_string_char_c_str(&loc->ptr->name), 0);
1069 return LC_COLLATE;
1072 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@@Z */
1073 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1074 MSVCP_size_t __cdecl collate_char__Getcat_old(const locale_facet **facet)
1076 return collate_char__Getcat(facet, locale_classic());
1079 static collate* collate_char_use_facet(const locale *loc)
1081 static collate *obj = NULL;
1083 _Lockit lock;
1084 const locale_facet *fac;
1086 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1087 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id));
1088 if(fac) {
1089 _Lockit_dtor(&lock);
1090 return (collate*)fac;
1093 if(obj) {
1094 _Lockit_dtor(&lock);
1095 return obj;
1098 collate_char__Getcat(&fac, loc);
1099 obj = (collate*)fac;
1100 call_locale_facet__Incref(&obj->facet);
1101 locale_facet_register(&obj->facet);
1102 _Lockit_dtor(&lock);
1104 return obj;
1107 /* _Strcoll */
1108 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
1109 const char *last2, const _Collvec *coll)
1111 LCID lcid;
1113 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
1115 #if _MSVCP_VER < 110
1116 lcid = (coll ? coll->handle : ___lc_handle_func()[LC_COLLATE]);
1117 #else
1118 lcid = LocaleNameToLCID(coll ? coll->lc_name : ___lc_locale_name_func()[LC_COLLATE], 0);
1119 #endif
1120 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1123 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
1124 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
1125 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
1126 #if _MSVCP_VER <= 100
1127 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1128 (const collate*, const char*, const char*, const char*, const char*), \
1129 (this, first1, last1, first2, last2))
1130 #else
1131 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1132 (const collate*, const char*, const char*, const char*, const char*), \
1133 (this, first1, last1, first2, last2))
1134 #endif
1135 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
1136 const char *last1, const char *first2, const char *last2)
1138 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1139 return _Strcoll(first1, last1, first2, last2, &this->coll);
1142 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
1143 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
1144 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
1145 int __thiscall collate_char_compare(const collate *this, const char *first1,
1146 const char *last1, const char *first2, const char *last2)
1148 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1149 return call_collate_char_do_compare(this, first1, last1, first2, last2);
1152 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
1153 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
1154 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
1155 #if _MSVCP_VER <= 100
1156 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1157 (const collate*, const char*, const char*), (this, first, last))
1158 #else
1159 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1160 (const collate*, const char*, const char*), (this, first, last))
1161 #endif
1162 LONG __thiscall collate_char_do_hash(const collate *this,
1163 const char *first, const char *last)
1165 ULONG ret = 0;
1167 TRACE("(%p %p %p)\n", this, first, last);
1169 for(; first<last; first++)
1170 ret = (ret<<8 | ret>>24) + *first;
1171 return ret;
1174 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
1175 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
1176 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
1177 LONG __thiscall collate_char_hash(const collate *this,
1178 const char *first, const char *last)
1180 TRACE("(%p %p %p)\n", this, first, last);
1181 return call_collate_char_do_hash(this, first, last);
1184 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1185 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1186 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
1187 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
1188 basic_string_char *ret, const char *first, const char *last)
1190 FIXME("(%p %p %p) stub\n", this, first, last);
1191 return ret;
1194 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1195 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1196 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
1197 basic_string_char* __thiscall collate_char_transform(const collate *this,
1198 basic_string_char *ret, const char *first, const char *last)
1200 FIXME("(%p %p %p) stub\n", this, first, last);
1201 return ret;
1204 /* ?id@?$collate@_W@std@@2V0locale@2@A */
1205 locale_id collate_wchar_id = {0};
1206 /* ?id@?$collate@G@std@@2V0locale@2@A */
1207 locale_id collate_short_id = {0};
1209 /* ??_7?$collate@_W@std@@6B@ */
1210 extern const vtable_ptr MSVCP_collate_wchar_vtable;
1211 /* ??_7?$collate@G@std@@6B@ */
1212 extern const vtable_ptr MSVCP_collate_short_vtable;
1214 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
1215 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1216 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
1217 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1218 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
1219 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
1221 TRACE("(%p %p)\n", this, locinfo);
1222 _Locinfo__Getcoll(locinfo, &this->coll);
1225 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
1226 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
1227 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
1228 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1230 _Locinfo locinfo;
1232 TRACE("(%p %s %lu)\n", this, name, refs);
1234 locale_facet_ctor_refs(&this->facet, refs);
1235 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1237 _Locinfo_ctor_cstr(&locinfo, name);
1238 collate_wchar__Init(this, &locinfo);
1239 _Locinfo_dtor(&locinfo);
1240 return this;
1243 /* ??0?$collate@G@std@@IAE@PBDI@Z */
1244 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
1245 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
1246 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1248 collate *ret = collate_wchar_ctor_name(this, name, refs);
1249 ret->facet.vtable = &MSVCP_collate_short_vtable;
1250 return ret;
1253 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1254 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1255 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
1256 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1258 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1260 locale_facet_ctor_refs(&this->facet, refs);
1261 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1262 collate_wchar__Init(this, locinfo);
1263 return this;
1266 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
1267 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1268 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
1269 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1271 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
1272 ret->facet.vtable = &MSVCP_collate_short_vtable;
1273 return ret;
1276 /* ??0?$collate@_W@std@@QAE@I@Z */
1277 /* ??0?$collate@_W@std@@QEAA@_K@Z */
1278 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
1279 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
1281 return collate_wchar_ctor_name(this, "C", refs);
1284 /* ??0?$collate@G@std@@QAE@I@Z */
1285 /* ??0?$collate@G@std@@QEAA@_K@Z */
1286 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1287 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
1289 collate *ret = collate_wchar_ctor_refs(this, refs);
1290 ret->facet.vtable = &MSVCP_collate_short_vtable;
1291 return ret;
1294 /* ??1?$collate@G@std@@UAE@XZ */
1295 /* ??1?$collate@G@std@@UEAA@XZ */
1296 /* ??1?$collate@_W@std@@MAE@XZ */
1297 /* ??1?$collate@_W@std@@MEAA@XZ */
1298 /* ??1?$collate@G@std@@MAE@XZ */
1299 /* ??1?$collate@G@std@@MEAA@XZ */
1300 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1301 void __thiscall collate_wchar_dtor(collate *this)
1303 TRACE("(%p)\n", this);
1306 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1307 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1309 TRACE("(%p %x)\n", this, flags);
1310 if(flags & 2) {
1311 /* we have an array, with the number of elements stored before the first object */
1312 INT_PTR i, *ptr = (INT_PTR *)this-1;
1314 for(i=*ptr-1; i>=0; i--)
1315 collate_wchar_dtor(this+i);
1316 MSVCRT_operator_delete(ptr);
1317 } else {
1318 collate_wchar_dtor(this);
1319 if(flags & 1)
1320 MSVCRT_operator_delete(this);
1323 return this;
1326 /* ??_F?$collate@_W@std@@QAEXXZ */
1327 /* ??_F?$collate@_W@std@@QEAAXXZ */
1328 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1329 collate* __thiscall collate_wchar_ctor(collate *this)
1331 return collate_wchar_ctor_name(this, "C", 0);
1334 /* ??_F?$collate@G@std@@QAEXXZ */
1335 /* ??_F?$collate@G@std@@QEAAXXZ */
1336 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1337 collate* __thiscall collate_short_ctor(collate *this)
1339 collate *ret = collate_wchar_ctor(this);
1340 ret->facet.vtable = &MSVCP_collate_short_vtable;
1341 return ret;
1344 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1345 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1346 MSVCP_size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1348 TRACE("(%p %p)\n", facet, loc);
1350 if(facet && !*facet) {
1351 *facet = MSVCRT_operator_new(sizeof(collate));
1352 if(!*facet) {
1353 ERR("Out of memory\n");
1354 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1355 return 0;
1357 collate_wchar_ctor_name((collate*)*facet,
1358 locale_string_char_c_str(&loc->ptr->name), 0);
1361 return LC_COLLATE;
1364 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@@Z */
1365 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1366 MSVCP_size_t __cdecl collate_wchar__Getcat_old(const locale_facet **facet)
1368 return collate_wchar__Getcat(facet, locale_classic());
1371 static collate* collate_wchar_use_facet(const locale *loc)
1373 static collate *obj = NULL;
1375 _Lockit lock;
1376 const locale_facet *fac;
1378 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1379 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id));
1380 if(fac) {
1381 _Lockit_dtor(&lock);
1382 return (collate*)fac;
1385 if(obj) {
1386 _Lockit_dtor(&lock);
1387 return obj;
1390 collate_wchar__Getcat(&fac, loc);
1391 obj = (collate*)fac;
1392 call_locale_facet__Incref(&obj->facet);
1393 locale_facet_register(&obj->facet);
1394 _Lockit_dtor(&lock);
1396 return obj;
1399 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1400 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1401 MSVCP_size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1403 if(facet && !*facet) {
1404 collate_wchar__Getcat(facet, loc);
1405 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1408 return LC_COLLATE;
1411 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@@Z */
1412 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1413 MSVCP_size_t __cdecl collate_short__Getcat_old(const locale_facet **facet)
1415 return collate_short__Getcat(facet, locale_classic());
1418 static collate* collate_short_use_facet(const locale *loc)
1420 static collate *obj = NULL;
1422 _Lockit lock;
1423 const locale_facet *fac;
1425 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1426 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id));
1427 if(fac) {
1428 _Lockit_dtor(&lock);
1429 return (collate*)fac;
1432 if(obj) {
1433 _Lockit_dtor(&lock);
1434 return obj;
1437 collate_short__Getcat(&fac, loc);
1438 obj = (collate*)fac;
1439 call_locale_facet__Incref(&obj->facet);
1440 locale_facet_register(&obj->facet);
1441 _Lockit_dtor(&lock);
1443 return obj;
1446 /* _Wcscoll */
1447 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1448 const wchar_t *last2, const _Collvec *coll)
1450 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1452 #if _MSVCP_VER < 110
1453 return CompareStringW(coll ? coll->handle : ___lc_handle_func()[LC_COLLATE],
1454 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1455 #else
1456 return CompareStringEx(coll ? coll->lc_name : ___lc_locale_name_func()[LC_COLLATE],
1457 0, first1, last1-first1, first2, last2-first2, NULL, NULL, 0)-CSTR_EQUAL;
1458 #endif
1461 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1462 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1463 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1464 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1465 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1466 #if _MSVCP_VER <= 100
1467 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1468 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1469 (this, first1, last1, first2, last2))
1470 #else
1471 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1472 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1473 (this, first1, last1, first2, last2))
1474 #endif
1475 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1476 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1478 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1479 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1482 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1483 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1484 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1485 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1486 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1487 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1488 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1490 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1491 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1494 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1495 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1496 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1497 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1498 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1499 #if _MSVCP_VER <= 100
1500 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1501 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1502 #else
1503 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1504 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1505 #endif
1506 LONG __thiscall collate_wchar_do_hash(const collate *this,
1507 const wchar_t *first, const wchar_t *last)
1509 ULONG ret = 0;
1511 TRACE("(%p %p %p)\n", this, first, last);
1513 for(; first<last; first++)
1514 ret = (ret<<8 | ret>>24) + *first;
1515 return ret;
1518 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1519 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1520 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1521 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1522 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1523 LONG __thiscall collate_wchar_hash(const collate *this,
1524 const wchar_t *first, const wchar_t *last)
1526 TRACE("(%p %p %p)\n", this, first, last);
1527 return call_collate_wchar_do_hash(this, first, last);
1530 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1531 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1532 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1533 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1534 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1535 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1536 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1538 FIXME("(%p %p %p) stub\n", this, first, last);
1539 return ret;
1542 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1543 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1544 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1545 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1546 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1547 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1548 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1550 FIXME("(%p %p %p) stub\n", this, first, last);
1551 return ret;
1554 /* ??_7ctype_base@std@@6B@ */
1555 extern const vtable_ptr MSVCP_ctype_base_vtable;
1557 /* ??0ctype_base@std@@QAE@I@Z */
1558 /* ??0ctype_base@std@@QEAA@_K@Z */
1559 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1560 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1562 TRACE("(%p %lu)\n", this, refs);
1563 locale_facet_ctor_refs(&this->facet, refs);
1564 this->facet.vtable = &MSVCP_ctype_base_vtable;
1565 return this;
1568 /* ??_Fctype_base@std@@QAEXXZ */
1569 /* ??_Fctype_base@std@@QEAAXXZ */
1570 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1571 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1573 TRACE("(%p)\n", this);
1574 locale_facet_ctor_refs(&this->facet, 0);
1575 this->facet.vtable = &MSVCP_ctype_base_vtable;
1576 return this;
1579 /* ??1ctype_base@std@@UAE@XZ */
1580 /* ??1ctype_base@std@@UEAA@XZ */
1581 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1582 void __thiscall ctype_base_dtor(ctype_base *this)
1584 TRACE("(%p)\n", this);
1587 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1588 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1590 TRACE("(%p %x)\n", this, flags);
1591 if(flags & 2) {
1592 /* we have an array, with the number of elements stored before the first object */
1593 INT_PTR i, *ptr = (INT_PTR *)this-1;
1595 for(i=*ptr-1; i>=0; i--)
1596 ctype_base_dtor(this+i);
1597 MSVCRT_operator_delete(ptr);
1598 } else {
1599 ctype_base_dtor(this);
1600 if(flags & 1)
1601 MSVCRT_operator_delete(this);
1604 return this;
1607 /* ?_Xran@ctype_base@std@@KAXXZ */
1608 void __cdecl ctype_base__Xran(void)
1610 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1613 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1614 locale_id ctype_char_id = {0};
1615 /* ?table_size@?$ctype@D@std@@2IB */
1616 /* ?table_size@?$ctype@D@std@@2_KB */
1617 MSVCP_size_t ctype_char_table_size = 256;
1619 /* ??_7?$ctype@D@std@@6B@ */
1620 extern const vtable_ptr MSVCP_ctype_char_vtable;
1622 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1623 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1624 locale_id* __cdecl ctype_char__Id_func(void)
1626 TRACE("()\n");
1627 return &ctype_char_id;
1630 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1631 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1632 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1633 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1635 TRACE("(%p %p)\n", this, locinfo);
1636 _Locinfo__Getctype(locinfo, &this->ctype);
1639 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1640 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1641 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1642 void __thiscall ctype_char__Tidy(ctype_char *this)
1644 TRACE("(%p)\n", this);
1646 if(this->ctype.delfl)
1647 free((short*)this->ctype.table);
1648 #if _MSVCP_VER >= 110
1649 free(this->ctype.name);
1650 #endif
1653 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1654 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1655 const short* __cdecl ctype_char_classic_table(void)
1657 ctype_char *ctype;
1659 TRACE("()\n");
1660 ctype = ctype_char_use_facet( locale_classic() );
1661 return ctype->ctype.table;
1664 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1665 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1666 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1667 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1668 const _Locinfo *locinfo, MSVCP_size_t refs)
1670 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1671 ctype_base_ctor_refs(&this->base, refs);
1672 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1673 ctype_char__Init(this, locinfo);
1674 return this;
1677 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1678 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1679 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1680 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1681 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1683 _Locinfo locinfo;
1685 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1687 ctype_base_ctor_refs(&this->base, refs);
1688 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1690 _Locinfo_ctor(&locinfo);
1691 ctype_char__Init(this, &locinfo);
1692 _Locinfo_dtor(&locinfo);
1694 if(table) {
1695 ctype_char__Tidy(this);
1696 this->ctype.table = table;
1697 this->ctype.delfl = delete;
1699 return this;
1702 /* ??_F?$ctype@D@std@@QAEXXZ */
1703 /* ??_F?$ctype@D@std@@QEAAXXZ */
1704 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1705 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1707 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1710 /* ??1?$ctype@D@std@@UAE@XZ */
1711 /* ??1?$ctype@D@std@@UEAA@XZ */
1712 /* ??1?$ctype@D@std@@MAE@XZ */
1713 /* ??1?$ctype@D@std@@MEAA@XZ */
1714 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1715 void __thiscall ctype_char_dtor(ctype_char *this)
1717 TRACE("(%p)\n", this);
1718 ctype_char__Tidy(this);
1721 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1722 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1724 TRACE("(%p %x)\n", this, flags);
1725 if(flags & 2) {
1726 /* we have an array, with the number of elements stored before the first object */
1727 INT_PTR i, *ptr = (INT_PTR *)this-1;
1729 for(i=*ptr-1; i>=0; i--)
1730 ctype_char_dtor(this+i);
1731 MSVCRT_operator_delete(ptr);
1732 } else {
1733 ctype_char_dtor(this);
1734 if(flags & 1)
1735 MSVCRT_operator_delete(this);
1738 return this;
1741 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1742 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1743 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1744 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1745 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1746 char, (const ctype_char*, char, char), (this, ch, unused))
1747 #elif _MSVCP_VER <= 100
1748 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1749 char, (const ctype_char*, char, char), (this, ch, unused))
1750 #else
1751 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 40, \
1752 char, (const ctype_char*, char, char), (this, ch, unused))
1753 #endif
1754 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1756 TRACE("(%p %c %c)\n", this, ch, unused);
1757 return ch;
1760 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1761 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1762 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1763 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1764 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1765 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1766 (this, first, last, unused, dest))
1767 #elif _MSVCP_VER <= 100
1768 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1769 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1770 (this, first, last, unused, dest))
1771 #else
1772 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 36, \
1773 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1774 (this, first, last, unused, dest))
1775 #endif
1776 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1777 const char *first, const char *last, char unused, char *dest)
1779 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1780 memcpy(dest, first, last-first);
1781 return last;
1784 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1785 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1786 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1787 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1788 const char*, (const ctype_char*, const char*, const char*, char, char*, MSVCP_size_t), \
1789 (this, first, last, unused, dest, size))
1790 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1791 const char *last, char unused, char *dest, MSVCP_size_t size)
1793 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1794 memcpy_s(dest, size, first, last-first);
1795 return last;
1798 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1799 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1800 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1801 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1803 TRACE("(%p %c %c)\n", this, ch, dflt);
1804 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1807 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1808 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1809 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1810 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1811 const char *first, const char *last, char dflt, char *dest)
1813 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1814 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1817 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1818 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1819 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1820 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1821 const char *last, char dflt, char *dest, MSVCP_size_t size)
1823 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1824 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1827 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1828 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1829 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1830 #if _MSVCP_VER <= 100
1831 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1832 char, (const ctype_char*, char), (this, ch))
1833 #else
1834 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
1835 char, (const ctype_char*, char), (this, ch))
1836 #endif
1837 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1839 TRACE("(%p %c)\n", this, ch);
1840 return ch;
1843 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1844 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1845 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1846 #if _MSVCP_VER <= 100
1847 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1848 const char*, (const ctype_char*, const char*, const char*, char*), \
1849 (this, first, last, dest))
1850 #else
1851 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 28, \
1852 const char*, (const ctype_char*, const char*, const char*, char*), \
1853 (this, first, last, dest))
1854 #endif
1855 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1856 const char *first, const char *last, char *dest)
1858 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1859 memcpy(dest, first, last-first);
1860 return last;
1863 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1864 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1865 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1866 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1867 const char*, (const ctype_char*, const char*, const char*, char*, MSVCP_size_t), \
1868 (this, first, last, dest, size))
1869 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1870 const char *first, const char *last, char *dest, MSVCP_size_t size)
1872 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1873 memcpy_s(dest, size, first, last-first);
1874 return last;
1877 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1878 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1879 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1880 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1882 TRACE("(%p %c)\n", this, ch);
1883 return call_ctype_char_do_widen_ch(this, ch);
1886 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1887 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1888 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1889 const char* __thiscall ctype_char_widen(const ctype_char *this,
1890 const char *first, const char *last, char *dest)
1892 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1893 return call_ctype_char_do_widen(this, first, last, dest);
1896 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1897 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1898 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1899 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1900 const char *first, const char *last, char *dest, MSVCP_size_t size)
1902 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1903 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1906 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1907 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1908 MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1910 TRACE("(%p %p)\n", facet, loc);
1912 if(facet && !*facet) {
1913 _Locinfo locinfo;
1915 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1916 if(!*facet) {
1917 ERR("Out of memory\n");
1918 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1919 return 0;
1922 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
1923 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1924 _Locinfo_dtor(&locinfo);
1927 return LC_CTYPE;
1930 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z */
1931 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1932 MSVCP_size_t __cdecl ctype_char__Getcat_old(const locale_facet **facet)
1934 return ctype_char__Getcat(facet, locale_classic());
1937 ctype_char* ctype_char_use_facet(const locale *loc)
1939 static ctype_char *obj = NULL;
1941 _Lockit lock;
1942 const locale_facet *fac;
1944 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1945 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1946 if(fac) {
1947 _Lockit_dtor(&lock);
1948 return (ctype_char*)fac;
1951 if(obj) {
1952 _Lockit_dtor(&lock);
1953 return obj;
1956 ctype_char__Getcat(&fac, loc);
1957 obj = (ctype_char*)fac;
1958 call_locale_facet__Incref(&obj->base.facet);
1959 locale_facet_register(&obj->base.facet);
1960 _Lockit_dtor(&lock);
1962 return obj;
1965 /* _Tolower */
1966 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1968 unsigned int cp;
1970 TRACE("%d %p\n", ch, ctype);
1972 if(ctype)
1973 cp = ctype->page;
1974 else
1975 cp = ___lc_codepage_func();
1977 /* Don't convert to unicode in case of C locale */
1978 if(!cp) {
1979 if(ch>='A' && ch<='Z')
1980 ch = ch-'A'+'a';
1981 return ch;
1982 } else {
1983 WCHAR wide, lower;
1984 char str[2];
1985 int size;
1987 if(ch > 255) {
1988 str[0] = (ch>>8) & 255;
1989 str[1] = ch & 255;
1990 size = 2;
1991 } else {
1992 str[0] = ch & 255;
1993 size = 1;
1996 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1997 return ch;
1999 lower = tolowerW(wide);
2000 if(lower == wide)
2001 return ch;
2003 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
2005 return str[0] + (str[1]<<8);
2009 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
2010 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
2011 #if _MSVCP_VER <= 100
2012 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
2013 char, (const ctype_char*, char), (this, ch))
2014 #else
2015 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
2016 char, (const ctype_char*, char), (this, ch))
2017 #endif
2018 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
2019 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
2021 TRACE("(%p %c)\n", this, ch);
2022 return _Tolower(ch, &this->ctype);
2025 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
2026 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
2027 #if _MSVCP_VER <= 100
2028 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
2029 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2030 #else
2031 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 12, \
2032 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2033 #endif
2034 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
2035 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
2037 TRACE("(%p %p %p)\n", this, first, last);
2038 for(; first<last; first++)
2039 *first = _Tolower(*first, &this->ctype);
2040 return last;
2043 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
2044 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
2045 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
2046 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
2048 TRACE("(%p %c)\n", this, ch);
2049 return call_ctype_char_do_tolower_ch(this, ch);
2052 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
2053 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2054 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
2055 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
2057 TRACE("(%p %p %p)\n", this, first, last);
2058 return call_ctype_char_do_tolower(this, first, last);
2061 /* _Toupper */
2062 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
2064 unsigned int cp;
2066 TRACE("%d %p\n", ch, ctype);
2068 if(ctype)
2069 cp = ctype->page;
2070 else
2071 cp = ___lc_codepage_func();
2073 /* Don't convert to unicode in case of C locale */
2074 if(!cp) {
2075 if(ch>='a' && ch<='z')
2076 ch = ch-'a'+'A';
2077 return ch;
2078 } else {
2079 WCHAR wide, upper;
2080 char str[2];
2081 int size;
2083 if(ch > 255) {
2084 str[0] = (ch>>8) & 255;
2085 str[1] = ch & 255;
2086 size = 2;
2087 } else {
2088 str[0] = ch & 255;
2089 size = 1;
2092 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
2093 return ch;
2095 upper = toupperW(wide);
2096 if(upper == wide)
2097 return ch;
2099 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
2101 return str[0] + (str[1]<<8);
2105 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
2106 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
2107 #if _MSVCP_VER <= 100
2108 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
2109 char, (const ctype_char*, char), (this, ch))
2110 #else
2111 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2112 char, (const ctype_char*, char), (this, ch))
2113 #endif
2114 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
2115 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
2117 TRACE("(%p %c)\n", this, ch);
2118 return _Toupper(ch, &this->ctype);
2121 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
2122 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
2123 #if _MSVCP_VER <= 100
2124 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
2125 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2126 #else
2127 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 20, \
2128 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2129 #endif
2130 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
2131 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
2132 char *first, const char *last)
2134 TRACE("(%p %p %p)\n", this, first, last);
2135 for(; first<last; first++)
2136 *first = _Toupper(*first, &this->ctype);
2137 return last;
2140 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
2141 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
2142 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
2143 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
2145 TRACE("(%p %c)\n", this, ch);
2146 return call_ctype_char_do_toupper_ch(this, ch);
2149 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
2150 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2151 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
2152 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
2154 TRACE("(%p %p %p)\n", this, first, last);
2155 return call_ctype_char_do_toupper(this, first, last);
2158 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
2159 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
2160 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
2161 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
2163 TRACE("(%p %x %c)\n", this, mask, ch);
2164 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
2167 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
2168 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
2169 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
2170 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
2172 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2173 for(; first<last; first++)
2174 *dest++ = this->ctype.table[(unsigned char)*first];
2175 return last;
2178 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
2179 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2180 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
2181 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
2183 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2184 for(; first<last; first++)
2185 if(!ctype_char_is_ch(this, mask, *first))
2186 break;
2187 return first;
2190 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
2191 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2192 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
2193 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
2195 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2196 for(; first<last; first++)
2197 if(ctype_char_is_ch(this, mask, *first))
2198 break;
2199 return first;
2202 /* ?table@?$ctype@D@std@@IBEPBFXZ */
2203 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
2204 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
2205 const short* __thiscall ctype_char_table(const ctype_char *this)
2207 TRACE("(%p)\n", this);
2208 return this->ctype.table;
2211 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
2212 locale_id ctype_wchar_id = {0};
2213 /* ?id@?$ctype@G@std@@2V0locale@2@A */
2214 locale_id ctype_short_id = {0};
2216 /* ??_7?$ctype@_W@std@@6B@ */
2217 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
2218 /* ??_7?$ctype@G@std@@6B@ */
2219 extern const vtable_ptr MSVCP_ctype_short_vtable;
2221 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
2222 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
2223 locale_id* __cdecl ctype_wchar__Id_func(void)
2225 TRACE("()\n");
2226 return &ctype_wchar_id;
2229 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
2230 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
2231 locale_id* __cdecl ctype_short__Id_func(void)
2233 TRACE("()\n");
2234 return &ctype_short_id;
2237 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
2238 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
2239 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
2240 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
2241 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
2242 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
2244 TRACE("(%p %p)\n", this, locinfo);
2245 _Locinfo__Getctype(locinfo, &this->ctype);
2246 _Locinfo__Getcvt(locinfo, &this->cvt);
2249 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
2250 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2251 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
2252 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
2253 const _Locinfo *locinfo, MSVCP_size_t refs)
2255 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2256 ctype_base_ctor_refs(&this->base, refs);
2257 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2258 ctype_wchar__Init(this, locinfo);
2259 return this;
2262 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
2263 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2264 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
2265 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
2266 const _Locinfo *locinfo, MSVCP_size_t refs)
2268 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
2269 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2270 return ret;
2273 /* ??0?$ctype@_W@std@@QAE@I@Z */
2274 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
2275 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
2276 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2278 _Locinfo locinfo;
2280 TRACE("(%p %lu)\n", this, refs);
2282 ctype_base_ctor_refs(&this->base, refs);
2283 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2285 _Locinfo_ctor(&locinfo);
2286 ctype_wchar__Init(this, &locinfo);
2287 _Locinfo_dtor(&locinfo);
2288 return this;
2291 /* ??0?$ctype@G@std@@QAE@I@Z */
2292 /* ??0?$ctype@G@std@@QEAA@_K@Z */
2293 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
2294 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2296 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
2297 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2298 return ret;
2301 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
2302 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
2303 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
2304 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
2305 const char *name, MSVCP_size_t refs)
2307 _Locinfo locinfo;
2309 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
2311 ctype_base_ctor_refs(&this->base, refs);
2312 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2314 _Locinfo_ctor_cstr(&locinfo, name);
2315 ctype_wchar__Init(this, &locinfo);
2316 _Locinfo_dtor(&locinfo);
2317 return this;
2320 /* ??_F?$ctype@_W@std@@QAEXXZ */
2321 /* ??_F?$ctype@_W@std@@QEAAXXZ */
2322 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
2323 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
2325 TRACE("(%p)\n", this);
2326 return ctype_short_ctor_refs(this, 0);
2329 /* ??_F?$ctype@G@std@@QAEXXZ */
2330 /* ??_F?$ctype@G@std@@QEAAXXZ */
2331 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
2332 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
2334 ctype_wchar *ret = ctype_wchar_ctor(this);
2335 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2336 return ret;
2339 /* ??1?$ctype@G@std@@UAE@XZ */
2340 /* ??1?$ctype@G@std@@UEAA@XZ */
2341 /* ??1?$ctype@_W@std@@MAE@XZ */
2342 /* ??1?$ctype@_W@std@@MEAA@XZ */
2343 /* ??1?$ctype@G@std@@MAE@XZ */
2344 /* ??1?$ctype@G@std@@MEAA@XZ */
2345 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
2346 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
2348 TRACE("(%p)\n", this);
2349 if(this->ctype.delfl)
2350 free((void*)this->ctype.table);
2351 #if _MSVCP_VER >= 110
2352 free(this->ctype.name);
2353 #endif
2356 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
2357 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
2359 TRACE("(%p %x)\n", this, flags);
2360 if(flags & 2) {
2361 /* we have an array, with the number of elements stored before the first object */
2362 INT_PTR i, *ptr = (INT_PTR *)this-1;
2364 for(i=*ptr-1; i>=0; i--)
2365 ctype_wchar_dtor(this+i);
2366 MSVCRT_operator_delete(ptr);
2367 } else {
2368 ctype_wchar_dtor(this);
2369 if(flags & 1)
2370 MSVCRT_operator_delete(this);
2373 return this;
2376 /* _Wcrtomb */
2377 int __cdecl _Wcrtomb(char *s, wchar_t wch, _Mbstatet *state, const _Cvtvec *cvt)
2379 int cp, size;
2380 BOOL def;
2382 TRACE("%p %d %p %p\n", s, wch, state, cvt);
2384 if(cvt)
2385 cp = cvt->page;
2386 else
2387 cp = ___lc_codepage_func();
2389 if(!cp) {
2390 if(wch > 255) {
2391 *_errno() = EILSEQ;
2392 return -1;
2395 *s = wch & 255;
2396 return 1;
2399 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
2400 if(!size || def) {
2401 *_errno() = EILSEQ;
2402 return -1;
2405 return size;
2408 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
2409 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
2410 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
2411 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
2412 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
2413 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
2415 char buf[MB_LEN_MAX];
2417 TRACE("(%p %d %d)\n", this, ch, dflt);
2419 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
2422 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
2423 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
2424 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
2425 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
2426 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
2427 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2428 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
2429 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2430 #elif _MSVCP_VER <= 100
2431 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
2432 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2433 #else
2434 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 56, \
2435 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2436 #endif
2437 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2439 return ctype_wchar__Donarrow(this, ch, dflt);
2442 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
2443 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2444 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2445 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2446 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2447 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2448 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2449 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2450 (this, first, last, dflt, dest))
2451 #elif _MSVCP_VER <= 100
2452 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
2453 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2454 (this, first, last, dflt, dest))
2455 #else
2456 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 52, \
2457 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2458 (this, first, last, dflt, dest))
2459 #endif
2460 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2461 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2463 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2464 for(; first<last; first++)
2465 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2466 return last;
2469 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2470 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2471 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2472 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2473 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2474 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2475 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, MSVCP_size_t), \
2476 (this, first, last, dflt, dest, size))
2477 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2478 const wchar_t *first, const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2480 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2481 /* This function converts all multi-byte characters to dflt,
2482 * thanks to it result size is known before converting */
2483 if(last-first > size)
2484 ctype_base__Xran();
2485 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2488 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2489 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2490 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2491 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2492 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2493 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2495 TRACE("(%p %d %d)\n", this, ch, dflt);
2496 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2499 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2500 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2501 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2502 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2503 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2504 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2505 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2507 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2508 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2511 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2512 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2513 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2514 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2515 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2516 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2517 const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2519 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2520 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2523 /* _Mbrtowc */
2524 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, _Mbstatet *state, const _Cvtvec *cvt)
2526 int i, cp;
2527 CPINFO cp_info;
2528 BOOL is_lead;
2530 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
2532 if(!len)
2533 return 0;
2535 if(cvt)
2536 cp = cvt->page;
2537 else
2538 cp = ___lc_codepage_func();
2540 if(!cp) {
2541 if(out)
2542 *out = (unsigned char)*in;
2544 memset(state, 0, sizeof(*state));
2545 return *in ? 1 : 0;
2548 if(MBSTATET_TO_INT(state)) {
2549 ((char*)&MBSTATET_TO_INT(state))[1] = *in;
2551 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)&MBSTATET_TO_INT(state), 2, out, out ? 1 : 0)) {
2552 memset(state, 0, sizeof(*state));
2553 *_errno() = EILSEQ;
2554 return -1;
2557 memset(state, 0, sizeof(*state));
2558 return 2;
2561 GetCPInfo(cp, &cp_info);
2562 is_lead = FALSE;
2563 for(i=0; i<MAX_LEADBYTES; i+=2) {
2564 if(!cp_info.LeadByte[i+1])
2565 break;
2566 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2567 is_lead = TRUE;
2568 break;
2572 if(is_lead) {
2573 if(len == 1) {
2574 MBSTATET_TO_INT(state) = (unsigned char)*in;
2575 return -2;
2578 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2579 *_errno() = EILSEQ;
2580 return -1;
2582 return 2;
2585 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2586 *_errno() = EILSEQ;
2587 return -1;
2589 return 1;
2592 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
2594 _Mbstatet state;
2595 wchar_t ret;
2597 memset(&state, 0, sizeof(state));
2598 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
2601 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2602 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2603 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2604 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2605 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2606 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2608 _Mbstatet state;
2609 wchar_t ret;
2611 TRACE("(%p %d)\n", this, ch);
2613 memset(&state, 0, sizeof(state));
2614 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2617 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2618 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2619 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2620 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2621 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2622 #if _MSVCP_VER <= 100
2623 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2624 wchar_t, (const ctype_wchar*, char), (this, ch))
2625 #else
2626 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 48, \
2627 wchar_t, (const ctype_wchar*, char), (this, ch))
2628 #endif
2629 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2631 return ctype_wchar__Dowiden(this, ch);
2634 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2635 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2636 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2637 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2638 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2639 #if _MSVCP_VER <= 100
2640 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2641 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2642 (this, first, last, dest))
2643 #else
2644 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 44, \
2645 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2646 (this, first, last, dest))
2647 #endif
2648 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2649 const char *first, const char *last, wchar_t *dest)
2651 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2652 for(; first<last; first++)
2653 *dest++ = ctype_wchar__Dowiden(this, *first);
2654 return last;
2657 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2658 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2659 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2660 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2661 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2662 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2663 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, MSVCP_size_t), \
2664 (this, first, last, dest, size))
2665 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2666 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2668 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2669 /* This function converts all multi-byte characters to WEOF,
2670 * thanks to it result size is known before converting */
2671 if(size < last-first)
2672 ctype_base__Xran();
2673 return ctype_wchar_do_widen(this, first, last, dest);
2676 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2677 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2678 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2679 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2680 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2681 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2683 TRACE("(%p %d)\n", this, ch);
2684 return call_ctype_wchar_do_widen_ch(this, ch);
2687 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2688 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2689 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2690 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2691 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2692 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2693 const char *first, const char *last, wchar_t *dest)
2695 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2696 return call_ctype_wchar_do_widen(this, first, last, dest);
2699 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2700 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2701 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2702 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2703 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2704 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2705 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2707 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2708 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2711 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2712 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2713 MSVCP_size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2715 TRACE("(%p %p)\n", facet, loc);
2717 if(facet && !*facet) {
2718 _Locinfo locinfo;
2720 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2721 if(!*facet) {
2722 ERR("Out of memory\n");
2723 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2724 return 0;
2727 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2728 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2729 _Locinfo_dtor(&locinfo);
2732 return LC_CTYPE;
2735 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@@Z */
2736 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2737 MSVCP_size_t __cdecl ctype_wchar__Getcat_old(const locale_facet **facet)
2739 return ctype_wchar__Getcat(facet, locale_classic());
2742 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2743 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2744 MSVCP_size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2746 if(facet && !*facet) {
2747 ctype_wchar__Getcat(facet, loc);
2748 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2751 return LC_CTYPE;
2754 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z */
2755 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2756 MSVCP_size_t __cdecl ctype_short__Getcat_old(const locale_facet **facet)
2758 return ctype_short__Getcat(facet, locale_classic());
2761 /* _Towlower */
2762 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2764 TRACE("(%d %p)\n", ch, ctype);
2765 return tolowerW(ch);
2768 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2770 static ctype_wchar *obj = NULL;
2772 _Lockit lock;
2773 const locale_facet *fac;
2775 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2776 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2777 if(fac) {
2778 _Lockit_dtor(&lock);
2779 return (ctype_wchar*)fac;
2782 if(obj) {
2783 _Lockit_dtor(&lock);
2784 return obj;
2787 ctype_wchar__Getcat(&fac, loc);
2788 obj = (ctype_wchar*)fac;
2789 call_locale_facet__Incref(&obj->base.facet);
2790 locale_facet_register(&obj->base.facet);
2791 _Lockit_dtor(&lock);
2793 return obj;
2796 ctype_wchar* ctype_short_use_facet(const locale *loc)
2798 static ctype_wchar *obj = NULL;
2800 _Lockit lock;
2801 const locale_facet *fac;
2803 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2804 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2805 if(fac) {
2806 _Lockit_dtor(&lock);
2807 return (ctype_wchar*)fac;
2810 if(obj) {
2811 _Lockit_dtor(&lock);
2812 return obj;
2815 ctype_short__Getcat(&fac, loc);
2816 obj = (ctype_wchar*)fac;
2817 call_locale_facet__Incref(&obj->base.facet);
2818 locale_facet_register(&obj->base.facet);
2819 _Lockit_dtor(&lock);
2821 return obj;
2824 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2825 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2826 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2827 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2828 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2829 #if _MSVCP_VER <= 100
2830 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2831 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2832 #else
2833 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2834 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2835 #endif
2836 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2838 return _Towlower(ch, &this->ctype);
2841 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2842 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2843 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2844 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2845 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2846 #if _MSVCP_VER <= 100
2847 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2848 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2849 (this, first, last))
2850 #else
2851 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 28, \
2852 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2853 (this, first, last))
2854 #endif
2855 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2856 wchar_t *first, const wchar_t *last)
2858 TRACE("(%p %p %p)\n", this, first, last);
2859 for(; first<last; first++)
2860 *first = _Towlower(*first, &this->ctype);
2861 return last;
2864 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2865 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2866 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2867 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2868 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2869 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2871 TRACE("(%p %d)\n", this, ch);
2872 return call_ctype_wchar_do_tolower_ch(this, ch);
2875 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2876 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2877 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2878 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2879 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2880 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2881 wchar_t *first, const wchar_t *last)
2883 TRACE("(%p %p %p)\n", this, first, last);
2884 return call_ctype_wchar_do_tolower(this, first, last);
2887 /* _Towupper */
2888 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2890 TRACE("(%d %p)\n", ch, ctype);
2891 return toupperW(ch);
2894 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2895 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2896 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2897 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2898 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2899 #if _MSVCP_VER <= 100
2900 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2901 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2902 #else
2903 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2904 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2905 #endif
2906 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2908 return _Towupper(ch, &this->ctype);
2911 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2912 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2913 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2914 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2915 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2916 #if _MSVCP_VER <= 100
2917 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2918 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2919 (this, first, last))
2920 #else
2921 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 36, \
2922 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2923 (this, first, last))
2924 #endif
2925 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2926 wchar_t *first, const wchar_t *last)
2928 TRACE("(%p %p %p)\n", this, first, last);
2929 for(; first<last; first++)
2930 *first = _Towupper(*first, &this->ctype);
2931 return last;
2934 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2935 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2936 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2937 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2938 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2939 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2941 TRACE("(%p %d)\n", this, ch);
2942 return call_ctype_wchar_do_toupper_ch(this, ch);
2945 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2946 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2947 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2948 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2949 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2950 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2951 wchar_t *first, const wchar_t *last)
2953 TRACE("(%p %p %p)\n", this, first, last);
2954 return call_ctype_wchar_do_toupper(this, first, last);
2957 /* _Getwctypes */
2958 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2959 short *mask, const _Ctypevec *ctype)
2961 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2962 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2963 return last;
2966 /* _Getwctype */
2967 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2969 short mask = 0;
2970 _Getwctypes(&ch, &ch+1, &mask, ctype);
2971 return mask;
2974 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2975 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2976 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2977 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2978 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2979 #if _MSVCP_VER <= 100
2980 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2981 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2982 #else
2983 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 16, \
2984 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2985 #endif
2986 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2988 TRACE("(%p %x %d)\n", this, mask, ch);
2989 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2992 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2993 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2994 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2995 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2996 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2997 #if _MSVCP_VER <= 100
2998 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2999 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
3000 (this, first, last, dest))
3001 #else
3002 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 12, \
3003 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
3004 (this, first, last, dest))
3005 #endif
3006 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
3007 const wchar_t *first, const wchar_t *last, short *dest)
3009 TRACE("(%p %p %p %p)\n", this, first, last, dest);
3010 return _Getwctypes(first, last, dest, &this->ctype);
3013 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
3014 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
3015 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
3016 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
3017 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
3018 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
3020 TRACE("(%p %x %d)\n", this, mask, ch);
3021 return call_ctype_wchar_do_is_ch(this, mask, ch);
3024 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
3025 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
3026 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
3027 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
3028 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
3029 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
3030 const wchar_t *first, const wchar_t *last, short *dest)
3032 TRACE("(%p %p %p %p)\n", this, first, last, dest);
3033 return call_ctype_wchar_do_is(this, first, last, dest);
3036 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
3037 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
3038 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
3039 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
3040 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
3041 #if _MSVCP_VER <= 100
3042 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
3043 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3044 (this, mask, first, last))
3045 #else
3046 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 20, \
3047 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3048 (this, mask, first, last))
3049 #endif
3050 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
3051 short mask, const wchar_t *first, const wchar_t *last)
3053 TRACE("(%p %d %p %p)\n", this, mask, first, last);
3054 for(; first<last; first++)
3055 if(!ctype_wchar_is_ch(this, mask, *first))
3056 break;
3057 return first;
3060 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
3061 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
3062 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
3063 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
3064 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
3065 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
3066 short mask, const wchar_t *first, const wchar_t *last)
3068 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3069 return call_ctype_wchar_do_scan_is(this, mask, first, last);
3072 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
3073 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
3074 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
3075 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
3076 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
3077 #if _MSVCP_VER <= 100
3078 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
3079 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3080 (this, mask, first, last))
3081 #else
3082 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 24, \
3083 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3084 (this, mask, first, last))
3085 #endif
3086 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
3087 short mask, const wchar_t *first, const wchar_t *last)
3089 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3090 for(; first<last; first++)
3091 if(ctype_wchar_is_ch(this, mask, *first))
3092 break;
3093 return first;
3096 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
3097 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
3098 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
3099 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
3100 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
3101 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
3102 short mask, const wchar_t *first, const wchar_t *last)
3104 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3105 return call_ctype_wchar_do_scan_not(this, mask, first, last);
3108 /* ??_7codecvt_base@std@@6B@ */
3109 extern const vtable_ptr MSVCP_codecvt_base_vtable;
3111 /* ??0codecvt_base@std@@QAE@I@Z */
3112 /* ??0codecvt_base@std@@QEAA@_K@Z */
3113 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
3114 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
3116 TRACE("(%p %lu)\n", this, refs);
3117 locale_facet_ctor_refs(&this->facet, refs);
3118 this->facet.vtable = &MSVCP_codecvt_base_vtable;
3119 return this;
3122 /* ??_Fcodecvt_base@std@@QAEXXZ */
3123 /* ??_Fcodecvt_base@std@@QEAAXXZ */
3124 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
3125 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
3127 return codecvt_base_ctor_refs(this, 0);
3130 /* ??1codecvt_base@std@@UAE@XZ */
3131 /* ??1codecvt_base@std@@UEAA@XZ */
3132 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
3133 void __thiscall codecvt_base_dtor(codecvt_base *this)
3135 TRACE("(%p)\n", this);
3136 locale_facet_dtor(&this->facet);
3139 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
3140 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
3142 TRACE("(%p %x)\n", this, flags);
3143 if(flags & 2) {
3144 /* we have an array, with the number of elements stored before the first object */
3145 INT_PTR i, *ptr = (INT_PTR *)this-1;
3147 for(i=*ptr-1; i>=0; i--)
3148 codecvt_base_dtor(this+i);
3149 MSVCRT_operator_delete(ptr);
3150 } else {
3151 codecvt_base_dtor(this);
3152 if(flags & 1)
3153 MSVCRT_operator_delete(this);
3156 return this;
3159 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
3160 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
3161 #if _MSVCP_VER <= 100
3162 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
3163 MSVCP_bool, (const codecvt_base*), (this))
3164 #else
3165 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 12, \
3166 MSVCP_bool, (const codecvt_base*), (this))
3167 #endif
3168 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
3169 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
3171 TRACE("(%p)\n", this);
3172 return _MSVCP_VER <= 100;
3175 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
3176 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
3177 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
3178 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
3180 TRACE("(%p)\n", this);
3181 return call_codecvt_base_do_always_noconv(this);
3184 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
3185 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
3186 #if _MSVCP_VER <= 100
3187 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
3188 int, (const codecvt_base*), (this))
3189 #else
3190 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 16, \
3191 int, (const codecvt_base*), (this))
3192 #endif
3193 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
3194 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
3196 TRACE("(%p)\n", this);
3197 return 1;
3200 /* ?max_length@codecvt_base@std@@QBEHXZ */
3201 /* ?max_length@codecvt_base@std@@QEBAHXZ */
3202 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
3203 int __thiscall codecvt_base_max_length(const codecvt_base *this)
3205 TRACE("(%p)\n", this);
3206 return call_codecvt_base_do_max_length(this);
3209 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
3210 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
3211 #if _MSVCP_VER <= 100
3212 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
3213 int, (const codecvt_base*), (this))
3214 #else
3215 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 20, \
3216 int, (const codecvt_base*), (this))
3217 #endif
3218 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
3219 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
3221 TRACE("(%p)\n", this);
3222 return 1;
3225 /* ?encoding@codecvt_base@std@@QBEHXZ */
3226 /* ?encoding@codecvt_base@std@@QEBAHXZ */
3227 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
3228 int __thiscall codecvt_base_encoding(const codecvt_base *this)
3230 TRACE("(%p)\n", this);
3231 return call_codecvt_base_do_encoding(this);
3234 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
3235 locale_id codecvt_char_id = {0};
3237 /* ??_7?$codecvt@DDH@std@@6B@ */
3238 extern const vtable_ptr MSVCP_codecvt_char_vtable;
3240 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
3241 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3242 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
3243 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
3245 TRACE("(%p %p)\n", this, locinfo);
3248 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
3249 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3250 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
3251 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3253 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3254 codecvt_base_ctor_refs(&this->base, refs);
3255 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
3256 return this;
3259 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
3260 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
3261 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
3262 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
3264 return codecvt_char_ctor_locinfo(this, NULL, refs);
3267 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
3268 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
3269 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
3270 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
3272 return codecvt_char_ctor_locinfo(this, NULL, 0);
3275 /* ??1?$codecvt@DDH@std@@UAE@XZ */
3276 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
3277 /* ??1?$codecvt@DDH@std@@MAE@XZ */
3278 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
3279 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
3280 void __thiscall codecvt_char_dtor(codecvt_char *this)
3282 TRACE("(%p)\n", this);
3283 codecvt_base_dtor(&this->base);
3286 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
3287 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
3289 TRACE("(%p %x)\n", this, flags);
3290 if(flags & 2) {
3291 /* we have an array, with the number of elements stored before the first object */
3292 INT_PTR i, *ptr = (INT_PTR *)this-1;
3294 for(i=*ptr-1; i>=0; i--)
3295 codecvt_char_dtor(this+i);
3296 MSVCRT_operator_delete(ptr);
3297 } else {
3298 codecvt_char_dtor(this);
3299 if(flags & 1)
3300 MSVCRT_operator_delete(this);
3303 return this;
3306 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3307 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3308 MSVCP_size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
3310 TRACE("(%p %p)\n", facet, loc);
3312 if(facet && !*facet) {
3313 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
3314 if(!*facet) {
3315 ERR("Out of memory\n");
3316 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3317 return 0;
3319 codecvt_char_ctor((codecvt_char*)*facet);
3322 return LC_CTYPE;
3325 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z */
3326 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3327 MSVCP_size_t __cdecl codecvt_char__Getcat_old(const locale_facet **facet)
3329 return codecvt_char__Getcat(facet, locale_classic());
3332 codecvt_char* codecvt_char_use_facet(const locale *loc)
3334 static codecvt_char *obj = NULL;
3336 _Lockit lock;
3337 const locale_facet *fac;
3339 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3340 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
3341 if(fac) {
3342 _Lockit_dtor(&lock);
3343 return (codecvt_char*)fac;
3346 if(obj) {
3347 _Lockit_dtor(&lock);
3348 return obj;
3351 codecvt_char__Getcat(&fac, loc);
3352 obj = (codecvt_char*)fac;
3353 call_locale_facet__Incref(&obj->base.facet);
3354 locale_facet_register(&obj->base.facet);
3355 _Lockit_dtor(&lock);
3357 return obj;
3360 /* ?do_always_noconv@?$codecvt@DDH@std@@MBE_NXZ */
3361 /* ?do_always_noconv@?$codecvt@DDH@std@@MEBA_NXZ */
3362 DEFINE_THISCALL_WRAPPER(codecvt_char_do_always_noconv, 4)
3363 MSVCP_bool __thiscall codecvt_char_do_always_noconv(const codecvt_char *this)
3365 TRACE("(%p)\n", this);
3366 return TRUE;
3369 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3370 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3371 #if _MSVCP_VER <= 100
3372 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3373 CALL_VTBL_FUNC(this, 16, int, \
3374 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3375 (this, state, from, from_end, from_next, to, to_end, to_next))
3376 #else
3377 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3378 CALL_VTBL_FUNC(this, 24, int, \
3379 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3380 (this, state, from, from_end, from_next, to, to_end, to_next))
3381 #endif
3382 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
3383 int __thiscall codecvt_char_do_in(const codecvt_char *this, _Mbstatet *state,
3384 const char *from, const char *from_end, const char **from_next,
3385 char *to, char *to_end, char **to_next)
3387 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3388 from_next, to, to_end, to_next);
3389 *from_next = from;
3390 *to_next = to;
3391 return CODECVT_noconv;
3394 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3395 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3396 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
3397 int __thiscall codecvt_char_in(const codecvt_char *this, _Mbstatet *state,
3398 const char *from, const char *from_end, const char **from_next,
3399 char *to, char *to_end, char **to_next)
3401 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3402 from_next, to, to_end, to_next);
3403 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
3404 to, to_end, to_next);
3407 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3408 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3409 #if _MSVCP_VER <= 100
3410 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3411 CALL_VTBL_FUNC(this, 20, int, \
3412 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3413 (this, state, from, from_end, from_next, to, to_end, to_next))
3414 #else
3415 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3416 CALL_VTBL_FUNC(this, 28, int, \
3417 (const codecvt_char*, _Mbstatet*, const char*, const char*, const char**, char*, char*, char**), \
3418 (this, state, from, from_end, from_next, to, to_end, to_next))
3419 #endif
3420 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
3421 int __thiscall codecvt_char_do_out(const codecvt_char *this, _Mbstatet *state,
3422 const char *from, const char *from_end, const char **from_next,
3423 char *to, char *to_end, char **to_next)
3425 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3426 from_end, from_next, to, to_end, to_next);
3427 *from_next = from;
3428 *to_next = to;
3429 return CODECVT_noconv;
3432 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3433 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3434 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
3435 int __thiscall codecvt_char_out(const codecvt_char *this, _Mbstatet *state,
3436 const char *from, const char *from_end, const char **from_next,
3437 char *to, char *to_end, char **to_next)
3439 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3440 from_next, to, to_end, to_next);
3441 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
3442 to, to_end, to_next);
3445 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
3446 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3447 #if _MSVCP_VER <= 100
3448 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3449 int, (const codecvt_char*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3450 #else
3451 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3452 int, (const codecvt_char*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3453 #endif
3454 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
3455 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
3456 _Mbstatet *state, char *to, char *to_end, char **to_next)
3458 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3459 *to_next = to;
3460 return CODECVT_noconv;
3463 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
3464 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3465 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
3466 int __thiscall codecvt_char_unshift(const codecvt_char *this,
3467 _Mbstatet *state, char *to, char *to_end, char **to_next)
3469 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3470 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
3473 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
3474 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
3475 #if _MSVCP_VER <= 100
3476 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3477 int, (const codecvt_char*, const _Mbstatet*, const char*, const char*, MSVCP_size_t), \
3478 (this, state, from, from_end, max))
3479 #else
3480 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3481 int, (const codecvt_char*, const _Mbstatet*, const char*, const char*, MSVCP_size_t), \
3482 (this, state, from, from_end, max))
3483 #endif
3484 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
3485 int __thiscall codecvt_char_do_length(const codecvt_char *this, const _Mbstatet *state,
3486 const char *from, const char *from_end, MSVCP_size_t max)
3488 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3489 return (from_end-from > max ? max : from_end-from);
3492 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
3493 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
3494 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
3495 int __thiscall codecvt_char_length(const codecvt_char *this, const _Mbstatet *state,
3496 const char *from, const char *from_end, MSVCP_size_t max)
3498 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3499 return call_codecvt_char_do_length(this, state, from, from_end, max);
3502 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
3503 locale_id codecvt_wchar_id = {0};
3504 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
3505 locale_id codecvt_short_id = {0};
3507 /* ??_7?$codecvt@_WDH@std@@6B@ */
3508 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
3509 /* ??_7?$codecvt@GDH@std@@6B@ */
3510 extern const vtable_ptr MSVCP_codecvt_short_vtable;
3512 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
3513 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3514 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
3515 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3516 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
3517 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
3519 TRACE("(%p %p)\n", this, locinfo);
3520 _Locinfo__Getcvt(locinfo, &this->cvt);
3523 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
3524 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3525 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
3526 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3528 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3530 codecvt_base_ctor_refs(&this->base, refs);
3531 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
3533 codecvt_wchar__Init(this, locinfo);
3534 return this;
3537 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
3538 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3539 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
3540 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3542 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3544 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
3545 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
3546 return this;
3549 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
3550 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
3551 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
3552 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3554 _Locinfo locinfo;
3556 TRACE("(%p %ld)\n", this, refs);
3558 _Locinfo_ctor(&locinfo);
3559 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
3560 _Locinfo_dtor(&locinfo);
3561 return this;
3564 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
3565 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
3566 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
3567 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3569 _Locinfo locinfo;
3571 TRACE("(%p %ld)\n", this, refs);
3573 _Locinfo_ctor(&locinfo);
3574 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3575 _Locinfo_dtor(&locinfo);
3576 return this;
3579 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
3580 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
3581 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
3582 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, MSVCP_size_t refs)
3584 _Locinfo locinfo;
3586 TRACE("(%p %s %ld)\n", this, name, refs);
3588 _Locinfo_ctor_cstr(&locinfo, name);
3589 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3590 _Locinfo_dtor(&locinfo);
3591 return this;
3594 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3595 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3596 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3597 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3599 return codecvt_wchar_ctor_refs(this, 0);
3602 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3603 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3604 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3605 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3607 return codecvt_short_ctor_refs(this, 0);
3610 /* ??1?$codecvt@GDH@std@@UAE@XZ */
3611 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
3612 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3613 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3614 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3615 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3616 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3617 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3619 TRACE("(%p)\n", this);
3620 codecvt_base_dtor(&this->base);
3623 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3624 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3626 TRACE("(%p %x)\n", this, flags);
3627 if(flags & 2) {
3628 /* we have an array, with the number of elements stored before the first object */
3629 INT_PTR i, *ptr = (INT_PTR *)this-1;
3631 for(i=*ptr-1; i>=0; i--)
3632 codecvt_wchar_dtor(this+i);
3633 MSVCRT_operator_delete(ptr);
3634 } else {
3635 codecvt_wchar_dtor(this);
3636 if(flags & 1)
3637 MSVCRT_operator_delete(this);
3640 return this;
3643 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3644 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3645 MSVCP_size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3647 TRACE("(%p %p)\n", facet, loc);
3649 if(facet && !*facet) {
3650 _Locinfo locinfo;
3652 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3653 if(!*facet) {
3654 ERR("Out of memory\n");
3655 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3656 return 0;
3659 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3660 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3661 _Locinfo_dtor(&locinfo);
3664 return LC_CTYPE;
3667 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@@Z */
3668 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3669 MSVCP_size_t __cdecl codecvt_wchar__Getcat_old(const locale_facet **facet)
3671 return codecvt_wchar__Getcat(facet, locale_classic());
3674 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3676 static codecvt_wchar *obj = NULL;
3678 _Lockit lock;
3679 const locale_facet *fac;
3681 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3682 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3683 if(fac) {
3684 _Lockit_dtor(&lock);
3685 return (codecvt_wchar*)fac;
3688 if(obj) {
3689 _Lockit_dtor(&lock);
3690 return obj;
3693 codecvt_wchar__Getcat(&fac, loc);
3694 obj = (codecvt_wchar*)fac;
3695 call_locale_facet__Incref(&obj->base.facet);
3696 locale_facet_register(&obj->base.facet);
3697 _Lockit_dtor(&lock);
3699 return obj;
3702 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3703 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3704 MSVCP_size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3706 TRACE("(%p %p)\n", facet, loc);
3708 if(facet && !*facet) {
3709 _Locinfo locinfo;
3711 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3712 if(!*facet) {
3713 ERR("Out of memory\n");
3714 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3715 return 0;
3718 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3719 codecvt_short_ctor((codecvt_wchar*)*facet);
3720 _Locinfo_dtor(&locinfo);
3723 return LC_CTYPE;
3726 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@@Z */
3727 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3728 MSVCP_size_t __cdecl codecvt_short__Getcat_old(const locale_facet **facet)
3730 return codecvt_short__Getcat(facet, locale_classic());
3733 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3735 static codecvt_wchar *obj = NULL;
3737 _Lockit lock;
3738 const locale_facet *fac;
3740 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3741 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3742 if(fac) {
3743 _Lockit_dtor(&lock);
3744 return (codecvt_wchar*)fac;
3747 if(obj) {
3748 _Lockit_dtor(&lock);
3749 return obj;
3752 codecvt_short__Getcat(&fac, loc);
3753 obj = (codecvt_wchar*)fac;
3754 call_locale_facet__Incref(&obj->base.facet);
3755 locale_facet_register(&obj->base.facet);
3756 _Lockit_dtor(&lock);
3758 return obj;
3761 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3762 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3763 locale_id* __cdecl codecvt_wchar__Id_func(void)
3765 TRACE("()\n");
3766 return &codecvt_wchar_id;
3769 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3770 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3771 locale_id* __cdecl codecvt_short__Id_func(void)
3773 TRACE("()\n");
3774 return &codecvt_short_id;
3777 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3778 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3779 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3780 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3781 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3782 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3784 TRACE("(%p)\n", this);
3785 return FALSE;
3788 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3789 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3790 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3791 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3792 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3793 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3795 TRACE("(%p)\n", this);
3796 return MB_LEN_MAX;
3799 /* ?do_encoding@?$codecvt@GDH@std@@MBEHXZ */
3800 /* ?do_encoding@?$codecvt@GDH@std@@MEBAHXZ */
3801 /* ?do_encoding@?$codecvt@_WDH@std@@MBEHXZ */
3802 /* ?do_encoding@?$codecvt@_WDH@std@@MEBAHXZ */
3803 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_encoding, 4)
3804 int __thiscall codecvt_wchar_do_encoding(const codecvt_wchar *this)
3806 TRACE("(%p)\n", this);
3807 return 0;
3810 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3811 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3812 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3813 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3814 #if _MSVCP_VER <= 100
3815 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3816 CALL_VTBL_FUNC(this, 16, int, \
3817 (const codecvt_wchar*, _Mbstatet*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3818 (this, state, from, from_end, from_next, to, to_end, to_next))
3819 #else
3820 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3821 CALL_VTBL_FUNC(this, 24, int, \
3822 (const codecvt_wchar*, _Mbstatet*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3823 (this, state, from, from_end, from_next, to, to_end, to_next))
3824 #endif
3825 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3826 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, _Mbstatet *state,
3827 const char *from, const char *from_end, const char **from_next,
3828 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3830 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3831 from_end, from_next, to, to_end, to_next);
3833 *from_next = from;
3834 *to_next = to;
3836 while(*from_next!=from_end && *to_next!=to_end) {
3837 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3838 case -2:
3839 *from_next = from_end;
3840 return CODECVT_partial;
3841 case -1:
3842 return CODECVT_error;
3843 case 2:
3844 (*from_next)++;
3845 /* fall through */
3846 case 0:
3847 case 1:
3848 (*from_next)++;
3849 (*to_next)++;
3853 return CODECVT_ok;
3856 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3857 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3858 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3859 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3860 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3861 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, _Mbstatet *state,
3862 const char *from, const char *from_end, const char **from_next,
3863 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3865 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3866 from_end, from_next, to, to_end, to_next);
3867 return call_codecvt_wchar_do_in(this, state, from,
3868 from_end, from_next, to, to_end, to_next);
3871 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3872 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3873 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3874 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3875 #if _MSVCP_VER <= 100
3876 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3877 CALL_VTBL_FUNC(this, 20, int, \
3878 (const codecvt_wchar*, _Mbstatet*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3879 (this, state, from, from_end, from_next, to, to_end, to_next))
3880 #else
3881 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3882 CALL_VTBL_FUNC(this, 28, int, \
3883 (const codecvt_wchar*, _Mbstatet*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3884 (this, state, from, from_end, from_next, to, to_end, to_next))
3885 #endif
3886 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3887 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, _Mbstatet *state,
3888 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3889 char *to, char *to_end, char **to_next)
3891 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3892 from_end, from_next, to, to_end, to_next);
3894 *from_next = from;
3895 *to_next = to;
3897 while(*from_next!=from_end && *to_next!=to_end) {
3898 _Mbstatet old_state = *state;
3899 int size;
3900 char buf[MB_LEN_MAX];
3902 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3903 case -1:
3904 return CODECVT_error;
3905 default:
3906 if(size > from_end-*from_next) {
3907 *state = old_state;
3908 return CODECVT_partial;
3911 (*from_next)++;
3912 memcpy_s(*to_next, to_end-*to_next, buf, size);
3913 (*to_next) += size;
3917 return CODECVT_ok;
3920 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3921 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3922 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3923 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3924 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3925 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, _Mbstatet *state,
3926 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3927 char *to, char *to_end, char **to_next)
3929 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3930 from_end, from_next, to, to_end, to_next);
3931 return call_codecvt_wchar_do_out(this, state, from,
3932 from_end, from_next, to, to_end, to_next);
3935 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3936 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3937 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3938 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3939 #if _MSVCP_VER <= 100
3940 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3941 int, (const codecvt_wchar*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3942 #else
3943 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3944 int, (const codecvt_wchar*, _Mbstatet*, char*, char*, char**), (this, state, to, to_end, to_next))
3945 #endif
3946 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3947 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3948 _Mbstatet *state, char *to, char *to_end, char **to_next)
3950 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3951 if(MBSTATET_TO_INT(state))
3952 WARN("unexpected state: %x\n", MBSTATET_TO_INT(state));
3954 *to_next = to;
3955 return CODECVT_ok;
3958 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3959 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3960 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3961 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3962 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3963 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3964 _Mbstatet *state, char *to, char *to_end, char **to_next)
3966 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3967 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3970 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3971 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3972 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3973 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3974 #if _MSVCP_VER <= 100
3975 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3976 int, (const codecvt_wchar*, const _Mbstatet*, const char*, const char*, MSVCP_size_t), \
3977 (this, state, from, from_end, max))
3978 #else
3979 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3980 int, (const codecvt_wchar*, const _Mbstatet*, const char*, const char*, MSVCP_size_t), \
3981 (this, state, from, from_end, max))
3982 #endif
3983 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3984 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const _Mbstatet *state,
3985 const char *from, const char *from_end, MSVCP_size_t max)
3987 _Mbstatet tmp_state = *state;
3988 int ret=0;
3990 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3992 while(ret<max && from!=from_end) {
3993 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3994 case -2:
3995 case -1:
3996 return ret;
3997 case 2:
3998 from++;
3999 /* fall through */
4000 case 0:
4001 case 1:
4002 from++;
4003 ret++;
4007 return ret;
4010 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
4011 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
4012 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
4013 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
4014 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
4015 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const _Mbstatet *state,
4016 const char *from, const char *from_end, MSVCP_size_t max)
4018 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
4019 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
4022 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
4023 locale_id numpunct_char_id = {0};
4025 /* ??_7?$numpunct@D@std@@6B@ */
4026 extern const vtable_ptr MSVCP_numpunct_char_vtable;
4028 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
4029 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4030 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
4031 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
4033 int len;
4035 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4037 len = strlen(_Locinfo__Getfalse(locinfo))+1;
4038 this->false_name = MSVCRT_operator_new(len);
4039 if(this->false_name)
4040 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
4042 len = strlen(_Locinfo__Gettrue(locinfo))+1;
4043 this->true_name = MSVCRT_operator_new(len);
4044 if(this->true_name)
4045 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
4047 if(isdef) {
4048 this->grouping = MSVCRT_operator_new(1);
4049 if(this->grouping)
4050 *(char*)this->grouping = 0;
4052 this->dp = '.';
4053 this->sep = ',';
4054 } else {
4055 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4057 len = strlen(lc->grouping)+1;
4058 this->grouping = MSVCRT_operator_new(len);
4059 if(this->grouping)
4060 memcpy((char*)this->grouping, lc->grouping, len);
4062 this->dp = lc->decimal_point[0];
4063 this->sep = lc->thousands_sep[0];
4066 if(!this->false_name || !this->true_name || !this->grouping) {
4067 MSVCRT_operator_delete((char*)this->grouping);
4068 MSVCRT_operator_delete((char*)this->false_name);
4069 MSVCRT_operator_delete((char*)this->true_name);
4071 ERR("Out of memory\n");
4072 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4076 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
4077 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
4078 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
4079 void __thiscall numpunct_char__Tidy(numpunct_char *this)
4081 TRACE("(%p)\n", this);
4083 MSVCRT_operator_delete((char*)this->grouping);
4084 MSVCRT_operator_delete((char*)this->false_name);
4085 MSVCRT_operator_delete((char*)this->true_name);
4088 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
4089 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4090 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
4091 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
4092 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4094 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
4095 locale_facet_ctor_refs(&this->facet, refs);
4096 this->facet.vtable = &MSVCP_numpunct_char_vtable;
4097 numpunct_char__Init(this, locinfo, usedef);
4098 return this;
4101 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
4102 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
4103 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
4104 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
4105 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4107 _Locinfo locinfo;
4109 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
4110 locale_facet_ctor_refs(&this->facet, refs);
4111 this->facet.vtable = &MSVCP_numpunct_char_vtable;
4113 _Locinfo_ctor_cstr(&locinfo, name);
4114 numpunct_char__Init(this, &locinfo, usedef);
4115 _Locinfo_dtor(&locinfo);
4116 return this;
4119 /* ??0?$numpunct@D@std@@QAE@I@Z */
4120 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
4121 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
4122 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
4124 TRACE("(%p %lu)\n", this, refs);
4125 return numpunct_char_ctor_name(this, "C", refs, FALSE);
4128 /* ??_F?$numpunct@D@std@@QAEXXZ */
4129 /* ??_F?$numpunct@D@std@@QEAAXXZ */
4130 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
4131 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
4133 return numpunct_char_ctor_refs(this, 0);
4136 /* ??1?$numpunct@D@std@@UAE@XZ */
4137 /* ??1?$numpunct@D@std@@UEAA@XZ */
4138 /* ??1?$numpunct@D@std@@MAE@XZ */
4139 /* ??1?$numpunct@D@std@@MEAA@XZ */
4140 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
4141 void __thiscall numpunct_char_dtor(numpunct_char *this)
4143 TRACE("(%p)\n", this);
4144 numpunct_char__Tidy(this);
4147 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
4148 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
4150 TRACE("(%p %x)\n", this, flags);
4151 if(flags & 2) {
4152 /* we have an array, with the number of elements stored before the first object */
4153 INT_PTR i, *ptr = (INT_PTR *)this-1;
4155 for(i=*ptr-1; i>=0; i--)
4156 numpunct_char_dtor(this+i);
4157 MSVCRT_operator_delete(ptr);
4158 } else {
4159 numpunct_char_dtor(this);
4160 if(flags & 1)
4161 MSVCRT_operator_delete(this);
4164 return this;
4167 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4168 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4169 MSVCP_size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
4171 TRACE("(%p %p)\n", facet, loc);
4173 if(facet && !*facet) {
4174 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
4175 if(!*facet) {
4176 ERR("Out of memory\n");
4177 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4178 return 0;
4180 numpunct_char_ctor_name((numpunct_char*)*facet,
4181 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4184 return LC_NUMERIC;
4187 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z */
4188 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4189 MSVCP_size_t __cdecl numpunct_char__Getcat_old(const locale_facet **facet)
4191 return numpunct_char__Getcat(facet, locale_classic());
4194 static numpunct_char* numpunct_char_use_facet(const locale *loc)
4196 static numpunct_char *obj = NULL;
4198 _Lockit lock;
4199 const locale_facet *fac;
4201 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4202 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
4203 if(fac) {
4204 _Lockit_dtor(&lock);
4205 return (numpunct_char*)fac;
4208 if(obj) {
4209 _Lockit_dtor(&lock);
4210 return obj;
4213 numpunct_char__Getcat(&fac, loc);
4214 obj = (numpunct_char*)fac;
4215 call_locale_facet__Incref(&obj->facet);
4216 locale_facet_register(&obj->facet);
4217 _Lockit_dtor(&lock);
4219 return obj;
4222 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
4223 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
4224 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
4225 #if _MSVCP_VER <= 100
4226 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4227 char, (const numpunct_char *this), (this))
4228 #else
4229 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4230 char, (const numpunct_char *this), (this))
4231 #endif
4232 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
4234 TRACE("(%p)\n", this);
4235 return this->dp;
4238 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
4239 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
4240 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
4241 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
4243 TRACE("(%p)\n", this);
4244 return call_numpunct_char_do_decimal_point(this);
4247 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
4248 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
4249 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
4250 #if _MSVCP_VER <= 100
4251 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4252 char, (const numpunct_char*), (this))
4253 #else
4254 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4255 char, (const numpunct_char*), (this))
4256 #endif
4257 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
4259 TRACE("(%p)\n", this);
4260 return this->sep;
4263 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
4264 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
4265 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
4266 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
4268 TRACE("(%p)\n", this);
4269 return call_numpunct_char_do_thousands_sep(this);
4272 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4273 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4274 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
4275 #if _MSVCP_VER <= 100
4276 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4277 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4278 #else
4279 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4280 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4281 #endif
4282 basic_string_char* __thiscall numpunct_char_do_grouping(
4283 const numpunct_char *this, basic_string_char *ret)
4285 TRACE("(%p)\n", this);
4286 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4289 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4290 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4291 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
4292 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
4294 TRACE("(%p)\n", this);
4295 return call_numpunct_char_do_grouping(this, ret);
4298 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4299 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4300 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
4301 #if _MSVCP_VER <= 100
4302 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4303 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4304 #else
4305 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4306 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4307 #endif
4308 basic_string_char* __thiscall numpunct_char_do_falsename(
4309 const numpunct_char *this, basic_string_char *ret)
4311 TRACE("(%p)\n", this);
4312 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
4315 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4316 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4317 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
4318 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
4320 TRACE("(%p)\n", this);
4321 return call_numpunct_char_do_falsename(this, ret);
4324 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4325 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4326 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
4327 #if _MSVCP_VER <= 100
4328 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4329 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4330 #else
4331 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4332 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4333 #endif
4334 basic_string_char* __thiscall numpunct_char_do_truename(
4335 const numpunct_char *this, basic_string_char *ret)
4337 TRACE("(%p)\n", this);
4338 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
4341 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4342 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4343 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
4344 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
4346 TRACE("(%p)\n", this);
4347 return call_numpunct_char_do_truename(this, ret);
4350 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
4351 locale_id numpunct_wchar_id = {0};
4352 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
4353 locale_id numpunct_short_id = {0};
4355 /* ??_7?$numpunct@_W@std@@6B@ */
4356 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
4357 /* ??_7?$numpunct@G@std@@6B@ */
4358 extern const vtable_ptr MSVCP_numpunct_short_vtable;
4360 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
4361 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4362 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
4363 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4364 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
4365 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
4366 const _Locinfo *locinfo, MSVCP_bool isdef)
4368 const char *to_convert;
4369 _Cvtvec cvt;
4370 int len;
4372 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4374 _Locinfo__Getcvt(locinfo, &cvt);
4376 to_convert = _Locinfo__Getfalse(locinfo);
4377 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4378 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4379 if(this->false_name)
4380 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4381 (wchar_t*)this->false_name, len);
4383 to_convert = _Locinfo__Gettrue(locinfo);
4384 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4385 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4386 if(this->true_name)
4387 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4388 (wchar_t*)this->true_name, len);
4390 if(isdef) {
4391 this->grouping = MSVCRT_operator_new(1);
4392 if(this->grouping)
4393 *(char*)this->grouping = 0;
4395 this->dp = '.';
4396 this->sep = ',';
4397 } else {
4398 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4400 len = strlen(lc->grouping)+1;
4401 this->grouping = MSVCRT_operator_new(len);
4402 if(this->grouping)
4403 memcpy((char*)this->grouping, lc->grouping, len);
4405 this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
4406 this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
4409 if(!this->false_name || !this->true_name || !this->grouping) {
4410 MSVCRT_operator_delete((char*)this->grouping);
4411 MSVCRT_operator_delete((wchar_t*)this->false_name);
4412 MSVCRT_operator_delete((wchar_t*)this->true_name);
4414 ERR("Out of memory\n");
4415 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4419 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
4420 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
4421 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
4422 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
4423 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
4424 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
4426 TRACE("(%p)\n", this);
4428 MSVCRT_operator_delete((char*)this->grouping);
4429 MSVCRT_operator_delete((wchar_t*)this->false_name);
4430 MSVCRT_operator_delete((wchar_t*)this->true_name);
4433 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
4434 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4435 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
4436 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
4437 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4439 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
4440 locale_facet_ctor_refs(&this->facet, refs);
4441 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4442 numpunct_wchar__Init(this, locinfo, usedef);
4443 return this;
4446 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
4447 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4448 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
4449 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
4450 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4452 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
4453 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4454 return this;
4457 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
4458 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
4459 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
4460 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
4461 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4463 _Locinfo locinfo;
4465 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
4466 locale_facet_ctor_refs(&this->facet, refs);
4467 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4469 _Locinfo_ctor_cstr(&locinfo, name);
4470 numpunct_wchar__Init(this, &locinfo, usedef);
4471 _Locinfo_dtor(&locinfo);
4472 return this;
4475 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
4476 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
4477 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
4478 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
4479 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4481 numpunct_wchar_ctor_name(this, name, refs, usedef);
4482 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4483 return this;
4486 /* ??0?$numpunct@_W@std@@QAE@I@Z */
4487 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
4488 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
4489 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4491 TRACE("(%p %lu)\n", this, refs);
4492 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
4495 /* ??0?$numpunct@G@std@@QAE@I@Z */
4496 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
4497 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
4498 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4500 numpunct_wchar_ctor_refs(this, refs);
4501 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4502 return this;
4505 /* ??_F?$numpunct@_W@std@@QAEXXZ */
4506 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
4507 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
4508 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
4510 return numpunct_wchar_ctor_refs(this, 0);
4513 /* ??_F?$numpunct@G@std@@QAEXXZ */
4514 /* ??_F?$numpunct@G@std@@QEAAXXZ */
4515 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
4516 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
4518 return numpunct_short_ctor_refs(this, 0);
4521 /* ??1?$numpunct@G@std@@UAE@XZ */
4522 /* ??1?$numpunct@G@std@@UEAA@XZ */
4523 /* ??1?$numpunct@_W@std@@MAE@XZ */
4524 /* ??1?$numpunct@_W@std@@MEAA@XZ */
4525 /* ??1?$numpunct@G@std@@MAE@XZ */
4526 /* ??1?$numpunct@G@std@@MEAA@XZ */
4527 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
4528 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
4530 TRACE("(%p)\n", this);
4531 numpunct_wchar__Tidy(this);
4534 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
4535 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
4537 TRACE("(%p %x)\n", this, flags);
4538 if(flags & 2) {
4539 /* we have an array, with the number of elements stored before the first object */
4540 INT_PTR i, *ptr = (INT_PTR *)this-1;
4542 for(i=*ptr-1; i>=0; i--)
4543 numpunct_wchar_dtor(this+i);
4544 MSVCRT_operator_delete(ptr);
4545 } else {
4546 numpunct_wchar_dtor(this);
4547 if(flags & 1)
4548 MSVCRT_operator_delete(this);
4551 return this;
4554 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4555 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4556 MSVCP_size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
4558 TRACE("(%p %p)\n", facet, loc);
4560 if(facet && !*facet) {
4561 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4562 if(!*facet) {
4563 ERR("Out of memory\n");
4564 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4565 return 0;
4567 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
4568 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4571 return LC_NUMERIC;
4574 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@@Z */
4575 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4576 MSVCP_size_t __cdecl numpunct_wchar__Getcat_old(const locale_facet **facet)
4578 return numpunct_wchar__Getcat(facet, locale_classic());
4581 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
4583 static numpunct_wchar *obj = NULL;
4585 _Lockit lock;
4586 const locale_facet *fac;
4588 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4589 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
4590 if(fac) {
4591 _Lockit_dtor(&lock);
4592 return (numpunct_wchar*)fac;
4595 if(obj) {
4596 _Lockit_dtor(&lock);
4597 return obj;
4600 numpunct_wchar__Getcat(&fac, loc);
4601 obj = (numpunct_wchar*)fac;
4602 call_locale_facet__Incref(&obj->facet);
4603 locale_facet_register(&obj->facet);
4604 _Lockit_dtor(&lock);
4606 return obj;
4609 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4610 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4611 MSVCP_size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
4613 TRACE("(%p %p)\n", facet, loc);
4615 if(facet && !*facet) {
4616 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4617 if(!*facet) {
4618 ERR("Out of memory\n");
4619 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4620 return 0;
4622 numpunct_short_ctor_name((numpunct_wchar*)*facet,
4623 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4626 return LC_NUMERIC;
4629 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@@Z */
4630 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4631 MSVCP_size_t __cdecl numpunct_short__Getcat_old(const locale_facet **facet)
4633 return numpunct_short__Getcat(facet, locale_classic());
4636 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
4638 static numpunct_wchar *obj = NULL;
4640 _Lockit lock;
4641 const locale_facet *fac;
4643 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4644 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
4645 if(fac) {
4646 _Lockit_dtor(&lock);
4647 return (numpunct_wchar*)fac;
4650 if(obj) {
4651 _Lockit_dtor(&lock);
4652 return obj;
4655 numpunct_short__Getcat(&fac, loc);
4656 obj = (numpunct_wchar*)fac;
4657 call_locale_facet__Incref(&obj->facet);
4658 locale_facet_register(&obj->facet);
4659 _Lockit_dtor(&lock);
4661 return obj;
4664 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
4665 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
4666 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
4667 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
4668 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
4669 #if _MSVCP_VER <= 100
4670 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4671 wchar_t, (const numpunct_wchar *this), (this))
4672 #else
4673 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4674 wchar_t, (const numpunct_wchar *this), (this))
4675 #endif
4676 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
4678 TRACE("(%p)\n", this);
4679 return this->dp;
4682 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
4683 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
4684 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
4685 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
4686 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
4687 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
4689 TRACE("(%p)\n", this);
4690 return call_numpunct_wchar_do_decimal_point(this);
4693 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
4694 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
4695 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
4696 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
4697 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
4698 #if _MSVCP_VER <= 100
4699 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4700 wchar_t, (const numpunct_wchar *this), (this))
4701 #else
4702 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4703 wchar_t, (const numpunct_wchar *this), (this))
4704 #endif
4705 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
4707 TRACE("(%p)\n", this);
4708 return this->sep;
4711 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4712 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4713 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4714 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4715 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4716 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4718 TRACE("(%p)\n", this);
4719 return call_numpunct_wchar_do_thousands_sep(this);
4722 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4723 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4724 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4725 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4726 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4727 #if _MSVCP_VER <= 100
4728 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4729 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4730 #else
4731 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4732 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4733 #endif
4734 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4736 TRACE("(%p)\n", this);
4737 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4740 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4741 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4742 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4743 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4744 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4745 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4747 TRACE("(%p)\n", this);
4748 return call_numpunct_wchar_do_grouping(this, ret);
4751 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4752 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4753 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4754 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4755 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
4756 #if _MSVCP_VER <= 100
4757 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4758 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4759 #else
4760 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4761 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4762 #endif
4763 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4765 TRACE("(%p)\n", this);
4766 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4769 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4770 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4771 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4772 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4773 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4774 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4776 TRACE("(%p)\n", this);
4777 return call_numpunct_wchar_do_falsename(this, ret);
4780 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4781 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4782 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4783 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4784 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4785 #if _MSVCP_VER <= 100
4786 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4787 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4788 #else
4789 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4790 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4791 #endif
4792 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4794 TRACE("(%p)\n", this);
4795 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4798 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4799 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4800 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4801 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4802 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4803 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4805 TRACE("(%p)\n", this);
4806 return call_numpunct_wchar_do_truename(this, ret);
4809 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4811 double ret = strtod(buf, buf_end);
4813 if(exp)
4814 ret *= pow(10, exp);
4815 return ret;
4818 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4820 double ret;
4822 *err = *_errno();
4823 *_errno() = 0;
4824 ret = _Stod(buf, buf_end, exp);
4825 if(*_errno()) {
4826 *err = *_errno();
4827 }else {
4828 *_errno() = *err;
4829 *err = 0;
4831 return ret;
4834 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4836 return _Stod(buf, buf_end, exp);
4839 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4841 return _Stodx(buf, buf_end, exp, err);
4844 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
4846 return _strtoi64(buf, buf_end, base);
4849 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
4851 __int64 ret;
4853 *err = *_errno();
4854 *_errno() = 0;
4855 ret = _strtoi64(buf, buf_end, base);
4856 if(*_errno()) {
4857 *err = *_errno();
4858 }else {
4859 *_errno() = *err;
4860 *err = 0;
4862 return ret;
4865 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4867 __int64 i = _Stollx(buf, buf_end, base, err);
4868 if(!*err && i!=(__int64)((LONG)i))
4869 *err = ERANGE;
4870 return i;
4873 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
4875 return _strtoui64(buf, buf_end, base);
4878 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
4880 unsigned __int64 ret;
4882 *err = *_errno();
4883 *_errno() = 0;
4884 ret = _strtoui64(buf, buf_end, base);
4885 if(*_errno()) {
4886 *err = *_errno();
4887 }else {
4888 *_errno() = *err;
4889 *err = 0;
4891 return ret;
4894 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4896 int err;
4897 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4898 if(!err && i!=(unsigned __int64)((ULONG)i))
4899 *_errno() = ERANGE;
4900 return buf[0]=='-' ? -i : i;
4903 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4905 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4906 if(!*err && i!=(unsigned __int64)((ULONG)i))
4907 *err = ERANGE;
4908 return buf[0]=='-' ? -i : i;
4911 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4912 locale_id num_get_wchar_id = {0};
4913 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4914 locale_id num_get_short_id = {0};
4916 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4917 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4918 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4919 extern const vtable_ptr MSVCP_num_get_short_vtable;
4921 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4922 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4923 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4924 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4925 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4926 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4928 TRACE("(%p %p)\n", this, locinfo);
4929 #if _MSVCP_VER <= 100
4930 _Locinfo__Getcvt(locinfo, &this->cvt);
4931 #endif
4934 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4935 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4936 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4937 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4938 const _Locinfo *locinfo, MSVCP_size_t refs)
4940 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4942 locale_facet_ctor_refs(&this->facet, refs);
4943 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4945 num_get_wchar__Init(this, locinfo);
4946 return this;
4949 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4950 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4951 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4952 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4953 const _Locinfo *locinfo, MSVCP_size_t refs)
4955 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4956 this->facet.vtable = &MSVCP_num_get_short_vtable;
4957 return this;
4960 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4961 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4962 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4963 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4965 _Locinfo locinfo;
4967 TRACE("(%p %lu)\n", this, refs);
4969 _Locinfo_ctor(&locinfo);
4970 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4971 _Locinfo_dtor(&locinfo);
4972 return this;
4975 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4976 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4977 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4978 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4980 num_get_wchar_ctor_refs(this, refs);
4981 this->facet.vtable = &MSVCP_num_get_short_vtable;
4982 return this;
4985 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4986 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4987 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4988 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4990 return num_get_wchar_ctor_refs(this, 0);
4993 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4994 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4995 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4996 num_get* __thiscall num_get_short_ctor(num_get *this)
4998 return num_get_short_ctor_refs(this, 0);
5001 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
5002 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
5003 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
5004 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
5005 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
5006 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
5007 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
5008 void __thiscall num_get_wchar_dtor(num_get *this)
5010 TRACE("(%p)\n", this);
5011 locale_facet_dtor(&this->facet);
5014 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
5015 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
5017 TRACE("(%p %x)\n", this, flags);
5018 if(flags & 2) {
5019 /* we have an array, with the number of elements stored before the first object */
5020 INT_PTR i, *ptr = (INT_PTR *)this-1;
5022 for(i=*ptr-1; i>=0; i--)
5023 num_get_wchar_dtor(this+i);
5024 MSVCRT_operator_delete(ptr);
5025 } else {
5026 num_get_wchar_dtor(this);
5027 if(flags & 1)
5028 MSVCRT_operator_delete(this);
5031 return this;
5034 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5035 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5036 MSVCP_size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
5038 TRACE("(%p %p)\n", facet, loc);
5040 if(facet && !*facet) {
5041 _Locinfo locinfo;
5043 *facet = MSVCRT_operator_new(sizeof(num_get));
5044 if(!*facet) {
5045 ERR("Out of memory\n");
5046 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5047 return 0;
5050 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
5051 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5052 _Locinfo_dtor(&locinfo);
5055 return LC_NUMERIC;
5058 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5059 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5060 MSVCP_size_t __cdecl num_get_wchar__Getcat_old(const locale_facet **facet)
5062 return num_get_wchar__Getcat(facet, locale_classic());
5065 num_get* num_get_wchar_use_facet(const locale *loc)
5067 static num_get *obj = NULL;
5069 _Lockit lock;
5070 const locale_facet *fac;
5072 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5073 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
5074 if(fac) {
5075 _Lockit_dtor(&lock);
5076 return (num_get*)fac;
5079 if(obj) {
5080 _Lockit_dtor(&lock);
5081 return obj;
5084 num_get_wchar__Getcat(&fac, loc);
5085 obj = (num_get*)fac;
5086 call_locale_facet__Incref(&obj->facet);
5087 locale_facet_register(&obj->facet);
5088 _Lockit_dtor(&lock);
5090 return obj;
5093 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5094 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5095 MSVCP_size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
5097 if(facet && !*facet) {
5098 num_get_wchar__Getcat(facet, loc);
5099 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
5102 return LC_NUMERIC;
5105 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5106 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5107 MSVCP_size_t __cdecl num_get_short__Getcat_old(const locale_facet **facet)
5109 return num_get_short__Getcat(facet, locale_classic());
5112 num_get* num_get_short_use_facet(const locale *loc)
5114 static num_get *obj = NULL;
5116 _Lockit lock;
5117 const locale_facet *fac;
5119 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5120 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
5121 if(fac) {
5122 _Lockit_dtor(&lock);
5123 return (num_get*)fac;
5126 if(obj) {
5127 _Lockit_dtor(&lock);
5128 return obj;
5131 num_get_short__Getcat(&fac, loc);
5132 obj = (num_get*)fac;
5133 call_locale_facet__Incref(&obj->facet);
5134 locale_facet_register(&obj->facet);
5135 _Lockit_dtor(&lock);
5137 return obj;
5140 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5141 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
5143 basic_string_char grouping_bstr;
5144 basic_string_char groups_found;
5145 int i, groups_no = 0, cur_group = 0, exp = 0;
5146 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
5147 wchar_t sep = 0, digits[11], *digits_pos;
5148 const char *grouping, *groups;
5149 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5150 const _Cvtvec *cvt;
5152 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5154 #if _MSVCP_VER <= 100
5155 cvt = &this->cvt;
5156 #else
5157 cvt = &ctype_wchar_use_facet(loc)->cvt;
5158 #endif
5160 for(i=0; i<10; i++)
5161 digits[i] = mb_to_wc('0'+i, cvt);
5162 digits[10] = 0;
5164 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5165 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5166 #if _MSVCP_VER >= 70
5167 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5168 #endif
5170 if(sep)
5171 MSVCP_basic_string_char_ctor(&groups_found);
5173 istreambuf_iterator_wchar_val(first);
5174 /* get sign */
5175 if(first->strbuf && first->val==mb_to_wc('-', cvt)) {
5176 *dest++ = '-';
5177 istreambuf_iterator_wchar_inc(first);
5178 }else if(first->strbuf && first->val==mb_to_wc('+', cvt)) {
5179 *dest++ = '+';
5180 istreambuf_iterator_wchar_inc(first);
5183 /* read possibly grouped numbers before decimal */
5184 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5185 if(!(digits_pos = wcschr(digits, first->val))) {
5186 if(sep && first->val==sep) {
5187 if(!groups_no) break; /* empty group - stop parsing */
5188 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5189 groups_no = 0;
5190 ++cur_group;
5191 }else {
5192 break;
5194 }else {
5195 got_digit = TRUE; /* found a digit, zero or non-zero */
5196 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5197 if(!got_nonzero && first->val == digits[0])
5199 ++groups_no;
5200 continue;
5202 got_nonzero = TRUE;
5203 if(dest < num_end)
5204 *dest++ = '0'+digits_pos-digits;
5205 else
5206 exp++; /* too many digits, just multiply by 10 */
5207 if(sep && groups_no<CHAR_MAX)
5208 ++groups_no;
5212 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5213 if(got_digit && !got_nonzero)
5214 *dest++ = '0';
5216 /* get decimal, if any */
5217 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
5218 if(dest < num_end)
5219 *dest++ = *localeconv()->decimal_point;
5220 istreambuf_iterator_wchar_inc(first);
5223 /* read non-grouped after decimal */
5224 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5225 if(!(digits_pos = wcschr(digits, first->val)))
5226 break;
5227 else if(dest<num_end) {
5228 got_digit = TRUE;
5229 *dest++ = '0'+digits_pos-digits;
5233 /* read exponent, if any */
5234 if(first->strbuf && (first->val==mb_to_wc('e', cvt) || first->val==mb_to_wc('E', cvt))) {
5235 *dest++ = 'e';
5236 istreambuf_iterator_wchar_inc(first);
5238 if(first->strbuf && first->val==mb_to_wc('-', cvt)) {
5239 *dest++ = '-';
5240 istreambuf_iterator_wchar_inc(first);
5241 }else if(first->strbuf && first->val==mb_to_wc('+', cvt)) {
5242 *dest++ = '+';
5243 istreambuf_iterator_wchar_inc(first);
5246 got_digit = got_nonzero = FALSE;
5247 error = TRUE;
5248 /* skip any leading zeroes */
5249 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
5250 error = FALSE;
5252 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
5253 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5254 error = FALSE;
5255 if(dest<exp_end)
5256 *dest++ = '0'+digits_pos-digits;
5259 /* if just found zeroes for exponent, use that */
5260 if(got_digit && !got_nonzero)
5262 error = FALSE;
5263 if(dest<exp_end)
5264 *dest++ = '0';
5268 if(sep && groups_no)
5269 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5271 if(!cur_group) /* no groups, skip loop */
5272 cur_group--;
5273 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
5274 error = TRUE; /* trailing empty */
5276 for(; cur_group>=0 && !error; cur_group--) {
5277 if(*grouping == CHAR_MAX) {
5278 if(cur_group)
5279 error = TRUE;
5280 break;
5281 }else if((cur_group && *grouping!=groups[cur_group])
5282 || (!cur_group && *grouping<groups[cur_group])) {
5283 error = TRUE;
5284 break;
5285 }else if(grouping[1]) {
5286 grouping++;
5289 MSVCP_basic_string_char_dtor(&grouping_bstr);
5290 if(sep)
5291 MSVCP_basic_string_char_dtor(&groups_found);
5293 if(error) {
5294 *dest_beg = '\0';
5295 return 0;
5297 *dest++ = '\0';
5298 return exp;
5301 /* ?_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 */
5302 /* ?_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 */
5303 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5304 istreambuf_iterator_wchar *last, const locale *loc)
5306 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
5309 /* ?_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 */
5310 /* ?_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 */
5311 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5312 istreambuf_iterator_wchar *last, const locale *loc)
5314 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
5317 /* ?_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 */
5318 /* ?_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 */
5319 /* ?_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 */
5320 /* ?_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 */
5321 int __cdecl num_get_wchar__Getffldx(num_get *this, char *dest, istreambuf_iterator_wchar *first,
5322 istreambuf_iterator_wchar *last, ios_base *ios, int *phexexp)
5324 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
5325 return -1;
5328 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5329 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
5331 wchar_t digits[23], *digits_pos, sep = 0;
5332 basic_string_char grouping_bstr;
5333 basic_string_char groups_found;
5334 int i, basefield, base, groups_no = 0, cur_group = 0;
5335 char *dest_beg = dest, *dest_end = dest+24;
5336 const char *grouping, *groups;
5337 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5338 const _Cvtvec *cvt;
5340 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5342 #if _MSVCP_VER <= 100
5343 cvt = &this->cvt;
5344 #else
5345 cvt = &ctype_wchar_use_facet(loc)->cvt;
5346 #endif
5348 for(i=0; i<10; i++)
5349 digits[i] = mb_to_wc('0'+i, cvt);
5350 for(i=0; i<6; i++) {
5351 digits[10+i] = mb_to_wc('a'+i, cvt);
5352 digits[16+i] = mb_to_wc('A'+i, cvt);
5355 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5356 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5357 #if _MSVCP_VER >= 70
5358 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5359 #endif
5361 basefield = fmtflags & FMTFLAG_basefield;
5362 if(basefield == FMTFLAG_oct)
5363 base = 8;
5364 else if(basefield == FMTFLAG_hex)
5365 base = 22; /* equal to the size of digits buffer */
5366 else if(!basefield)
5367 base = 0;
5368 else
5369 base = 10;
5371 istreambuf_iterator_wchar_val(first);
5372 if(first->strbuf && first->val==mb_to_wc('-', cvt)) {
5373 *dest++ = '-';
5374 istreambuf_iterator_wchar_inc(first);
5375 }else if(first->strbuf && first->val==mb_to_wc('+', cvt)) {
5376 *dest++ = '+';
5377 istreambuf_iterator_wchar_inc(first);
5380 if(first->strbuf && first->val==digits[0]) {
5381 found_zero = TRUE;
5382 istreambuf_iterator_wchar_inc(first);
5383 if(first->strbuf && (first->val==mb_to_wc('x', cvt) || first->val==mb_to_wc('X', cvt))) {
5384 if(!base || base == 22) {
5385 found_zero = FALSE;
5386 istreambuf_iterator_wchar_inc(first);
5387 base = 22;
5388 }else {
5389 base = 10;
5391 }else {
5392 error = FALSE;
5393 if(!base) base = 8;
5395 }else {
5396 if(!base) base = 10;
5398 digits[base] = 0;
5400 if(sep) {
5401 MSVCP_basic_string_char_ctor(&groups_found);
5402 if(found_zero) ++groups_no;
5405 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5406 if(!(digits_pos = wcschr(digits, first->val))) {
5407 if(sep && first->val==sep) {
5408 if(!groups_no) break; /* empty group - stop parsing */
5409 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5410 groups_no = 0;
5411 ++cur_group;
5412 }else {
5413 break;
5415 }else {
5416 error = FALSE;
5417 if(dest_empty && first->val == digits[0]) {
5418 found_zero = TRUE;
5419 ++groups_no;
5420 continue;
5422 dest_empty = FALSE;
5423 /* skip digits that can't be copied to dest buffer, other
5424 * functions are responsible for detecting overflows */
5425 if(dest < dest_end)
5426 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
5427 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
5428 'A'+digits_pos-digits-16));
5429 if(sep && groups_no<CHAR_MAX)
5430 ++groups_no;
5434 if(sep && groups_no)
5435 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5437 if(!cur_group) { /* no groups, skip loop */
5438 cur_group--;
5439 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
5440 error = TRUE; /* trailing empty */
5441 found_zero = FALSE;
5444 for(; cur_group>=0 && !error; cur_group--) {
5445 if(*grouping == CHAR_MAX) {
5446 if(cur_group)
5447 error = TRUE;
5448 break;
5449 }else if((cur_group && *grouping!=groups[cur_group])
5450 || (!cur_group && *grouping<groups[cur_group])) {
5451 error = TRUE;
5452 break;
5453 }else if(grouping[1]) {
5454 grouping++;
5458 MSVCP_basic_string_char_dtor(&grouping_bstr);
5459 if(sep)
5460 MSVCP_basic_string_char_dtor(&groups_found);
5462 if(error) {
5463 if (found_zero)
5464 *dest++ = '0';
5465 else
5466 dest = dest_beg;
5467 }else if(dest_empty)
5468 *dest++ = '0';
5469 *dest = '\0';
5471 return (base==22 ? 16 : base);
5474 /* ?_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 */
5475 /* ?_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 */
5476 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5477 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5479 return num_get__Getifld(this, dest, first, last,
5480 fmtflags, loc, numpunct_wchar_use_facet(loc));
5483 /* ?_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 */
5484 /* ?_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 */
5485 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5486 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5488 return num_get__Getifld(this, dest, first, last,
5489 fmtflags, loc, numpunct_short_use_facet(loc));
5492 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABEH_W000@Z */
5493 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAH_W000@Z */
5494 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABEHGGGG@Z */
5495 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHGGGG@Z */
5496 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_wchar__Hexdig, 20)
5497 int __thiscall MSVCP_num_get_wchar__Hexdig(num_get *this, wchar_t dig, wchar_t e0, wchar_t al, wchar_t au)
5499 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
5500 return -1;
5503 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
5504 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5505 istreambuf_iterator_wchar last, ios_base *base, int *state,
5506 void **pval, numpunct_wchar *numpunct)
5508 unsigned __int64 v;
5509 char tmp[25], *end;
5510 int err;
5512 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5514 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5515 &last, FMTFLAG_hex, IOS_LOCALE(base), numpunct), &err);
5516 if(v!=(unsigned __int64)((INT_PTR)v))
5517 *state |= IOSTATE_failbit;
5518 else if(end!=tmp && !err)
5519 *pval = (void*)((INT_PTR)v);
5520 else
5521 *state |= IOSTATE_failbit;
5523 if(!first.strbuf)
5524 *state |= IOSTATE_eofbit;
5526 *ret = first;
5527 return ret;
5530 /* ?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 */
5531 /* ?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 */
5532 #if _MSVCP_VER <= 100
5533 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
5534 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5535 (this, ret, first, last, base, state, pval))
5536 #else
5537 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, 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 #endif
5541 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
5542 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5543 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5545 return num_get_do_get_void(this, ret, first, last, base,
5546 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5549 /* ?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 */
5550 /* ?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 */
5551 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
5552 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5553 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5555 return num_get_do_get_void(this, ret, first, last, base,
5556 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5559 /* ?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 */
5560 /* ?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 */
5561 /* ?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 */
5562 /* ?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 */
5563 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
5564 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5565 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5567 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5568 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
5571 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
5572 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5573 istreambuf_iterator_wchar last, ios_base *base, int *state,
5574 double *pval, numpunct_wchar *numpunct)
5576 double v;
5577 char tmp[32], *end;
5578 int err;
5580 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5582 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, IOS_LOCALE(base), numpunct), &err);
5583 if(end!=tmp && !err)
5584 *pval = v;
5585 else
5586 *state |= IOSTATE_failbit;
5588 if(!first.strbuf)
5589 *state |= IOSTATE_eofbit;
5591 *ret = first;
5592 return ret;
5595 /* ?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 */
5596 /* ?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 */
5597 /* ?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 */
5598 /* ?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 */
5599 #if _MSVCP_VER <= 100
5600 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
5601 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5602 (this, ret, first, last, base, state, pval))
5603 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5604 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5605 (this, ret, first, last, base, state, pval))
5606 #else
5607 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, 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 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5611 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5612 (this, ret, first, last, base, state, pval))
5613 #endif
5614 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
5615 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5616 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5618 return num_get_do_get_double(this, ret, first, last, base,
5619 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5622 /* ?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 */
5623 /* ?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 */
5624 /* ?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 */
5625 /* ?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 */
5626 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
5627 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5628 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5630 return num_get_do_get_double(this, ret, first, last, base,
5631 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5634 /* ?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 */
5635 /* ?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 */
5636 /* ?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 */
5637 /* ?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 */
5638 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
5639 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
5640 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5642 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5643 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
5646 /* ?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 */
5647 /* ?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 */
5648 /* ?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 */
5649 /* ?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 */
5650 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
5651 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5652 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5654 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5655 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
5658 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
5659 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5660 istreambuf_iterator_wchar last, ios_base *base, int *state,
5661 float *pval, numpunct_wchar *numpunct)
5663 float v;
5664 char tmp[32], *end;
5665 int err;
5667 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5669 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
5670 &last, IOS_LOCALE(base), numpunct), &err);
5671 if(end!=tmp && !err)
5672 *pval = v;
5673 else
5674 *state |= IOSTATE_failbit;
5676 if(!first.strbuf)
5677 *state |= IOSTATE_eofbit;
5679 *ret = first;
5680 return ret;
5683 /* ?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 */
5684 /* ?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 */
5685 #if _MSVCP_VER <= 100
5686 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5687 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5688 (this, ret, first, last, base, state, pval))
5689 #else
5690 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, 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 #endif
5694 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
5695 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5696 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5698 return num_get_do_get_float(this, ret, first, last, base,
5699 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5702 /* ?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 */
5703 /* ?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 */
5704 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
5705 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5706 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5708 return num_get_do_get_float(this, ret, first, last, base,
5709 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5712 /* ?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 */
5713 /* ?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 */
5714 /* ?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 */
5715 /* ?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 */
5716 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
5717 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5718 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5720 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5721 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
5724 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
5725 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5726 istreambuf_iterator_wchar last, ios_base *base, int *state,
5727 ULONGLONG *pval, numpunct_wchar *numpunct)
5729 unsigned __int64 v;
5730 char tmp[25], *end;
5731 int err;
5733 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5735 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5736 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5737 if(end!=tmp && !err)
5738 *pval = v;
5739 else
5740 *state |= IOSTATE_failbit;
5742 if(!first.strbuf)
5743 *state |= IOSTATE_eofbit;
5745 *ret = first;
5746 return ret;
5749 /* ?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 */
5750 /* ?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 */
5751 #if _MSVCP_VER <= 100
5752 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5753 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5754 (this, ret, first, last, base, state, pval))
5755 #else
5756 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, 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 #endif
5760 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
5761 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5762 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5764 return num_get_do_get_uint64(this, ret, first, last, base,
5765 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5768 /* ?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 */
5769 /* ?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 */
5770 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
5771 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5772 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5774 return num_get_do_get_uint64(this, ret, first, last, base,
5775 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5778 /* ?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 */
5779 /* ?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 */
5780 /* ?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 */
5781 /* ?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 */
5782 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5783 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5784 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5786 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5787 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5790 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5791 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5792 istreambuf_iterator_wchar last, ios_base *base, int *state,
5793 LONGLONG *pval, numpunct_wchar *numpunct)
5795 __int64 v;
5796 char tmp[25], *end;
5797 int err;
5799 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5801 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5802 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5803 if(end!=tmp && !err)
5804 *pval = v;
5805 else
5806 *state |= IOSTATE_failbit;
5808 if(!first.strbuf)
5809 *state |= IOSTATE_eofbit;
5811 *ret = first;
5812 return ret;
5815 /* ?do_get@?$num_get@_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 */
5816 /* ?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 */
5817 #if _MSVCP_VER <= 100
5818 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5819 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5820 (this, ret, first, last, base, state, pval))
5821 #else
5822 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, 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 #endif
5826 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5827 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5828 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5830 return num_get_do_get_int64(this, ret, first, last, base,
5831 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5834 /* ?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 */
5835 /* ?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 */
5836 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5837 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5838 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5840 return num_get_do_get_int64(this, ret, first, last, base,
5841 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5844 /* ?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 */
5845 /* ?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 */
5846 /* ?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 */
5847 /* ?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 */
5848 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5849 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5850 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5852 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5853 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5856 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5857 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5858 istreambuf_iterator_wchar last, ios_base *base, int *state,
5859 ULONG *pval, numpunct_wchar *numpunct)
5861 ULONG v;
5862 char tmp[25], *end;
5863 int err;
5865 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5867 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5868 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5869 if(end!=tmp && !err)
5870 *pval = v;
5871 else
5872 *state |= IOSTATE_failbit;
5874 if(!first.strbuf)
5875 *state |= IOSTATE_eofbit;
5877 *ret = first;
5878 return ret;
5881 /* ?do_get@?$num_get@_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 */
5882 /* ?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 */
5883 #if _MSVCP_VER <= 100
5884 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5885 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5886 (this, ret, first, last, base, state, pval))
5887 #else
5888 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, 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 #endif
5892 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5893 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5894 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5896 return num_get_do_get_ulong(this, ret, first, last, base,
5897 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5900 /* ?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 */
5901 /* ?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 */
5902 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5903 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5904 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5906 return num_get_do_get_ulong(this, ret, first, last, base,
5907 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5910 /* ?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 */
5911 /* ?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 */
5912 /* ?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 */
5913 /* ?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 */
5914 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5915 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5916 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5918 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5919 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5922 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5923 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5924 istreambuf_iterator_wchar last, ios_base *base, int *state,
5925 LONG *pval, numpunct_wchar *numpunct)
5927 LONG v;
5928 char tmp[25], *end;
5929 int err;
5931 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5933 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5934 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5935 if(end!=tmp && !err)
5936 *pval = v;
5937 else
5938 *state |= IOSTATE_failbit;
5940 if(!first.strbuf)
5941 *state |= IOSTATE_eofbit;
5943 *ret = first;
5944 return ret;
5947 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5948 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5949 #if _MSVCP_VER <= 100
5950 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5951 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5952 (this, ret, first, last, base, state, pval))
5953 #else
5954 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, 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 #endif
5958 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5959 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5960 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5962 return num_get_do_get_long(this, ret, first, last, base,
5963 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5966 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5967 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5968 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5969 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5970 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5972 return num_get_do_get_long(this, ret, first, last, base,
5973 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5976 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5977 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5978 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5979 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5980 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5981 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5982 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5984 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5985 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5988 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
5989 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
5990 #if _MSVCP_VER <= 100
5991 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5992 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5993 (this, ret, first, last, base, state, pval))
5994 #else
5995 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, 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 #endif
5999 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
6000 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
6001 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
6003 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6004 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
6007 /* ?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 */
6008 /* ?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 */
6009 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
6010 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
6011 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
6013 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6014 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
6017 /* ?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 */
6018 /* ?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 */
6019 /* ?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 */
6020 /* ?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 */
6021 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
6022 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
6023 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
6025 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6026 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
6029 /* ?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 */
6030 /* ?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 */
6031 #if _MSVCP_VER <= 100
6032 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
6033 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
6034 (this, ret, first, last, base, state, pval))
6035 #else
6036 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, 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 #endif
6040 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
6041 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6042 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6044 ULONG v;
6045 char tmp[25], *beg, *end;
6046 int err, b;
6048 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6050 b = num_get_wchar__Getifld(this, tmp,
6051 &first, &last, base->fmtfl, IOS_LOCALE(base));
6052 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6053 v = _Stoulx(beg, &end, b, &err);
6055 if(v != (ULONG)((unsigned short)v))
6056 *state |= IOSTATE_failbit;
6057 else if(end!=beg && !err)
6058 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6059 else
6060 *state |= IOSTATE_failbit;
6062 if(!first.strbuf)
6063 *state |= IOSTATE_eofbit;
6065 *ret = first;
6066 return ret;
6069 /* ?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 */
6070 /* ?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 */
6071 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
6072 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6073 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6075 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
6076 return ret;
6079 /* ?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 */
6080 /* ?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 */
6081 /* ?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@ */
6082 /* ?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 */
6083 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
6084 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6085 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6087 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6088 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
6091 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
6092 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
6093 istreambuf_iterator_wchar last, ios_base *base, int *state,
6094 MSVCP_bool *pval, numpunct_wchar *numpunct)
6096 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6098 if(base->fmtfl & FMTFLAG_boolalpha) {
6099 basic_string_wchar false_bstr, true_bstr;
6100 const wchar_t *pfalse, *ptrue;
6102 numpunct_wchar_falsename(numpunct, &false_bstr);
6103 numpunct_wchar_truename(numpunct, &true_bstr);
6104 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
6105 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
6107 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
6108 if(pfalse && *pfalse && first.val!=*pfalse)
6109 pfalse = NULL;
6110 if(ptrue && *ptrue && first.val!=*ptrue)
6111 ptrue = NULL;
6113 if(pfalse && *pfalse && ptrue && !*ptrue)
6114 ptrue = NULL;
6115 if(ptrue && *ptrue && pfalse && !*pfalse)
6116 pfalse = NULL;
6118 if(pfalse)
6119 pfalse++;
6120 if(ptrue)
6121 ptrue++;
6123 if(pfalse || ptrue)
6124 istreambuf_iterator_wchar_inc(&first);
6126 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6127 break;
6130 if(ptrue)
6131 *pval = TRUE;
6132 else if(pfalse)
6133 *pval = FALSE;
6134 else
6135 *state |= IOSTATE_failbit;
6137 MSVCP_basic_string_wchar_dtor(&false_bstr);
6138 MSVCP_basic_string_wchar_dtor(&true_bstr);
6139 }else {
6140 char tmp[25], *end;
6141 int err;
6142 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
6143 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
6145 if(end!=tmp && err==0 && (v==0 || v==1))
6146 *pval = v;
6147 else
6148 *state |= IOSTATE_failbit;
6151 if(!first.strbuf)
6152 *state |= IOSTATE_eofbit;
6153 memcpy(ret, &first, sizeof(first));
6154 return ret;
6157 /* ?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 */
6158 /* ?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 */
6159 #if _MSVCP_VER <= 100
6160 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
6161 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
6162 (this, ret, first, last, base, state, pval))
6163 #else
6164 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_wchar*, \
6165 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
6166 (this, ret, first, last, base, state, pval))
6167 #endif
6168 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
6169 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6170 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6172 return num_get_do_get_bool(this, ret, first, last, base,
6173 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
6176 /* ?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 */
6177 /* ?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 */
6178 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
6179 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6180 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6182 return num_get_do_get_bool(this, ret, first, last, base,
6183 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
6186 /* ?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 */
6187 /* ?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 */
6188 /* ?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 */
6189 /* ?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 */
6190 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
6191 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6192 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6194 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6195 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
6198 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6199 locale_id num_get_char_id = {0};
6201 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6202 extern const vtable_ptr MSVCP_num_get_char_vtable;
6204 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6205 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6206 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
6207 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
6209 TRACE("(%p %p)\n", this, locinfo);
6210 #if _MSVCP_VER <= 100
6211 _Locinfo__Getcvt(locinfo, &this->cvt);
6212 #endif
6215 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6216 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6217 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
6218 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
6219 const _Locinfo *locinfo, MSVCP_size_t refs)
6221 TRACE("(%p %p %lu)\n", this, locinfo, refs);
6223 locale_facet_ctor_refs(&this->facet, refs);
6224 this->facet.vtable = &MSVCP_num_get_char_vtable;
6226 num_get_char__Init(this, locinfo);
6227 return this;
6230 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6231 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6232 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
6233 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
6235 _Locinfo locinfo;
6237 TRACE("(%p %lu)\n", this, refs);
6239 _Locinfo_ctor(&locinfo);
6240 num_get_char_ctor_locinfo(this, &locinfo, refs);
6241 _Locinfo_dtor(&locinfo);
6242 return this;
6245 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6246 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6247 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
6248 num_get* __thiscall num_get_char_ctor(num_get *this)
6250 return num_get_char_ctor_refs(this, 0);
6253 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
6254 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
6255 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6256 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6257 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
6258 void __thiscall num_get_char_dtor(num_get *this)
6260 TRACE("(%p)\n", this);
6261 locale_facet_dtor(&this->facet);
6264 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
6265 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
6267 TRACE("(%p %x)\n", this, flags);
6268 if(flags & 2) {
6269 /* we have an array, with the number of elements stored before the first object */
6270 INT_PTR i, *ptr = (INT_PTR *)this-1;
6272 for(i=*ptr-1; i>=0; i--)
6273 num_get_char_dtor(this+i);
6274 MSVCRT_operator_delete(ptr);
6275 } else {
6276 num_get_char_dtor(this);
6277 if(flags & 1)
6278 MSVCRT_operator_delete(this);
6281 return this;
6284 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6285 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6286 MSVCP_size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
6288 TRACE("(%p %p)\n", facet, loc);
6290 if(facet && !*facet) {
6291 _Locinfo locinfo;
6293 *facet = MSVCRT_operator_new(sizeof(num_get));
6294 if(!*facet) {
6295 ERR("Out of memory\n");
6296 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6297 return 0;
6300 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6301 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
6302 _Locinfo_dtor(&locinfo);
6305 return LC_NUMERIC;
6308 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6309 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6310 MSVCP_size_t __cdecl num_get_char__Getcat_old(const locale_facet **facet)
6312 return num_get_char__Getcat(facet, locale_classic());
6315 num_get* num_get_char_use_facet(const locale *loc)
6317 static num_get *obj = NULL;
6319 _Lockit lock;
6320 const locale_facet *fac;
6322 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6323 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
6324 if(fac) {
6325 _Lockit_dtor(&lock);
6326 return (num_get*)fac;
6329 if(obj) {
6330 _Lockit_dtor(&lock);
6331 return obj;
6334 num_get_char__Getcat(&fac, loc);
6335 obj = (num_get*)fac;
6336 call_locale_facet__Incref(&obj->facet);
6337 locale_facet_register(&obj->facet);
6338 _Lockit_dtor(&lock);
6340 return obj;
6343 /* ?_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 */
6344 /* ?_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 */
6345 /* Copies number to dest buffer, validates grouping and skips separators.
6346 * Updates first so it points past the number, all digits are skipped.
6347 * Returns how exponent needs to changed.
6348 * Size of dest buffer is not specified, assuming it's not smaller than 32:
6349 * strlen(+0.e+) + 22(digits) + 4(exponent) + 1(nullbyte)
6351 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6352 istreambuf_iterator_char *last, const locale *loc)
6354 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6355 basic_string_char grouping_bstr;
6356 basic_string_char groups_found;
6357 int groups_no = 0, cur_group = 0, exp = 0;
6358 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep = 0;
6359 const char *grouping, *groups;
6360 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
6362 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
6364 numpunct_char_grouping(numpunct, &grouping_bstr);
6365 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6366 #if _MSVCP_VER >= 70
6367 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6368 #endif
6370 if(sep)
6371 MSVCP_basic_string_char_ctor(&groups_found);
6373 istreambuf_iterator_char_val(first);
6374 /* get sign */
6375 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6376 *dest++ = first->val;
6377 istreambuf_iterator_char_inc(first);
6380 /* read possibly grouped numbers before decimal */
6381 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6382 if(first->val<'0' || first->val>'9') {
6383 if(sep && first->val==sep) {
6384 if(!groups_no) break; /* empty group - stop parsing */
6385 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6386 groups_no = 0;
6387 ++cur_group;
6388 }else {
6389 break;
6391 }else {
6392 got_digit = TRUE; /* found a digit, zero or non-zero */
6393 /* write digit to dest if not a leading zero (to not waste dest buffer) */
6394 if(!got_nonzero && first->val == '0')
6396 ++groups_no;
6397 continue;
6399 got_nonzero = TRUE;
6400 if(dest < num_end)
6401 *dest++ = first->val;
6402 else
6403 exp++; /* too many digits, just multiply by 10 */
6404 if(sep && groups_no<CHAR_MAX)
6405 ++groups_no;
6409 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
6410 if(got_digit && !got_nonzero)
6411 *dest++ = '0';
6413 /* get decimal, if any */
6414 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
6415 if(dest < num_end)
6416 *dest++ = *localeconv()->decimal_point;
6417 istreambuf_iterator_char_inc(first);
6420 /* read non-grouped after decimal */
6421 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6422 if(first->val<'0' || first->val>'9')
6423 break;
6424 else if(dest<num_end) {
6425 got_digit = TRUE;
6426 *dest++ = first->val;
6430 /* read exponent, if any */
6431 if(first->strbuf && (first->val=='e' || first->val=='E')) {
6432 *dest++ = first->val;
6433 istreambuf_iterator_char_inc(first);
6435 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6436 *dest++ = first->val;
6437 istreambuf_iterator_char_inc(first);
6440 got_digit = got_nonzero = FALSE;
6441 error = TRUE;
6442 /* skip any leading zeroes */
6443 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
6444 got_digit = TRUE;
6446 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
6447 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
6448 error = FALSE;
6449 if(dest<exp_end)
6450 *dest++ = first->val;
6453 /* if just found zeroes for exponent, use that */
6454 if(got_digit && !got_nonzero)
6456 error = FALSE;
6457 if(dest<exp_end)
6458 *dest++ = '0';
6462 if(sep && groups_no)
6463 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6465 if(!cur_group) /* no groups, skip loop */
6466 cur_group--;
6467 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
6468 error = TRUE; /* trailing empty */
6470 for(; cur_group>=0 && !error; cur_group--) {
6471 if(*grouping == CHAR_MAX) {
6472 if(cur_group)
6473 error = TRUE;
6474 break;
6475 }else if((cur_group && *grouping!=groups[cur_group])
6476 || (!cur_group && *grouping<groups[cur_group])) {
6477 error = TRUE;
6478 break;
6479 }else if(grouping[1]) {
6480 grouping++;
6483 MSVCP_basic_string_char_dtor(&grouping_bstr);
6484 if(sep)
6485 MSVCP_basic_string_char_dtor(&groups_found);
6487 if(error) {
6488 *dest_beg = '\0';
6489 return 0;
6491 *dest++ = '\0';
6492 return exp;
6495 /* ?_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 */
6496 /* ?_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 */
6497 int __cdecl num_get_char__Getffldx(const num_get *this, char *dest, istreambuf_iterator_char *first,
6498 istreambuf_iterator_char *last, ios_base *ios, int *phexexp)
6500 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
6501 return -1;
6504 /* ?_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 */
6505 /* ?_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 */
6506 /* Copies number to dest buffer, validates grouping and skips separators.
6507 * Updates first so it points past the number, all digits are skipped.
6508 * Returns number base (8, 10 or 16).
6509 * Size of dest buffer is not specified, assuming it's not smaller than 25:
6510 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
6512 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6513 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
6515 static const char digits[] = "0123456789abcdefABCDEF";
6517 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6518 basic_string_char grouping_bstr;
6519 basic_string_char groups_found;
6520 int basefield, base, groups_no = 0, cur_group = 0;
6521 char *dest_beg = dest, *dest_end = dest+24, sep = 0;
6522 const char *grouping, *groups;
6523 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
6525 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
6527 numpunct_char_grouping(numpunct, &grouping_bstr);
6528 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6529 #if _MSVCP_VER >= 70
6530 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6531 #endif
6533 basefield = fmtflags & FMTFLAG_basefield;
6534 if(basefield == FMTFLAG_oct)
6535 base = 8;
6536 else if(basefield == FMTFLAG_hex)
6537 base = 22; /* equal to the size of digits buffer */
6538 else if(!basefield)
6539 base = 0;
6540 else
6541 base = 10;
6543 istreambuf_iterator_char_val(first);
6544 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6545 *dest++ = first->val;
6546 istreambuf_iterator_char_inc(first);
6549 if(first->strbuf && first->val=='0') {
6550 found_zero = TRUE;
6551 istreambuf_iterator_char_inc(first);
6552 if(first->strbuf && (first->val=='x' || first->val=='X')) {
6553 if(!base || base == 22) {
6554 found_zero = FALSE;
6555 istreambuf_iterator_char_inc(first);
6556 base = 22;
6557 }else {
6558 base = 10;
6560 }else {
6561 error = FALSE;
6562 if(!base) base = 8;
6564 }else {
6565 if (!base) base = 10;
6568 if(sep)
6570 MSVCP_basic_string_char_ctor(&groups_found);
6571 if(found_zero) ++groups_no;
6574 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6575 if(!memchr(digits, first->val, base)) {
6576 if(sep && first->val==sep) {
6577 if(!groups_no) break; /* empty group - stop parsing */
6578 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6579 groups_no = 0;
6580 ++cur_group;
6581 }else {
6582 break;
6584 }else {
6585 error = FALSE;
6586 if(dest_empty && first->val == '0')
6588 found_zero = TRUE;
6589 ++groups_no;
6590 continue;
6592 dest_empty = FALSE;
6593 /* skip digits that can't be copied to dest buffer, other
6594 * functions are responsible for detecting overflows */
6595 if(dest < dest_end)
6596 *dest++ = first->val;
6597 if(sep && groups_no<CHAR_MAX)
6598 ++groups_no;
6602 if(sep && groups_no)
6603 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6605 if(!cur_group) { /* no groups, skip loop */
6606 cur_group--;
6607 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
6608 error = TRUE; /* trailing empty */
6609 found_zero = FALSE;
6612 for(; cur_group>=0 && !error; cur_group--) {
6613 if(*grouping == CHAR_MAX) {
6614 if(cur_group)
6615 error = TRUE;
6616 break;
6617 }else if((cur_group && *grouping!=groups[cur_group])
6618 || (!cur_group && *grouping<groups[cur_group])) {
6619 error = TRUE;
6620 break;
6621 }else if(grouping[1]) {
6622 grouping++;
6626 MSVCP_basic_string_char_dtor(&grouping_bstr);
6627 if(sep)
6628 MSVCP_basic_string_char_dtor(&groups_found);
6630 if(error) {
6631 if (found_zero)
6632 *dest++ = '0';
6633 else
6634 dest = dest_beg;
6635 }else if(dest_empty)
6636 *dest++ = '0';
6637 *dest = '\0';
6639 return (base==22 ? 16 : base);
6642 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABEHD000@Z */
6643 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHD000@Z */
6644 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_char__Hexdig, 20)
6645 int __thiscall MSVCP_num_get_char__Hexdig(num_get *this, char dig, char e0, char al, char au)
6647 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
6648 return -1;
6651 /* ?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 */
6652 /* ?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 */
6653 #if _MSVCP_VER <= 100
6654 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
6655 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6656 (this, ret, first, last, base, state, pval))
6657 #else
6658 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, 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 #endif
6662 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
6663 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
6664 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6666 unsigned __int64 v;
6667 char tmp[25], *end;
6668 int err;
6670 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6672 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6673 &first, &last, FMTFLAG_hex, IOS_LOCALE(base)), &err);
6674 if(v!=(unsigned __int64)((INT_PTR)v))
6675 *state |= IOSTATE_failbit;
6676 else if(end!=tmp && !err)
6677 *pval = (void*)((INT_PTR)v);
6678 else
6679 *state |= IOSTATE_failbit;
6681 if(!first.strbuf)
6682 *state |= IOSTATE_eofbit;
6684 *ret = first;
6685 return ret;
6688 /* ?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 */
6689 /* ?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 */
6690 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
6691 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
6692 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6694 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6695 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
6698 /* ?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 */
6699 /* ?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 */
6700 /* ?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 */
6701 /* ?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 */
6702 #if _MSVCP_VER <= 100
6703 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
6704 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6705 (this, ret, first, last, base, state, pval))
6706 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6707 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6708 (this, ret, first, last, base, state, pval))
6709 #else
6710 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, 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 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6714 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6715 (this, ret, first, last, base, state, pval))
6716 #endif
6717 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
6718 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
6719 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6721 double v;
6722 char tmp[32], *end;
6723 int err;
6725 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6727 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6728 if(end!=tmp && !err)
6729 *pval = v;
6730 else
6731 *state |= IOSTATE_failbit;
6733 if(!first.strbuf)
6734 *state |= IOSTATE_eofbit;
6736 *ret = first;
6737 return ret;
6740 /* ?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 */
6741 /* ?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 */
6742 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
6743 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
6744 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6746 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6747 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
6750 /* ?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 */
6751 /* ?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 */
6752 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
6753 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
6754 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6756 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6757 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
6760 /* ?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 */
6761 /* ?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 */
6762 #if _MSVCP_VER <= 100
6763 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6764 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6765 (this, ret, first, last, base, state, pval))
6766 #else
6767 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, 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 #endif
6771 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
6772 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
6773 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6775 float v;
6776 char tmp[32], *end;
6777 int err;
6779 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6781 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6782 if(end!=tmp && !err)
6783 *pval = v;
6784 else
6785 *state |= IOSTATE_failbit;
6787 if(!first.strbuf)
6788 *state |= IOSTATE_eofbit;
6790 *ret = first;
6791 return ret;
6794 /* ?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 */
6795 /* ?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 */
6796 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
6797 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
6798 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6800 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6801 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
6804 /* ?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 */
6805 /* ?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 */
6806 #if _MSVCP_VER <= 100
6807 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6808 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6809 (this, ret, first, last, base, state, pval))
6810 #else
6811 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, 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 #endif
6815 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
6816 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6817 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6819 unsigned __int64 v;
6820 char tmp[25], *end;
6821 int err;
6823 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6825 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6826 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6827 if(end!=tmp && !err)
6828 *pval = v;
6829 else
6830 *state |= IOSTATE_failbit;
6832 if(!first.strbuf)
6833 *state |= IOSTATE_eofbit;
6835 *ret = first;
6836 return ret;
6839 /* ?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 */
6840 /* ?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 */
6841 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
6842 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6843 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6845 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6846 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
6849 /* ?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 */
6850 /* ?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 */
6851 #if _MSVCP_VER <= 100
6852 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6853 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6854 (this, ret, first, last, base, state, pval))
6855 #else
6856 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, 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 #endif
6860 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6861 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6862 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6864 __int64 v;
6865 char tmp[25], *end;
6866 int err;
6868 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6870 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6871 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6872 if(end!=tmp && !err)
6873 *pval = v;
6874 else
6875 *state |= IOSTATE_failbit;
6877 if(!first.strbuf)
6878 *state |= IOSTATE_eofbit;
6880 *ret = first;
6881 return ret;
6884 /* ?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 */
6885 /* ?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 */
6886 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6887 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6888 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6890 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6891 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6894 /* ?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 */
6895 /* ?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 */
6896 #if _MSVCP_VER <= 100
6897 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6898 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6899 (this, ret, first, last, base, state, pval))
6900 #else
6901 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, 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 #endif
6905 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6906 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6907 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6909 ULONG v;
6910 char tmp[25], *end;
6911 int err;
6913 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6915 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6916 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6917 if(end!=tmp && !err)
6918 *pval = v;
6919 else
6920 *state |= IOSTATE_failbit;
6922 if(!first.strbuf)
6923 *state |= IOSTATE_eofbit;
6925 *ret = first;
6926 return ret;
6929 /* ?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 */
6930 /* ?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 */
6931 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6932 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6933 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6935 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6936 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6939 /* ?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 */
6940 /* ?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 */
6941 #if _MSVCP_VER <= 100
6942 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6943 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6944 (this, ret, first, last, base, state, pval))
6945 #else
6946 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, 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 #endif
6950 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6951 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6952 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6954 LONG v;
6955 char tmp[25], *end;
6956 int err;
6958 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6960 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6961 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6962 if(end!=tmp && !err)
6963 *pval = v;
6964 else
6965 *state |= IOSTATE_failbit;
6967 if(!first.strbuf)
6968 *state |= IOSTATE_eofbit;
6970 *ret = first;
6971 return ret;
6974 /* ?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 */
6975 /* ?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 */
6976 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6977 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6978 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6980 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6981 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6984 /* ?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 */
6985 /* ?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 */
6986 #if _MSVCP_VER <= 100
6987 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6988 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6989 (this, ret, first, last, base, state, pval))
6990 #else
6991 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, 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 #endif
6995 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
6996 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6997 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6999 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7000 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
7003 /* ?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 */
7004 /* ?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 */
7005 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
7006 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
7007 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
7009 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7010 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
7013 /* ?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 */
7014 /* ?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 */
7015 #if _MSVCP_VER <= 100
7016 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
7017 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
7018 (this, ret, first, last, base, state, pval))
7019 #else
7020 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, 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 #endif
7024 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
7025 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
7026 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
7028 ULONG v;
7029 char tmp[25], *beg, *end;
7030 int err, b;
7032 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7034 b = num_get_char__Getifld(this, tmp,
7035 &first, &last, base->fmtfl, IOS_LOCALE(base));
7036 beg = tmp + (tmp[0]=='-' ? 1 : 0);
7037 v = _Stoulx(beg, &end, b, &err);
7039 if(v != (ULONG)((unsigned short)v))
7040 *state |= IOSTATE_failbit;
7041 else if(end!=beg && !err)
7042 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
7043 else
7044 *state |= IOSTATE_failbit;
7046 if(!first.strbuf)
7047 *state |= IOSTATE_eofbit;
7049 *ret = first;
7050 return ret;
7053 /* ?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 */
7054 /* ?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 */
7055 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
7056 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
7057 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
7059 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7060 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
7063 /* ?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 */
7064 /* ?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 */
7065 #if _MSVCP_VER <= 100
7066 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
7067 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
7068 (this, ret, first, last, base, state, pval))
7069 #else
7070 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_char*, \
7071 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
7072 (this, ret, first, last, base, state, pval))
7073 #endif
7074 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
7075 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
7076 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
7078 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7080 if(base->fmtfl & FMTFLAG_boolalpha) {
7081 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7082 basic_string_char false_bstr, true_bstr;
7083 const char *pfalse, *ptrue;
7085 numpunct_char_falsename(numpunct, &false_bstr);
7086 numpunct_char_truename(numpunct, &true_bstr);
7087 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
7088 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
7090 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
7091 if(pfalse && *pfalse && first.val!=*pfalse)
7092 pfalse = NULL;
7093 if(ptrue && *ptrue && first.val!=*ptrue)
7094 ptrue = NULL;
7096 if(pfalse && *pfalse && ptrue && !*ptrue)
7097 ptrue = NULL;
7098 if(ptrue && *ptrue && pfalse && !*pfalse)
7099 pfalse = NULL;
7101 if(pfalse)
7102 pfalse++;
7103 if(ptrue)
7104 ptrue++;
7106 if(pfalse || ptrue)
7107 istreambuf_iterator_char_inc(&first);
7109 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
7110 break;
7113 if(ptrue)
7114 *pval = TRUE;
7115 else if(pfalse)
7116 *pval = FALSE;
7117 else
7118 *state |= IOSTATE_failbit;
7120 MSVCP_basic_string_char_dtor(&false_bstr);
7121 MSVCP_basic_string_char_dtor(&true_bstr);
7122 }else {
7123 char tmp[25], *end;
7124 int err;
7125 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
7126 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
7128 if(end!=tmp && err==0 && (v==0 || v==1))
7129 *pval = v;
7130 else
7131 *state |= IOSTATE_failbit;
7134 if(!first.strbuf)
7135 *state |= IOSTATE_eofbit;
7136 memcpy(ret, &first, sizeof(first));
7137 return ret;
7140 /* ?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 */
7141 /* ?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 */
7142 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
7143 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
7144 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
7146 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7147 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
7150 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7151 locale_id num_put_char_id = {0};
7153 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7154 extern const vtable_ptr MSVCP_num_put_char_vtable;
7156 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7157 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7158 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
7159 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
7161 TRACE("(%p %p)\n", this, locinfo);
7162 #if _MSVCP_VER < 110
7163 _Locinfo__Getcvt(locinfo, &this->cvt);
7164 #endif
7167 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7168 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7169 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
7170 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7172 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7174 locale_facet_ctor_refs(&this->facet, refs);
7175 this->facet.vtable = &MSVCP_num_put_char_vtable;
7177 num_put_char__Init(this, locinfo);
7178 return this;
7181 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7182 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7183 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
7184 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
7186 _Locinfo locinfo;
7188 TRACE("(%p %lu)\n", this, refs);
7190 _Locinfo_ctor(&locinfo);
7191 num_put_char_ctor_locinfo(this, &locinfo, refs);
7192 _Locinfo_dtor(&locinfo);
7193 return this;
7196 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7197 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7198 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
7199 num_put* __thiscall num_put_char_ctor(num_put *this)
7201 return num_put_char_ctor_refs(this, 0);
7204 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
7205 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
7206 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7207 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7208 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
7209 void __thiscall num_put_char_dtor(num_put *this)
7211 TRACE("(%p)\n", this);
7212 locale_facet_dtor(&this->facet);
7215 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
7216 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
7218 TRACE("(%p %x)\n", this, flags);
7219 if(flags & 2) {
7220 /* we have an array, with the number of elements stored before the first object */
7221 INT_PTR i, *ptr = (INT_PTR *)this-1;
7223 for(i=*ptr-1; i>=0; i--)
7224 num_put_char_dtor(this+i);
7225 MSVCRT_operator_delete(ptr);
7226 } else {
7227 num_put_char_dtor(this);
7228 if(flags & 1)
7229 MSVCRT_operator_delete(this);
7232 return this;
7235 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7236 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7237 MSVCP_size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
7239 TRACE("(%p %p)\n", facet, loc);
7241 if(facet && !*facet) {
7242 _Locinfo locinfo;
7244 *facet = MSVCRT_operator_new(sizeof(num_put));
7245 if(!*facet) {
7246 ERR("Out of memory\n");
7247 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7248 return 0;
7251 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7252 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7253 _Locinfo_dtor(&locinfo);
7256 return LC_NUMERIC;
7259 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7260 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7261 MSVCP_size_t __cdecl num_put_char__Getcat_old(const locale_facet **facet)
7263 return num_put_char__Getcat(facet, locale_classic());
7266 num_put* num_put_char_use_facet(const locale *loc)
7268 static num_put *obj = NULL;
7270 _Lockit lock;
7271 const locale_facet *fac;
7273 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7274 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
7275 if(fac) {
7276 _Lockit_dtor(&lock);
7277 return (num_put*)fac;
7280 if(obj) {
7281 _Lockit_dtor(&lock);
7282 return obj;
7285 num_put_char__Getcat(&fac, loc);
7286 obj = (num_put*)fac;
7287 call_locale_facet__Incref(&obj->facet);
7288 locale_facet_register(&obj->facet);
7289 _Lockit_dtor(&lock);
7291 return obj;
7294 /* ?_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 */
7295 /* ?_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 */
7296 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
7297 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7299 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7301 for(; count>0; count--)
7302 ostreambuf_iterator_char_put(&dest, *ptr++);
7304 *ret = dest;
7305 return ret;
7308 /* ?_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 */
7309 /* ?_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 */
7310 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
7311 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7313 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7315 for(; count>0; count--)
7316 ostreambuf_iterator_char_put(&dest, *ptr++);
7318 *ret = dest;
7319 return ret;
7322 /* ?_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 */
7323 /* ?_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 */
7324 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
7325 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count, char delim)
7327 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7328 return NULL;
7331 /* ?_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 */
7332 /* ?_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 */
7333 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
7334 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
7336 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7338 for(; count>0; count--)
7339 ostreambuf_iterator_char_put(&dest, c);
7341 *ret = dest;
7342 return ret;
7345 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
7346 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7347 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7349 int type = fmtfl & FMTFLAG_floatfield;
7350 char *p = fmt;
7352 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7354 *p++ = '%';
7355 if(fmtfl & FMTFLAG_showpos)
7356 *p++ = '+';
7357 if(fmtfl & FMTFLAG_showpoint)
7358 *p++ = '#';
7359 *p++ = '.';
7360 *p++ = '*';
7361 if(spec)
7362 *p++ = spec;
7364 if(type == FMTFLAG_fixed)
7365 *p++ = 'f';
7366 else if(type == FMTFLAG_scientific)
7367 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7368 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7369 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7370 else
7371 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7373 *p++ = '\0';
7374 return fmt;
7377 /* ?_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 */
7378 /* ?_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 */
7379 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
7380 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, MSVCP_size_t bef_point,
7381 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7383 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7384 fill, buf, bef_point, aft_point, trailing, count);
7385 return NULL;
7388 /* TODO: This function should be removed when num_put_char__Fput is implemented */
7389 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
7390 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7392 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7393 basic_string_char grouping_bstr;
7394 const char *grouping;
7395 char *p, sep = 0, dec_point = *localeconv()->decimal_point;
7396 int cur_group = 0, group_size = 0;
7397 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7398 MSVCP_size_t pad;
7400 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7402 /* Change decimal point */
7403 for(p=buf; p<buf+count; p++) {
7404 if(*p == dec_point) {
7405 *p = numpunct_char_decimal_point(numpunct);
7406 break;
7409 p--;
7411 /* Add separators to number */
7412 numpunct_char_grouping(numpunct, &grouping_bstr);
7413 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7414 #if _MSVCP_VER >= 70
7415 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7416 #endif
7418 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7419 group_size++;
7420 if(group_size == grouping[cur_group]) {
7421 group_size = 0;
7422 if(grouping[cur_group+1])
7423 cur_group++;
7425 memmove(p+1, p, buf+count-p);
7426 *p = sep;
7427 count++;
7430 MSVCP_basic_string_char_dtor(&grouping_bstr);
7432 /* Display number with padding */
7433 if(count >= base->wide)
7434 pad = 0;
7435 else
7436 pad = base->wide-count;
7437 base->wide = 0;
7439 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7440 num_put_char__Putc(this, &dest, dest, buf, 1);
7441 buf++;
7443 if(adjustfield != FMTFLAG_left) {
7444 num_put_char__Rep(this, ret, dest, fill, pad);
7445 pad = 0;
7447 num_put_char__Putc(this, &dest, dest, buf, count);
7448 return num_put_char__Rep(this, ret, dest, fill, pad);
7451 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
7452 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7453 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7455 int base = fmtfl & FMTFLAG_basefield;
7456 char *p = fmt;
7458 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7460 *p++ = '%';
7461 if(fmtfl & FMTFLAG_showpos)
7462 *p++ = '+';
7463 if(fmtfl & FMTFLAG_showbase)
7464 *p++ = '#';
7466 *p++ = *spec++;
7467 if(*spec == 'l')
7468 *p++ = *spec++;
7470 if(base == FMTFLAG_oct)
7471 *p++ = 'o';
7472 else if(base == FMTFLAG_hex)
7473 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7474 else
7475 *p++ = *spec;
7477 *p++ = '\0';
7478 return fmt;
7481 /* ?_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 */
7482 /* ?_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 */
7483 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
7484 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7486 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7487 basic_string_char grouping_bstr;
7488 const char *grouping;
7489 char *p, sep = 0;
7490 int cur_group = 0, group_size = 0;
7491 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7492 MSVCP_size_t pad;
7494 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7496 /* Add separators to number */
7497 numpunct_char_grouping(numpunct, &grouping_bstr);
7498 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7499 #if _MSVCP_VER >= 70
7500 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7501 #endif
7503 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7504 group_size++;
7505 if(group_size == grouping[cur_group]) {
7506 group_size = 0;
7507 if(grouping[cur_group+1])
7508 cur_group++;
7510 memmove(p+1, p, buf+count-p);
7511 *p = sep;
7512 count++;
7515 MSVCP_basic_string_char_dtor(&grouping_bstr);
7517 /* Display number with padding */
7518 if(count >= base->wide)
7519 pad = 0;
7520 else
7521 pad = base->wide-count;
7522 base->wide = 0;
7524 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7525 num_put_char__Putc(this, &dest, dest, buf, 1);
7526 buf++;
7527 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7528 num_put_char__Putc(this, &dest, dest, buf, 2);
7529 buf += 2;
7531 if(adjustfield != FMTFLAG_left) {
7532 num_put_char__Rep(this, ret, dest, fill, pad);
7533 pad = 0;
7535 num_put_char__Putc(this, &dest, dest, buf, count);
7536 return num_put_char__Rep(this, ret, dest, fill, pad);
7539 /* ?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 */
7540 /* ?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 */
7541 #if _MSVCP_VER <= 100
7542 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7543 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7544 (this, ret, dest, base, fill, v))
7545 #else
7546 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, 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 #endif
7550 #if _MSVCP_VER != 80
7551 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
7552 #else
7553 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 32)
7554 #endif
7555 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7556 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7558 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7559 char fmt[7]; /* strlen("%+#lld")+1 */
7561 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7563 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7564 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
7567 /* ?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 */
7568 /* ?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 */
7569 #if _MSVCP_VER != 80
7570 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
7571 #else
7572 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 32)
7573 #endif
7574 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7575 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7577 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7578 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
7581 /* ?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 */
7582 /* ?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 */
7583 #if _MSVCP_VER <= 100
7584 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7585 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7586 (this, ret, dest, base, fill, v))
7587 #else
7588 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, 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 #endif
7592 #if _MSVCP_VER != 80
7593 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
7594 #else
7595 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 32)
7596 #endif
7597 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7598 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7600 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7601 char fmt[7]; /* strlen("%+#lld")+1 */
7603 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7605 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7606 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
7609 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DK@Z */
7610 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DK@Z */
7611 #if _MSVCP_VER != 80
7612 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
7613 #else
7614 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 32)
7615 #endif
7616 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7617 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7619 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7620 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
7623 static inline unsigned get_precision(const ios_base *base)
7625 streamsize ret = base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
7626 if(ret > UINT_MAX)
7627 ret = UINT_MAX;
7628 return ret;
7631 /* ?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 */
7632 /* ?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 */
7633 /* ?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 */
7634 /* ?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 */
7635 #if _MSVCP_VER <= 100
7636 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7637 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7638 (this, ret, dest, base, fill, v))
7639 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
7640 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7641 (this, ret, dest, base, fill, v))
7642 #else
7643 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, 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 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7647 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7648 (this, ret, dest, base, fill, v))
7649 #endif
7650 #if _MSVCP_VER != 80
7651 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
7652 #else
7653 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 36)
7654 #endif
7655 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7656 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7658 char *tmp;
7659 char fmt[8]; /* strlen("%+#.*lg")+1 */
7660 int size;
7661 unsigned prec;
7663 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7665 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
7666 prec = get_precision(base);
7667 size = _scprintf(fmt, prec, v);
7669 /* TODO: don't use dynamic allocation */
7670 tmp = MSVCRT_operator_new(size*2);
7671 if(!tmp) {
7672 ERR("Out of memory\n");
7673 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7675 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
7676 MSVCRT_operator_delete(tmp);
7677 return ret;
7680 /* ?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 */
7681 /* ?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 */
7682 #if _MSVCP_VER != 80
7683 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
7684 #else
7685 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 36)
7686 #endif
7687 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7688 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7690 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7691 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
7694 /* ?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 */
7695 /* ?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 */
7696 #if _MSVCP_VER != 80
7697 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
7698 #else
7699 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 36)
7700 #endif
7701 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
7702 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7704 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7705 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
7708 /* ?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 */
7709 /* ?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 */
7710 #if _MSVCP_VER <= 100
7711 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7712 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7713 (this, ret, dest, base, fill, v))
7714 #else
7715 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, 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 #endif
7719 #if _MSVCP_VER != 80
7720 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
7721 #else
7722 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 32)
7723 #endif
7724 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7725 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7727 char tmp[17]; /* 8(16^8==2^64)*2(separators between every digit) + 1 */
7729 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7731 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7734 /* ?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 */
7735 /* ?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 */
7736 #if _MSVCP_VER != 80
7737 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
7738 #else
7739 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 32)
7740 #endif
7741 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7742 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7744 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7745 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
7748 /* ?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 */
7749 /* ?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 */
7750 #if _MSVCP_VER <= 100
7751 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7752 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7753 (this, ret, dest, base, fill, v))
7754 #else
7755 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, 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 #endif
7759 #if _MSVCP_VER != 80
7760 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
7761 #else
7762 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 36)
7763 #endif
7764 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7765 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7767 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7768 char fmt[7]; /* strlen("%+#lld")+1 */
7770 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7772 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7773 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
7776 /* ?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 */
7777 /* ?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 */
7778 #if _MSVCP_VER != 80
7779 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
7780 #else
7781 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 36)
7782 #endif
7783 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7784 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7786 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7787 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
7790 /* ?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 */
7791 /* ?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 */
7792 #if _MSVCP_VER <= 100
7793 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7794 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7795 (this, ret, dest, base, fill, v))
7796 #else
7797 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, 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 #endif
7801 #if _MSVCP_VER != 80
7802 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
7803 #else
7804 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 36)
7805 #endif
7806 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7807 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7809 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
7810 char fmt[7]; /* strlen("%+#lld")+1 */
7812 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7814 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7815 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
7818 /* ?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 */
7819 /* ?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 */
7820 #if _MSVCP_VER != 80
7821 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
7822 #else
7823 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 36)
7824 #endif
7825 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7826 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7828 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7829 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
7832 /* ?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 */
7833 /* ?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 */
7834 #if _MSVCP_VER <= 100
7835 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7836 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7837 (this, ret, dest, base, fill, v))
7838 #else
7839 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_char*, \
7840 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7841 (this, ret, dest, base, fill, v))
7842 #endif
7843 #if _MSVCP_VER != 80
7844 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
7845 #else
7846 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 32)
7847 #endif
7848 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7849 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7851 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7853 if(base->fmtfl & FMTFLAG_boolalpha) {
7854 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7855 basic_string_char str;
7856 MSVCP_size_t pad, len;
7858 if(v)
7859 numpunct_char_truename(numpunct, &str);
7860 else
7861 numpunct_char_falsename(numpunct, &str);
7863 len = MSVCP_basic_string_char_length(&str);
7864 pad = (len>base->wide ? 0 : base->wide-len);
7865 base->wide = 0;
7867 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7868 num_put_char__Rep(this, &dest, dest, fill, pad);
7869 pad = 0;
7871 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
7872 MSVCP_basic_string_char_dtor(&str);
7873 return num_put_char__Rep(this, ret, dest, fill, pad);
7876 return num_put_char_put_long(this, ret, dest, base, fill, v);
7879 /* ?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 */
7880 /* ?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 */
7881 #if _MSVCP_VER != 80
7882 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
7883 #else
7884 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 32)
7885 #endif
7886 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7887 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7889 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7890 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
7893 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7894 locale_id num_put_wchar_id = {0};
7895 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7896 locale_id num_put_short_id = {0};
7898 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7899 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
7900 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7901 extern const vtable_ptr MSVCP_num_put_short_vtable;
7903 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7904 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7905 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
7906 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
7908 TRACE("(%p %p)\n", this, locinfo);
7909 #if _MSVCP_VER < 110
7910 _Locinfo__Getcvt(locinfo, &this->cvt);
7911 #endif
7914 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7915 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7916 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
7917 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7919 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7921 locale_facet_ctor_refs(&this->facet, refs);
7922 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
7924 num_put_wchar__Init(this, locinfo);
7925 return this;
7928 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7929 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7930 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
7931 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7933 num_put_wchar_ctor_locinfo(this, locinfo, refs);
7934 this->facet.vtable = &MSVCP_num_put_short_vtable;
7935 return this;
7938 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7939 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7940 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
7941 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
7943 _Locinfo locinfo;
7945 TRACE("(%p %lu)\n", this, refs);
7947 _Locinfo_ctor(&locinfo);
7948 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
7949 _Locinfo_dtor(&locinfo);
7950 return this;
7953 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7954 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7955 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
7956 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
7958 num_put_wchar_ctor_refs(this, refs);
7959 this->facet.vtable = &MSVCP_num_put_short_vtable;
7960 return this;
7963 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7964 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7965 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
7966 num_put* __thiscall num_put_wchar_ctor(num_put *this)
7968 return num_put_wchar_ctor_refs(this, 0);
7971 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7972 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7973 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
7974 num_put* __thiscall num_put_short_ctor(num_put *this)
7976 return num_put_short_ctor_refs(this, 0);
7979 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
7980 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
7981 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7982 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7983 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7984 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7985 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
7986 void __thiscall num_put_wchar_dtor(num_put *this)
7988 TRACE("(%p)\n", this);
7989 locale_facet_dtor(&this->facet);
7992 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
7993 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
7995 TRACE("(%p %x)\n", this, flags);
7996 if(flags & 2) {
7997 /* we have an array, with the number of elements stored before the first object */
7998 INT_PTR i, *ptr = (INT_PTR *)this-1;
8000 for(i=*ptr-1; i>=0; i--)
8001 num_put_wchar_dtor(this+i);
8002 MSVCRT_operator_delete(ptr);
8003 } else {
8004 num_put_wchar_dtor(this);
8005 if(flags & 1)
8006 MSVCRT_operator_delete(this);
8009 return this;
8012 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8013 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8014 MSVCP_size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
8016 TRACE("(%p %p)\n", facet, loc);
8018 if(facet && !*facet) {
8019 _Locinfo locinfo;
8021 *facet = MSVCRT_operator_new(sizeof(num_put));
8022 if(!*facet) {
8023 ERR("Out of memory\n");
8024 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8025 return 0;
8028 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8029 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
8030 _Locinfo_dtor(&locinfo);
8033 return LC_NUMERIC;
8036 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8037 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8038 MSVCP_size_t __cdecl num_put_wchar__Getcat_old(const locale_facet **facet)
8040 return num_put_wchar__Getcat(facet, locale_classic());
8043 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8044 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8045 MSVCP_size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
8047 TRACE("(%p %p)\n", facet, loc);
8049 if(facet && !*facet) {
8050 _Locinfo locinfo;
8052 *facet = MSVCRT_operator_new(sizeof(num_put));
8053 if(!*facet) {
8054 ERR("Out of memory\n");
8055 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8056 return 0;
8059 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8060 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
8061 _Locinfo_dtor(&locinfo);
8064 return LC_NUMERIC;
8067 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8068 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8069 MSVCP_size_t __cdecl num_put_short__Getcat_old(const locale_facet **facet)
8071 return num_put_short__Getcat(facet, locale_classic());
8074 num_put* num_put_wchar_use_facet(const locale *loc)
8076 static num_put *obj = NULL;
8078 _Lockit lock;
8079 const locale_facet *fac;
8081 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8082 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
8083 if(fac) {
8084 _Lockit_dtor(&lock);
8085 return (num_put*)fac;
8088 if(obj) {
8089 _Lockit_dtor(&lock);
8090 return obj;
8093 num_put_wchar__Getcat(&fac, loc);
8094 obj = (num_put*)fac;
8095 call_locale_facet__Incref(&obj->facet);
8096 locale_facet_register(&obj->facet);
8097 _Lockit_dtor(&lock);
8099 return obj;
8102 num_put* num_put_short_use_facet(const locale *loc)
8104 static num_put *obj = NULL;
8106 _Lockit lock;
8107 const locale_facet *fac;
8109 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8110 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
8111 if(fac) {
8112 _Lockit_dtor(&lock);
8113 return (num_put*)fac;
8116 if(obj) {
8117 _Lockit_dtor(&lock);
8118 return obj;
8121 num_put_short__Getcat(&fac, loc);
8122 obj = (num_put*)fac;
8123 call_locale_facet__Incref(&obj->facet);
8124 locale_facet_register(&obj->facet);
8125 _Lockit_dtor(&lock);
8127 return obj;
8130 /* ?_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 */
8131 /* ?_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 */
8132 /* ?_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 */
8133 /* ?_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 */
8134 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
8135 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
8137 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
8139 for(; count>0; count--)
8140 ostreambuf_iterator_wchar_put(&dest, *ptr++);
8142 *ret = dest;
8143 return ret;
8146 #if _MSVCP_VER < 110
8147 /* ?_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 */
8148 /* ?_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 */
8149 /* ?_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 */
8150 /* ?_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 */
8151 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
8152 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
8154 _Mbstatet state;
8155 wchar_t ch;
8157 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
8159 memset(&state, 0, sizeof(state));
8160 for(; count>0; count--) {
8161 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
8162 ostreambuf_iterator_wchar_put(&dest, ch);
8165 *ret = dest;
8166 return ret;
8168 #endif
8170 /* ?_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 */
8171 /* ?_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 */
8172 /* ?_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 */
8173 /* ?_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 */
8174 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
8175 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count, wchar_t delim)
8177 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
8178 return NULL;
8181 /* ?_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 */
8182 /* ?_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 */
8183 /* ?_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 */
8184 /* ?_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 */
8185 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
8186 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
8188 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
8190 for(; count>0; count--)
8191 ostreambuf_iterator_wchar_put(&dest, c);
8193 *ret = dest;
8194 return ret;
8197 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
8198 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8199 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
8200 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8201 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
8203 int type = fmtfl & FMTFLAG_floatfield;
8204 char *p = fmt;
8206 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
8208 *p++ = '%';
8209 if(fmtfl & FMTFLAG_showpos)
8210 *p++ = '+';
8211 if(fmtfl & FMTFLAG_showbase)
8212 *p++ = '#';
8213 *p++ = '.';
8214 *p++ = '*';
8215 if(spec)
8216 *p++ = spec;
8218 if(type == FMTFLAG_fixed)
8219 *p++ = 'f';
8220 else if(type == FMTFLAG_scientific)
8221 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
8222 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
8223 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
8224 else
8225 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
8227 *p++ = '\0';
8228 return fmt;
8231 /* ?_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 */
8232 /* ?_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 */
8233 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8234 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
8235 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
8237 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
8238 fill, buf, bef_point, aft_point, trailing, count);
8239 return NULL;
8242 /* ?_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 */
8243 /* ?_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 */
8244 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8245 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
8246 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
8248 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
8249 fill, buf, bef_point, aft_point, trailing, count);
8250 return NULL;
8253 #if _MSVCP_VER < 110
8254 static void num_put_wchar_wide_put(const num_put *this,
8255 ostreambuf_iterator_wchar *dest, ios_base *base,
8256 const char *buf, MSVCP_size_t count)
8258 num_put_wchar__Putc(this, dest, *dest, buf, count);
8260 #else
8261 static void num_put_wchar_wide_put(const num_put *this,
8262 ostreambuf_iterator_wchar *dest, ios_base *base,
8263 const char *buf, MSVCP_size_t count)
8265 ctype_wchar *ctype;
8266 MSVCP_size_t i;
8268 ctype = ctype_wchar_use_facet(IOS_LOCALE(base));
8269 for(i=0; i<count; i++)
8270 ostreambuf_iterator_wchar_put(dest, ctype_wchar_widen_ch(ctype, buf[i]));
8272 #endif
8274 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
8275 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8276 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8277 MSVCP_size_t count, numpunct_wchar *numpunct)
8279 basic_string_char grouping_bstr;
8280 const char *grouping;
8281 char *p, dec_point = *localeconv()->decimal_point;
8282 wchar_t sep = 0;
8283 int cur_group = 0, group_size = 0;
8284 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8285 MSVCP_size_t i, pad;
8287 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8289 for(p=buf; p<buf+count; p++) {
8290 if(*p == dec_point)
8291 break;
8293 p--;
8295 /* Add separators to number */
8296 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8297 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8298 #if _MSVCP_VER >= 70
8299 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
8300 #endif
8302 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8303 group_size++;
8304 if(group_size == grouping[cur_group]) {
8305 group_size = 0;
8306 if(grouping[cur_group+1])
8307 cur_group++;
8309 memmove(p+1, p, buf+count-p);
8310 *p = '\0'; /* mark thousands separator positions */
8311 count++;
8314 MSVCP_basic_string_char_dtor(&grouping_bstr);
8316 /* Display number with padding */
8317 if(count >= base->wide)
8318 pad = 0;
8319 else
8320 pad = base->wide-count;
8321 base->wide = 0;
8323 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8324 num_put_wchar_wide_put(this, &dest, base, buf, 1);
8325 buf++;
8327 if(adjustfield != FMTFLAG_left) {
8328 num_put_wchar__Rep(this, ret, dest, fill, pad);
8329 pad = 0;
8332 for(i=0; i<count; i++) {
8333 if(buf[i] == dec_point)
8334 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
8335 else if(!buf[i])
8336 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8337 else
8338 num_put_wchar_wide_put(this, &dest, base, buf+i, 1);
8341 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8344 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
8345 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8346 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
8347 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8348 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
8350 int base = fmtfl & FMTFLAG_basefield;
8351 char *p = fmt;
8353 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
8355 *p++ = '%';
8356 if(fmtfl & FMTFLAG_showpos)
8357 *p++ = '+';
8358 if(fmtfl & FMTFLAG_showbase)
8359 *p++ = '#';
8361 *p++ = *spec++;
8362 if(*spec == 'l')
8363 *p++ = *spec++;
8365 if(base == FMTFLAG_oct)
8366 *p++ = 'o';
8367 else if(base == FMTFLAG_hex)
8368 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
8369 else
8370 *p++ = *spec;
8372 *p++ = '\0';
8373 return fmt;
8376 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8377 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8378 MSVCP_size_t count, numpunct_wchar *numpunct)
8380 basic_string_char grouping_bstr;
8381 const char *grouping;
8382 char *p;
8383 wchar_t sep;
8384 int cur_group = 0, group_size = 0;
8385 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8386 MSVCP_size_t i, pad;
8388 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8390 /* Add separators to number */
8391 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8392 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8393 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
8395 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8396 group_size++;
8397 if(group_size == grouping[cur_group]) {
8398 group_size = 0;
8399 if(grouping[cur_group+1])
8400 cur_group++;
8402 memmove(p+1, p, buf+count-p);
8403 *p = '\0'; /* mark thousands separator positions */
8404 count++;
8407 MSVCP_basic_string_char_dtor(&grouping_bstr);
8409 /* Display number with padding */
8410 if(count >= base->wide)
8411 pad = 0;
8412 else
8413 pad = base->wide-count;
8414 base->wide = 0;
8416 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8417 num_put_wchar_wide_put(this, &dest, base, buf, 1);
8418 buf++;
8419 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
8420 num_put_wchar_wide_put(this, &dest, base, buf, 2);
8421 buf += 2;
8423 if(adjustfield != FMTFLAG_left) {
8424 num_put_wchar__Rep(this, ret, dest, fill, pad);
8425 pad = 0;
8428 for(i=0; i<count; i++) {
8429 if(!buf[i])
8430 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8431 else
8432 num_put_wchar_wide_put(this, &dest, base, buf+i, 1);
8435 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8438 /* ?_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 */
8439 /* ?_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 */
8440 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8441 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8443 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(IOS_LOCALE(base)));
8446 /* ?_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 */
8447 /* ?_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 */
8448 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8449 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8451 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(IOS_LOCALE(base)));
8454 /* ?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 */
8455 /* ?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 */
8456 #if _MSVCP_VER <= 100
8457 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8458 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8459 (this, ret, dest, base, fill, v))
8460 #else
8461 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, 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 #endif
8465 #if _MSVCP_VER != 80
8466 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
8467 #else
8468 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 32)
8469 #endif
8470 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8471 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8473 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8474 char fmt[7]; /* strlen("%+#lld")+1 */
8476 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8478 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8479 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8482 /* ?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 */
8483 /* ?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 */
8484 #if _MSVCP_VER != 80
8485 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
8486 #else
8487 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 32)
8488 #endif
8489 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8490 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8492 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8493 char fmt[7]; /* strlen("%+#lld")+1 */
8495 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8497 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8498 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8501 /* ?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 */
8502 /* ?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 */
8503 /* ?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 */
8504 /* ?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 */
8505 #if _MSVCP_VER != 80
8506 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
8507 #else
8508 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 32)
8509 #endif
8510 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8511 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8513 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8514 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
8517 /* ?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 */
8518 /* ?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 */
8519 #if _MSVCP_VER <= 100
8520 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8521 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8522 (this, ret, dest, base, fill, v))
8523 #else
8524 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, 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 #endif
8528 #if _MSVCP_VER != 80
8529 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
8530 #else
8531 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 32)
8532 #endif
8533 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8534 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8536 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8537 char fmt[7]; /* strlen("%+#lld")+1 */
8539 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8541 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8542 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8545 /* ?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 */
8546 /* ?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 */
8547 #if _MSVCP_VER != 80
8548 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
8549 #else
8550 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 32)
8551 #endif
8552 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8553 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8555 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8556 char fmt[7]; /* strlen("%+#lld")+1 */
8558 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8560 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8561 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8564 /* ?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 */
8565 /* ?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 */
8566 /* ?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 */
8567 /* ?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 */
8568 #if _MSVCP_VER != 80
8569 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
8570 #else
8571 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 32)
8572 #endif
8573 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8574 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8576 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8577 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
8580 /* ?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 */
8581 /* ?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 */
8582 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WO@Z */
8583 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WO@Z */
8584 #if _MSVCP_VER <= 100
8585 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8586 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8587 (this, ret, dest, base, fill, v))
8588 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
8589 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8590 (this, ret, dest, base, fill, v))
8591 #else
8592 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, 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 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8596 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8597 (this, ret, dest, base, fill, v))
8598 #endif
8599 #if _MSVCP_VER != 80
8600 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
8601 #else
8602 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 36)
8603 #endif
8604 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8605 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8607 char *tmp;
8608 char fmt[8]; /* strlen("%+#.*lg")+1 */
8609 int size;
8610 unsigned prec;
8612 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8614 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8615 prec = get_precision(base);
8616 size = _scprintf(fmt, prec, v);
8618 /* TODO: don't use dynamic allocation */
8619 tmp = MSVCRT_operator_new(size*2);
8620 if(!tmp) {
8621 ERR("Out of memory\n");
8622 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8624 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8625 numpunct_wchar_use_facet(IOS_LOCALE(base)));
8626 MSVCRT_operator_delete(tmp);
8627 return ret;
8630 /* ?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 */
8631 /* ?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 */
8632 /* ?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 */
8633 /* ?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 */
8634 #if _MSVCP_VER != 80
8635 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
8636 #else
8637 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 36)
8638 #endif
8639 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8640 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8642 char *tmp;
8643 char fmt[8]; /* strlen("%+#.*lg")+1 */
8644 int size;
8645 unsigned prec;
8647 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8649 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8650 prec = get_precision(base);
8651 size = _scprintf(fmt, prec, v);
8653 /* TODO: don't use dynamic allocation */
8654 tmp = MSVCRT_operator_new(size*2);
8655 if(!tmp) {
8656 ERR("Out of memory\n");
8657 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8659 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8660 numpunct_short_use_facet(IOS_LOCALE(base)));
8661 MSVCRT_operator_delete(tmp);
8662 return ret;
8665 /* ?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 */
8666 /* ?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 */
8667 /* ?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 */
8668 /* ?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 */
8669 #if _MSVCP_VER != 80
8670 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
8671 #else
8672 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 36)
8673 #endif
8674 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8675 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8677 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8678 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
8681 /* ?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 */
8682 /* ?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 */
8683 /* ?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 */
8684 /* ?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 */
8685 #if _MSVCP_VER != 80
8686 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
8687 #else
8688 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 36)
8689 #endif
8690 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
8691 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8693 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8694 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
8697 /* ?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 */
8698 /* ?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 */
8699 #if _MSVCP_VER <= 100
8700 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
8701 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8702 (this, ret, dest, base, fill, v))
8703 #else
8704 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, 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 #endif
8708 #if _MSVCP_VER != 80
8709 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
8710 #else
8711 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 32)
8712 #endif
8713 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8714 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8716 char tmp[17]; /* 8(16^8==2^64)*2(separators between every digit) + 1 */
8718 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8720 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8723 /* ?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 */
8724 /* ?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 */
8725 #if _MSVCP_VER != 80
8726 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
8727 #else
8728 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 32)
8729 #endif
8730 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8731 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8733 char tmp[17]; /* 8(16^8==2^64)*2(separators between every digit) + 1 */
8735 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8737 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8740 /* ?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 */
8741 /* ?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 */
8742 /* ?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 */
8743 /* ?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 */
8744 #if _MSVCP_VER != 80
8745 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
8746 #else
8747 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 32)
8748 #endif
8749 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8750 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8752 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8753 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
8756 /* ?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 */
8757 /* ?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 */
8758 #if _MSVCP_VER <= 100
8759 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8760 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8761 (this, ret, dest, base, fill, v))
8762 #else
8763 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, 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 #endif
8767 #if _MSVCP_VER != 80
8768 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
8769 #else
8770 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 36)
8771 #endif
8772 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8773 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8775 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8776 char fmt[7]; /* strlen("%+#lld")+1 */
8778 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8780 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8781 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8784 /* ?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 */
8785 /* ?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 */
8786 #if _MSVCP_VER != 80
8787 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
8788 #else
8789 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 36)
8790 #endif
8791 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8792 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8794 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8795 char fmt[7]; /* strlen("%+#lld")+1 */
8797 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8799 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8800 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8803 /* ?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 */
8804 /* ?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 */
8805 /* ?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 */
8806 /* ?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 */
8807 #if _MSVCP_VER != 80
8808 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
8809 #else
8810 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 36)
8811 #endif
8812 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8813 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8815 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8816 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
8819 /* ?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 */
8820 /* ?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 */
8821 #if _MSVCP_VER <= 100
8822 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8823 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8824 (this, ret, dest, base, fill, v))
8825 #else
8826 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, 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 #endif
8830 #if _MSVCP_VER != 80
8831 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
8832 #else
8833 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 36)
8834 #endif
8835 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8836 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8838 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8839 char fmt[7]; /* strlen("%+#lld")+1 */
8841 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8843 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8844 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8847 /* ?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 */
8848 /* ?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 */
8849 #if _MSVCP_VER != 80
8850 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
8851 #else
8852 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 36)
8853 #endif
8854 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8855 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8857 char tmp[48]; /* 22(8^22>2^64)*2(separators between every digit) + 3(strlen("+0x"))+1 */
8858 char fmt[7]; /* strlen("%+#lld")+1 */
8860 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8862 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8863 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8866 /* ?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 */
8867 /* ?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 */
8868 /* ?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 */
8869 /* ?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 */
8870 #if _MSVCP_VER != 80
8871 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
8872 #else
8873 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 36)
8874 #endif
8875 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8876 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8878 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8879 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
8882 /* ?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 */
8883 /* ?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 */
8884 #if _MSVCP_VER <= 100
8885 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8886 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8887 (this, ret, dest, base, fill, v))
8888 #else
8889 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_wchar*, \
8890 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8891 (this, ret, dest, base, fill, v))
8892 #endif
8893 #if _MSVCP_VER != 80
8894 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
8895 #else
8896 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 32)
8897 #endif
8898 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8899 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8901 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8903 if(base->fmtfl & FMTFLAG_boolalpha) {
8904 numpunct_wchar *numpunct = numpunct_wchar_use_facet(IOS_LOCALE(base));
8905 basic_string_wchar str;
8906 MSVCP_size_t pad, len;
8908 if(v)
8909 numpunct_wchar_truename(numpunct, &str);
8910 else
8911 numpunct_wchar_falsename(numpunct, &str);
8913 len = MSVCP_basic_string_wchar_length(&str);
8914 pad = (len>base->wide ? 0 : base->wide-len);
8915 base->wide = 0;
8917 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8918 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8919 pad = 0;
8921 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8922 MSVCP_basic_string_wchar_dtor(&str);
8923 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8926 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8929 /* ?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 */
8930 /* ?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 */
8931 #if _MSVCP_VER != 80
8932 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
8933 #else
8934 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 32)
8935 #endif
8936 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8937 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8939 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8941 if(base->fmtfl & FMTFLAG_boolalpha) {
8942 numpunct_wchar *numpunct = numpunct_short_use_facet(IOS_LOCALE(base));
8943 basic_string_wchar str;
8944 MSVCP_size_t pad, len;
8946 if(v)
8947 numpunct_wchar_truename(numpunct, &str);
8948 else
8949 numpunct_wchar_falsename(numpunct, &str);
8951 len = MSVCP_basic_string_wchar_length(&str);
8952 pad = (len>base->wide ? 0 : base->wide-len);
8953 base->wide = 0;
8955 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8956 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8957 pad = 0;
8959 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8960 MSVCP_basic_string_wchar_dtor(&str);
8961 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8964 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8967 /* ?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 */
8968 /* ?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 */
8969 /* ?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 */
8970 /* ?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 */
8971 #if _MSVCP_VER != 80
8972 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
8973 #else
8974 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 32)
8975 #endif
8976 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8977 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8979 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8980 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
8983 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
8984 locale_id time_put_char_id = {0};
8986 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
8987 extern const vtable_ptr MSVCP_time_put_char_vtable;
8989 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8990 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8991 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
8992 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
8994 TRACE("(%p %p)\n", this, locinfo);
8995 _Locinfo__Gettnames(locinfo, &this->time);
8996 #if _MSVCP_VER <= 100
8997 _Locinfo__Getcvt(locinfo, &this->cvt);
8998 #endif
9001 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9002 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9003 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
9004 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9006 TRACE("(%p %p %lu)\n", this, locinfo, refs);
9007 locale_facet_ctor_refs(&this->facet, refs);
9008 this->facet.vtable = &MSVCP_time_put_char_vtable;
9009 time_put_char__Init(this, locinfo);
9010 return this;
9013 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
9014 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
9015 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
9016 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
9018 _Locinfo locinfo;
9020 TRACE("(%p %lu)\n", this, refs);
9022 _Locinfo_ctor(&locinfo);
9023 time_put_char_ctor_locinfo(this, &locinfo, refs);
9024 _Locinfo_dtor(&locinfo);
9025 return this;
9028 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
9029 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
9030 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
9031 time_put* __thiscall time_put_char_ctor(time_put *this)
9033 return time_put_char_ctor_refs(this, 0);
9036 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
9037 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
9038 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
9039 void __thiscall time_put_char_dtor(time_put *this)
9041 TRACE("(%p)\n", this);
9042 _Timevec_dtor(&this->time);
9045 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
9046 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
9048 TRACE("(%p %x)\n", this, flags);
9049 if(flags & 2) {
9050 /* we have an array, with the number of elements stored before the first object */
9051 INT_PTR i, *ptr = (INT_PTR *)this-1;
9053 for(i=*ptr-1; i>=0; i--)
9054 time_put_char_dtor(this+i);
9055 MSVCRT_operator_delete(ptr);
9056 } else {
9057 time_put_char_dtor(this);
9058 if(flags & 1)
9059 MSVCRT_operator_delete(this);
9062 return this;
9065 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9066 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9067 MSVCP_size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *loc)
9069 TRACE("(%p %p)\n", facet, loc);
9071 if(facet && !*facet) {
9072 _Locinfo locinfo;
9074 *facet = MSVCRT_operator_new(sizeof(time_put));
9075 if(!*facet) {
9076 ERR("Out of memory\n");
9077 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9078 return 0;
9081 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9082 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
9083 _Locinfo_dtor(&locinfo);
9086 return LC_TIME;
9089 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9090 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9091 MSVCP_size_t __cdecl time_put_char__Getcat_old(const locale_facet **facet)
9093 return time_put_char__Getcat(facet, locale_classic());
9096 static time_put* time_put_char_use_facet(const locale *loc)
9098 static time_put *obj = NULL;
9100 _Lockit lock;
9101 const locale_facet *fac;
9103 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9104 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id));
9105 if(fac) {
9106 _Lockit_dtor(&lock);
9107 return (time_put*)fac;
9110 if(obj) {
9111 _Lockit_dtor(&lock);
9112 return obj;
9115 time_put_char__Getcat(&fac, loc);
9116 obj = (time_put*)fac;
9117 call_locale_facet__Incref(&obj->facet);
9118 locale_facet_register(&obj->facet);
9119 _Lockit_dtor(&lock);
9121 return obj;
9124 #if _MSVCP_VER >= 70
9126 /* ?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 */
9127 /* ?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 */
9128 #if _MSVCP_VER != 80
9129 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 36)
9130 #else
9131 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 40)
9132 #endif
9133 #if _MSVCP_VER <= 100
9134 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9135 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
9136 (this, ret, dest, base, fill, t, spec, mod))
9137 #else
9138 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, 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 #endif
9142 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9143 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
9145 char buf[64], fmt[4], *p = fmt;
9146 MSVCP_size_t i, len;
9148 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9150 *p++ = '%';
9151 if(mod)
9152 *p++ = mod;
9153 *p++ = spec;
9154 *p++ = 0;
9156 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9157 for(i=0; i<len; i++)
9158 ostreambuf_iterator_char_put(&dest, buf[i]);
9160 *ret = dest;
9161 return ret;
9164 /* ?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 */
9165 /* ?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 */
9166 #if _MSVCP_VER != 80
9167 DEFINE_THISCALL_WRAPPER(time_put_char_put, 36)
9168 #else
9169 DEFINE_THISCALL_WRAPPER(time_put_char_put, 40)
9170 #endif
9171 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9172 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
9174 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9175 return call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod);
9178 /* ?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 */
9179 /* ?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 */
9180 #if _MSVCP_VER != 80
9181 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 36)
9182 #else
9183 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 40)
9184 #endif
9185 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9186 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, const char *pat, const char *pat_end)
9188 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_an(pat, pat_end-pat));
9190 while(pat < pat_end) {
9191 if(*pat != '%') {
9192 ostreambuf_iterator_char_put(&dest, *pat++);
9193 }else if(++pat == pat_end) {
9194 ostreambuf_iterator_char_put(&dest, '%');
9195 }else if(*pat=='#' && pat+1==pat_end) {
9196 ostreambuf_iterator_char_put(&dest, '%');
9197 ostreambuf_iterator_char_put(&dest, *pat++);
9198 }else {
9199 char mod;
9201 if(*pat == '#') {
9202 mod = '#';
9203 pat++;
9204 }else {
9205 mod = 0;
9208 time_put_char_put(this, &dest, dest, base, fill, t, *pat++, mod);
9212 *ret = dest;
9213 return ret;
9216 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9218 /* ?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 */
9219 /* ?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 */
9220 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
9221 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9222 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
9223 (this, ret, dest, base, t, spec, mod))
9224 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9225 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9227 char buf[64], fmt[4], *p = fmt;
9228 MSVCP_size_t i, len;
9230 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9232 *p++ = '%';
9233 if(mod)
9234 *p++ = mod;
9235 *p++ = spec;
9236 *p++ = 0;
9238 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9239 for(i=0; i<len; i++)
9240 ostreambuf_iterator_char_put(&dest, buf[i]);
9242 *ret = dest;
9243 return ret;
9246 /* ?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 */
9247 /* ?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 */
9248 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
9249 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9250 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9252 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9253 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
9256 /* ?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 */
9257 /* ?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 */
9258 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
9259 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9260 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
9262 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
9264 while(pat < pat_end) {
9265 if(*pat != '%') {
9266 ostreambuf_iterator_char_put(&dest, *pat++);
9267 }else if(++pat == pat_end) {
9268 ostreambuf_iterator_char_put(&dest, '%');
9269 }else if(*pat=='#' && pat+1==pat_end) {
9270 ostreambuf_iterator_char_put(&dest, '%');
9271 ostreambuf_iterator_char_put(&dest, *pat++);
9272 }else {
9273 char mod;
9275 if(*pat == '#') {
9276 mod = '#';
9277 pat++;
9278 }else {
9279 mod = 0;
9282 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
9286 *ret = dest;
9287 return ret;
9290 #endif /* MSVCP_VER >= 70 */
9292 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
9293 locale_id time_put_wchar_id = {0};
9294 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
9295 locale_id time_put_short_id = {0};
9297 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
9298 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
9299 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
9300 extern const vtable_ptr MSVCP_time_put_short_vtable;
9302 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9303 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9304 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9305 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9306 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
9307 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
9309 TRACE("(%p %p)\n", this, locinfo);
9310 _Locinfo__Gettnames(locinfo, &this->time);
9311 #if _MSVCP_VER <= 100
9312 _Locinfo__Getcvt(locinfo, &this->cvt);
9313 #endif
9316 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9317 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9318 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
9319 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9321 TRACE("(%p %p %lu)\n", this, locinfo, refs);
9322 locale_facet_ctor_refs(&this->facet, refs);
9323 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
9324 time_put_wchar__Init(this, locinfo);
9325 return this;
9328 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9329 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9330 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
9331 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9333 time_put_wchar_ctor_locinfo(this, locinfo, refs);
9334 this->facet.vtable = &MSVCP_time_put_short_vtable;
9335 return this;
9338 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
9339 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
9340 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
9341 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
9343 _Locinfo locinfo;
9345 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
9347 _Locinfo_ctor_cstr(&locinfo, name);
9348 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9349 _Locinfo_dtor(&locinfo);
9350 return this;
9353 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
9354 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
9355 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
9356 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
9358 time_put_wchar_ctor_name(this, name, refs);
9359 this->facet.vtable = &MSVCP_time_put_short_vtable;
9360 return this;
9363 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
9364 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
9365 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
9366 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
9368 _Locinfo locinfo;
9370 TRACE("(%p %lu)\n", this, refs);
9372 _Locinfo_ctor(&locinfo);
9373 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9374 _Locinfo_dtor(&locinfo);
9375 return this;
9378 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
9379 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
9380 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
9381 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
9383 time_put_wchar_ctor_refs(this, refs);
9384 this->facet.vtable = &MSVCP_time_put_short_vtable;
9385 return this;
9388 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
9389 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
9390 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
9391 time_put* __thiscall time_put_wchar_ctor(time_put *this)
9393 return time_put_wchar_ctor_refs(this, 0);
9396 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
9397 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
9398 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
9399 time_put* __thiscall time_put_short_ctor(time_put *this)
9401 time_put_wchar_ctor(this);
9402 this->facet.vtable = &MSVCP_time_put_short_vtable;
9403 return this;
9406 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
9407 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
9408 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
9409 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
9410 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
9411 void __thiscall time_put_wchar_dtor(time_put *this)
9413 TRACE("(%p)\n", this);
9414 _Timevec_dtor(&this->time);
9417 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
9418 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
9420 TRACE("(%p %x)\n", this, flags);
9421 if(flags & 2) {
9422 /* we have an array, with the number of elements stored before the first object */
9423 INT_PTR i, *ptr = (INT_PTR *)this-1;
9425 for(i=*ptr-1; i>=0; i--)
9426 time_put_wchar_dtor(this+i);
9427 MSVCRT_operator_delete(ptr);
9428 } else {
9429 time_put_wchar_dtor(this);
9430 if(flags & 1)
9431 MSVCRT_operator_delete(this);
9434 return this;
9437 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9438 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9439 MSVCP_size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
9441 TRACE("(%p %p)\n", facet, loc);
9443 if(facet && !*facet) {
9444 *facet = MSVCRT_operator_new(sizeof(time_put));
9445 if(!*facet) {
9446 ERR("Out of memory\n");
9447 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9448 return 0;
9450 time_put_wchar_ctor_name((time_put*)*facet,
9451 locale_string_char_c_str(&loc->ptr->name), 0);
9454 return LC_TIME;
9457 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9458 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9459 MSVCP_size_t __cdecl time_put_wchar__Getcat_old(const locale_facet **facet)
9461 return time_put_wchar__Getcat(facet, locale_classic());
9464 static time_put* time_put_wchar_use_facet(const locale *loc)
9466 static time_put *obj = NULL;
9468 _Lockit lock;
9469 const locale_facet *fac;
9471 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9472 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id));
9473 if(fac) {
9474 _Lockit_dtor(&lock);
9475 return (time_put*)fac;
9478 if(obj) {
9479 _Lockit_dtor(&lock);
9480 return obj;
9483 time_put_wchar__Getcat(&fac, loc);
9484 obj = (time_put*)fac;
9485 call_locale_facet__Incref(&obj->facet);
9486 locale_facet_register(&obj->facet);
9487 _Lockit_dtor(&lock);
9489 return obj;
9492 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9493 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9494 MSVCP_size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale *loc)
9496 TRACE("(%p %p)\n", facet, loc);
9498 if(facet && !*facet) {
9499 *facet = MSVCRT_operator_new(sizeof(time_put));
9500 if(!*facet) {
9501 ERR("Out of memory\n");
9502 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9503 return 0;
9505 time_put_short_ctor_name((time_put*)*facet,
9506 locale_string_char_c_str(&loc->ptr->name), 0);
9509 return LC_TIME;
9512 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9513 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9514 MSVCP_size_t __cdecl time_put_short__Getcat_old(const locale_facet **facet)
9516 return time_put_short__Getcat(facet, locale_classic());
9519 static time_put* time_put_short_use_facet(const locale *loc)
9521 static time_put *obj = NULL;
9523 _Lockit lock;
9524 const locale_facet *fac;
9526 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9527 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id));
9528 if(fac) {
9529 _Lockit_dtor(&lock);
9530 return (time_put*)fac;
9533 if(obj) {
9534 _Lockit_dtor(&lock);
9535 return obj;
9538 time_put_short__Getcat(&fac, loc);
9539 obj = (time_put*)fac;
9540 call_locale_facet__Incref(&obj->facet);
9541 locale_facet_register(&obj->facet);
9542 _Lockit_dtor(&lock);
9544 return obj;
9547 #if _MSVCP_VER >= 70
9549 /* ?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 */
9550 /* ?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 */
9551 /* ?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 */
9552 /* ?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 */
9553 #if _MSVCP_VER != 80
9554 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 36)
9555 #else
9556 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 40)
9557 #endif
9558 #if _MSVCP_VER <= 100
9559 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9560 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9561 (this, ret, dest, base, fill, t, spec, mod))
9562 #else
9563 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, 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 #endif
9567 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9568 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9569 wchar_t fill, const struct tm *t, char spec, char mod)
9571 char buf[64], fmt[4], *p = fmt;
9572 MSVCP_size_t i, len;
9573 const _Cvtvec *cvt;
9574 wchar_t c;
9576 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9578 *p++ = '%';
9579 if(mod)
9580 *p++ = mod;
9581 *p++ = spec;
9582 *p++ = 0;
9584 #if _MSVCP_VER <= 100
9585 cvt = &this->cvt;
9586 #else
9587 cvt = &ctype_wchar_use_facet(base->loc)->cvt;
9588 #endif
9590 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9591 for(i=0; i<len; i++) {
9592 c = mb_to_wc(buf[i], cvt);
9593 ostreambuf_iterator_wchar_put(&dest, c);
9596 *ret = dest;
9597 return ret;
9600 /* ?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 */
9601 /* ?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 */
9602 /* ?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 */
9603 /* ?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 */
9604 #if _MSVCP_VER != 80
9605 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 36)
9606 #else
9607 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 40)
9608 #endif
9609 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9610 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9611 wchar_t fill, const struct tm *t, char spec, char mod)
9613 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9614 return call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod);
9617 /* ?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 */
9618 /* ?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 */
9619 /* ?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 */
9620 /* ?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 */
9621 #if _MSVCP_VER != 80
9622 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 36)
9623 #else
9624 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 40)
9625 #endif
9626 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9627 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9628 wchar_t fill, const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9630 wchar_t percent;
9631 char c[MB_LEN_MAX];
9632 const _Cvtvec *cvt;
9634 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_wn(pat, pat_end-pat));
9636 #if _MSVCP_VER <= 100
9637 cvt = &this->cvt;
9638 #else
9639 cvt = &ctype_wchar_use_facet(base->loc)->cvt;
9640 #endif
9642 percent = mb_to_wc('%', cvt);
9643 while(pat < pat_end) {
9644 if(*pat != percent) {
9645 ostreambuf_iterator_wchar_put(&dest, *pat++);
9646 }else if(++pat == pat_end) {
9647 ostreambuf_iterator_wchar_put(&dest, percent);
9648 }else if(_Wcrtomb(c, *pat, NULL, cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9649 ostreambuf_iterator_wchar_put(&dest, percent);
9650 ostreambuf_iterator_wchar_put(&dest, *pat++);
9651 }else {
9652 pat++;
9653 if(*c == '#') {
9654 if(_Wcrtomb(c, *pat++, NULL, cvt) != 1) {
9655 ostreambuf_iterator_wchar_put(&dest, percent);
9656 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9657 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9658 }else {
9659 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, '#');
9661 }else {
9662 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, 0);
9667 *ret = dest;
9668 return ret;
9671 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9673 /* ?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 */
9674 /* ?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 */
9675 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
9676 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9677 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
9678 (this, ret, dest, base, t, spec, mod))
9679 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9680 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9681 const struct tm *t, char spec, char mod)
9683 char buf[64], fmt[4], *p = fmt;
9684 MSVCP_size_t i, len;
9685 wchar_t c;
9687 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9689 *p++ = '%';
9690 if(mod)
9691 *p++ = mod;
9692 *p++ = spec;
9693 *p++ = 0;
9695 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9696 for(i=0; i<len; i++) {
9697 c = mb_to_wc(buf[i], &this->cvt);
9698 ostreambuf_iterator_wchar_put(&dest, c);
9701 *ret = dest;
9702 return ret;
9705 /* ?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 */
9706 /* ?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 */
9707 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
9708 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9709 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9710 const struct tm *t, char spec, char mod)
9712 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9713 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
9716 /* ?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 */
9717 /* ?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 */
9718 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
9719 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9720 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9721 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9723 wchar_t percent = mb_to_wc('%', &this->cvt);
9724 char c[MB_LEN_MAX];
9726 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
9728 while(pat < pat_end) {
9729 if(*pat != percent) {
9730 ostreambuf_iterator_wchar_put(&dest, *pat++);
9731 }else if(++pat == pat_end) {
9732 ostreambuf_iterator_wchar_put(&dest, percent);
9733 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9734 ostreambuf_iterator_wchar_put(&dest, percent);
9735 ostreambuf_iterator_wchar_put(&dest, *pat++);
9736 }else {
9737 pat++;
9738 if(*c == '#') {
9739 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
9740 ostreambuf_iterator_wchar_put(&dest, percent);
9741 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9742 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9743 }else {
9744 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
9746 }else {
9747 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
9752 *ret = dest;
9753 return ret;
9756 #endif /* _MSVCP_VER >= 70 */
9758 /* ?id@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
9759 locale_id time_get_char_id = {0};
9761 /* ??_7?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
9762 extern const vtable_ptr MSVCP_time_get_char_vtable;
9764 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9765 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9766 DEFINE_THISCALL_WRAPPER(time_get_char__Init, 8)
9767 void __thiscall time_get_char__Init(time_get_char *this, const _Locinfo *locinfo)
9769 const char *months;
9770 const char *days;
9771 int len;
9773 TRACE("(%p %p)\n", this, locinfo);
9775 days = _Locinfo__Getdays(locinfo);
9776 len = strlen(days)+1;
9777 this->days = MSVCRT_operator_new(len);
9778 if(!this->days)
9780 ERR("Out of memory\n");
9781 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9783 memcpy((char*)this->days, days, len);
9785 months = _Locinfo__Getmonths(locinfo);
9786 len = strlen(months)+1;
9787 this->months = MSVCRT_operator_new(len);
9788 if(!this->months)
9790 MSVCRT_operator_delete((char*)this->days);
9792 ERR("Out of memory\n");
9793 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9795 memcpy((char*)this->months, months, len);
9797 this->dateorder = _Locinfo__Getdateorder(locinfo);
9798 _Locinfo__Getcvt(locinfo, &this->cvt);
9801 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9802 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9803 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_locinfo, 12)
9804 time_get_char* __thiscall time_get_char_ctor_locinfo(time_get_char *this,
9805 const _Locinfo *locinfo, MSVCP_size_t refs)
9807 TRACE("(%p %p %lu)\n", this, locinfo, refs);
9808 locale_facet_ctor_refs(&this->facet, refs);
9809 this->facet.vtable = &MSVCP_time_get_char_vtable;
9810 time_get_char__Init(this, locinfo);
9811 return this;
9814 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAE@PBDI@Z */
9815 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAA@PEBD_K@Z */
9816 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_name, 12)
9817 time_get_char* __thiscall time_get_char_ctor_name(time_get_char *this, const char *name, MSVCP_size_t refs)
9819 _Locinfo locinfo;
9821 TRACE("(%p %s %lu)\n", this, name, refs);
9823 _Locinfo_ctor_cstr(&locinfo, name);
9824 time_get_char_ctor_locinfo(this, &locinfo, refs);
9825 _Locinfo_dtor(&locinfo);
9826 return this;
9829 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
9830 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
9831 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_refs, 8)
9832 time_get_char* __thiscall time_get_char_ctor_refs(time_get_char *this, MSVCP_size_t refs)
9834 _Locinfo locinfo;
9836 TRACE("(%p %lu)\n", this, refs);
9838 _Locinfo_ctor(&locinfo);
9839 time_get_char_ctor_locinfo(this, &locinfo, refs);
9840 _Locinfo_dtor(&locinfo);
9841 return this;
9844 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
9845 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
9846 DEFINE_THISCALL_WRAPPER(time_get_char_ctor, 4)
9847 time_get_char* __thiscall time_get_char_ctor(time_get_char *this)
9849 return time_get_char_ctor_refs(this, 0);
9852 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AAEXXZ */
9853 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEAAXXZ */
9854 DEFINE_THISCALL_WRAPPER(time_get_char__Tidy, 4)
9855 void __thiscall time_get_char__Tidy(time_get_char *this)
9857 TRACE("(%p)\n", this);
9859 MSVCRT_operator_delete((char*)this->days);
9860 MSVCRT_operator_delete((char*)this->months);
9863 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
9864 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
9865 DEFINE_THISCALL_WRAPPER(time_get_char_dtor, 4) /* virtual */
9866 void __thiscall time_get_char_dtor(time_get_char *this)
9868 TRACE("(%p)\n", this);
9870 time_get_char__Tidy(this);
9873 DEFINE_THISCALL_WRAPPER(time_get_char_vector_dtor, 8)
9874 time_get_char* __thiscall time_get_char_vector_dtor(time_get_char *this, unsigned int flags)
9876 TRACE("(%p %x)\n", this, flags);
9877 if(flags & 2) {
9878 /* we have an array, with the number of elements stored before the first object */
9879 INT_PTR i, *ptr = (INT_PTR *)this-1;
9881 for(i=*ptr-1; i>=0; i--)
9882 time_get_char_dtor(this+i);
9883 MSVCRT_operator_delete(ptr);
9884 } else {
9885 time_get_char_dtor(this);
9886 if(flags & 1)
9887 MSVCRT_operator_delete(this);
9890 return this;
9893 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9894 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9895 unsigned int __cdecl time_get_char__Getcat(const locale_facet **facet, const locale *loc)
9897 TRACE("(%p %p)\n", facet, loc);
9899 if(facet && !*facet) {
9900 _Locinfo locinfo;
9902 *facet = MSVCRT_operator_new(sizeof(time_get_char));
9903 if(!*facet) {
9904 ERR("Out of memory\n");
9905 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9906 return 0;
9909 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9910 time_get_char_ctor_locinfo((time_get_char*)*facet, &locinfo, 0);
9911 _Locinfo_dtor(&locinfo);
9914 return LC_TIME;
9917 static time_get_char* time_get_char_use_facet(const locale *loc)
9919 static time_get_char *obj = NULL;
9921 _Lockit lock;
9922 const locale_facet *fac;
9924 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9925 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_get_char_id));
9926 if(fac) {
9927 _Lockit_dtor(&lock);
9928 return (time_get_char*)fac;
9931 if(obj) {
9932 _Lockit_dtor(&lock);
9933 return obj;
9936 time_get_char__Getcat(&fac, loc);
9937 obj = (time_get_char*)fac;
9938 call_locale_facet__Incref(&obj->facet);
9939 locale_facet_register(&obj->facet);
9940 _Lockit_dtor(&lock);
9942 return obj;
9945 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAAH@Z */
9946 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAEAH@Z */
9947 int __cdecl time_get_char__Getint(const time_get_char *this,
9948 istreambuf_iterator_char *b, istreambuf_iterator_char *e,
9949 int unk1, int unk2, int *val)
9951 FIXME("(%p %p %p %d %d %p) stub\n", this, b, e, unk1, unk2, val);
9952 return 0;
9955 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AW4dateorder@time_base@2@XZ */
9956 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AW4dateorder@time_base@2@XZ */
9957 DEFINE_THISCALL_WRAPPER(time_get_char_do_date_order, 4) /* virtual */
9958 #if _MSVCP_VER <= 100
9959 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 4, dateorder, (const time_get_char*), (this))
9960 #else
9961 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 12, dateorder, (const time_get_char*), (this))
9962 #endif
9963 dateorder __thiscall time_get_char_do_date_order(const time_get_char *this)
9965 TRACE("(%p)\n", this);
9966 return this->dateorder;
9969 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ */
9970 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AW4dateorder@time_base@2@XZ */
9971 DEFINE_THISCALL_WRAPPER(time_get_char_date_order, 4)
9972 dateorder __thiscall time_get_char_date_order(const time_get_char *this)
9974 return call_time_get_char_do_date_order(this);
9977 /* ?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 */
9978 /* ?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 */
9979 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_date, 36) /* virtual */
9980 #if _MSVCP_VER <= 100
9981 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
9982 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9983 (this, ret, s, e, base, err, t))
9984 #else
9985 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
9986 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9987 (this, ret, s, e, base, err, t))
9988 #endif
9989 istreambuf_iterator_char* __thiscall time_get_char_do_get_date(const time_get_char *this,
9990 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9991 ios_base *base, int *err, struct tm *t)
9993 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9994 return NULL;
9997 /* ?get_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 */
9998 /* ?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 */
9999 DEFINE_THISCALL_WRAPPER(time_get_char_get_date, 36)
10000 istreambuf_iterator_char* __thiscall time_get_char_get_date(const time_get_char *this,
10001 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10002 ios_base *base, int *err, struct tm *t)
10004 return call_time_get_char_do_get_date(this, ret, s, e, base, err, t);
10007 /* ?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 */
10008 /* ?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 */
10009 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_monthname, 36) /* virtual */
10010 #if _MSVCP_VER <= 100
10011 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
10012 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10013 (this, ret, s, e, base, err, t))
10014 #else
10015 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
10016 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10017 (this, ret, s, e, base, err, t))
10018 #endif
10019 istreambuf_iterator_char* __thiscall time_get_char_do_get_monthname(const time_get_char *this,
10020 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10021 ios_base *base, int *err, struct tm *t)
10023 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
10024 return NULL;
10027 /* ?get_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 */
10028 /* ?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 */
10029 DEFINE_THISCALL_WRAPPER(time_get_char_get_monthname, 36)
10030 istreambuf_iterator_char* __thiscall time_get_char_get_monthname(const time_get_char *this,
10031 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10032 ios_base *base, int *err, struct tm *t)
10034 return call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t);
10037 /* ?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 */
10038 /* ?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 */
10039 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_time, 36) /* virtual */
10040 #if _MSVCP_VER <= 100
10041 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
10042 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10043 (this, ret, s, e, base, err, t))
10044 #else
10045 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
10046 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10047 (this, ret, s, e, base, err, t))
10048 #endif
10049 istreambuf_iterator_char* __thiscall time_get_char_do_get_time(const time_get_char *this,
10050 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10051 ios_base *base, int *err, struct tm *t)
10053 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
10054 return NULL;
10057 /* ?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 */
10058 /* ?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 */
10059 DEFINE_THISCALL_WRAPPER(time_get_char_get_time, 36)
10060 istreambuf_iterator_char* __thiscall time_get_char_get_time(const time_get_char *this,
10061 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10062 ios_base *base, int *err, struct tm *t)
10064 return call_time_get_char_do_get_time(this, ret, s, e, base, err, t);
10067 /* ?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 */
10068 /* ?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 */
10069 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_weekday, 36) /* virtual */
10070 #if _MSVCP_VER <= 100
10071 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
10072 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10073 (this, ret, s, e, base, err, t))
10074 #else
10075 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
10076 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10077 (this, ret, s, e, base, err, t))
10078 #endif
10079 istreambuf_iterator_char* __thiscall time_get_char_do_get_weekday(const time_get_char *this,
10080 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10081 ios_base *base, int *err, struct tm *t)
10083 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
10084 return NULL;
10087 /* ?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 */
10088 /* ?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 */
10089 DEFINE_THISCALL_WRAPPER(time_get_char_get_weekday, 36)
10090 istreambuf_iterator_char* __thiscall time_get_char_get_weekday(const time_get_char *this,
10091 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10092 ios_base *base, int *err, struct tm *t)
10094 return call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t);
10097 /* ?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 */
10098 /* ?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 */
10099 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_year, 36) /* virtual */
10100 #if _MSVCP_VER <= 100
10101 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
10102 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10103 (this, ret, s, e, base, err, t))
10104 #else
10105 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
10106 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10107 (this, ret, s, e, base, err, t))
10108 #endif
10109 istreambuf_iterator_char* __thiscall time_get_char_do_get_year(const time_get_char *this,
10110 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10111 ios_base *base, int *err, struct tm *t)
10113 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
10114 return NULL;
10117 /* ?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 */
10118 /* ?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 */
10119 DEFINE_THISCALL_WRAPPER(time_get_char_get_year, 36)
10120 istreambuf_iterator_char* __thiscall time_get_char_get_year(const time_get_char *this,
10121 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10122 ios_base *base, int *err, struct tm *t)
10124 return call_time_get_char_do_get_year(this, ret, s, e, base, err, t);
10127 /* ??_7_Locimp@locale@std@@6B@ */
10128 extern const vtable_ptr MSVCP_locale__Locimp_vtable;
10130 /* ??0_Locimp@locale@std@@AAE@_N@Z */
10131 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
10132 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
10133 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
10135 TRACE("(%p %d)\n", this, transparent);
10137 memset(this, 0, sizeof(locale__Locimp));
10138 locale_facet_ctor_refs(&this->facet, 1);
10139 this->facet.vtable = &MSVCP_locale__Locimp_vtable;
10140 this->transparent = transparent;
10141 locale_string_char_ctor_cstr(&this->name, "*");
10142 return this;
10145 /* ??_F_Locimp@locale@std@@QAEXXZ */
10146 /* ??_F_Locimp@locale@std@@QEAAXXZ */
10147 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
10148 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
10150 return locale__Locimp_ctor_transparent(this, FALSE);
10153 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
10154 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
10155 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
10156 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
10158 _Lockit lock;
10159 MSVCP_size_t i;
10161 TRACE("(%p %p)\n", this, copy);
10163 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10164 memcpy(this, copy, sizeof(locale__Locimp));
10165 locale_facet_ctor_refs(&this->facet, 1);
10166 this->facet.vtable = &MSVCP_locale__Locimp_vtable;
10167 if(copy->facetvec) {
10168 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
10169 if(!this->facetvec) {
10170 _Lockit_dtor(&lock);
10171 ERR("Out of memory\n");
10172 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10173 return NULL;
10175 for(i=0; i<this->facet_cnt; i++)
10177 this->facetvec[i] = copy->facetvec[i];
10178 if(this->facetvec[i])
10179 call_locale_facet__Incref(this->facetvec[i]);
10182 locale_string_char_copy_ctor(&this->name, &copy->name);
10183 _Lockit_dtor(&lock);
10184 return this;
10187 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
10188 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
10189 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
10191 return locale__Locimp_copy_ctor(this, copy);
10194 /* ??1_Locimp@locale@std@@MAE@XZ */
10195 /* ??1_Locimp@locale@std@@MEAA@XZ */
10196 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
10197 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
10199 MSVCP_size_t i;
10201 TRACE("(%p)\n", this);
10203 locale_facet_dtor(&this->facet);
10204 for(i=0; i<this->facet_cnt; i++)
10205 if(this->facetvec[i] && call_locale_facet__Decref(this->facetvec[i]))
10206 call_locale_facet_vector_dtor(this->facetvec[i], 1);
10208 MSVCRT_operator_delete(this->facetvec);
10209 locale_string_char_dtor(&this->name);
10212 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
10213 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
10214 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
10216 locale__Locimp_dtor(this);
10219 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
10220 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
10222 TRACE("(%p %x)\n", this, flags);
10223 if(flags & 2) {
10224 /* we have an array, with the number of elements stored before the first object */
10225 INT_PTR i, *ptr = (INT_PTR *)this-1;
10227 for(i=*ptr-1; i>=0; i--)
10228 locale__Locimp_dtor(this+i);
10229 MSVCRT_operator_delete(ptr);
10230 } else {
10231 locale__Locimp_dtor(this);
10232 if(flags & 1)
10233 MSVCRT_operator_delete(this);
10236 return this;
10239 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@ABV123@@Z */
10240 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z */
10241 locale__Locimp* __cdecl locale__Locimp__New_Locimp(const locale__Locimp *copy)
10243 locale__Locimp *ret;
10245 TRACE("(%p)\n", copy);
10247 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
10248 if(!ret) {
10249 ERR("Out of memory\n");
10250 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10251 return NULL;
10253 return locale__Locimp_copy_ctor(ret, copy);
10256 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z */
10257 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z */
10258 locale__Locimp* __cdecl locale__Locimp__New_Locimp_transparent(MSVCP_bool transparent)
10260 locale__Locimp *ret;
10262 TRACE("(%x)\n", transparent);
10264 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
10265 if(!ret) {
10266 ERR("Out of memory\n");
10267 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10268 return NULL;
10270 return locale__Locimp_ctor_transparent(ret, transparent);
10273 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
10274 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
10275 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
10277 _Lockit lock;
10279 TRACE("(%p %p %lu)\n", locimp, facet, id);
10281 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10282 if(id >= locimp->facet_cnt) {
10283 MSVCP_size_t new_size = id+1;
10284 locale_facet **new_facetvec;
10286 if(new_size < 40)
10287 new_size = 40;
10289 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
10290 if(!new_facetvec) {
10291 _Lockit_dtor(&lock);
10292 ERR("Out of memory\n");
10293 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10294 return;
10297 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
10298 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
10299 MSVCRT_operator_delete(locimp->facetvec);
10300 locimp->facetvec = new_facetvec;
10301 locimp->facet_cnt = new_size;
10304 if(locimp->facetvec[id] && call_locale_facet__Decref(locimp->facetvec[id]))
10305 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
10307 locimp->facetvec[id] = facet;
10308 if(facet)
10309 call_locale_facet__Incref(facet);
10310 _Lockit_dtor(&lock);
10313 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
10314 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
10315 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
10316 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
10318 locale__Locimp__Locimp_Addfac(this, facet, id);
10321 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
10322 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
10323 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
10325 FIXME("stub\n");
10326 return NULL;
10329 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10330 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10331 /* List of missing facets:
10332 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10334 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10336 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10338 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
10339 ctype_wchar *ctype;
10341 if(loc) {
10342 ctype = ctype_short_use_facet(loc);
10343 }else {
10344 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
10345 if(!ctype) {
10346 ERR("Out of memory\n");
10347 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10349 ctype_short_ctor_locinfo(ctype, locinfo, 0);
10351 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
10354 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
10355 num_get *numget;
10357 if(loc) {
10358 numget = num_get_short_use_facet(loc);
10359 }else {
10360 numget = MSVCRT_operator_new(sizeof(num_get));
10361 if(!numget) {
10362 ERR("Out of memory\n");
10363 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10365 num_get_short_ctor_locinfo(numget, locinfo, 0);
10367 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
10370 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
10371 num_put *numput;
10373 if(loc) {
10374 numput = num_put_short_use_facet(loc);
10375 }else {
10376 numput = MSVCRT_operator_new(sizeof(num_put));
10377 if(!numput) {
10378 ERR("Out of memory\n");
10379 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10381 num_put_short_ctor_locinfo(numput, locinfo, 0);
10383 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
10386 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
10387 numpunct_wchar *numpunct;
10389 if(loc) {
10390 numpunct = numpunct_short_use_facet(loc);
10391 }else {
10392 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
10393 if(!numpunct) {
10394 ERR("Out of memory\n");
10395 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10397 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10399 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
10402 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
10403 collate *c;
10405 if(loc) {
10406 c = collate_short_use_facet(loc);
10407 }else {
10408 c = MSVCRT_operator_new(sizeof(collate));
10409 if(!c) {
10410 ERR("Out of memory\n");
10411 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10413 collate_short_ctor_locinfo(c, locinfo, 0);
10415 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
10418 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
10419 time_put *t;
10421 if(loc) {
10422 t = time_put_short_use_facet(loc);
10423 }else {
10424 t = MSVCRT_operator_new(sizeof(time_put));
10425 if(!t) {
10426 ERR("Out of memory\n");
10427 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10429 time_put_short_ctor_locinfo(t, locinfo, 0);
10431 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
10434 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
10435 codecvt_wchar *codecvt;
10437 if(loc) {
10438 codecvt = codecvt_short_use_facet(loc);
10439 }else {
10440 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
10441 if(!codecvt) {
10442 ERR("Out of memory\n");
10443 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10445 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
10447 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
10451 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10452 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10453 /* List of missing facets:
10454 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10456 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10458 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10460 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
10461 ctype_wchar *ctype;
10463 if(loc) {
10464 ctype = ctype_wchar_use_facet(loc);
10465 }else {
10466 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
10467 if(!ctype) {
10468 ERR("Out of memory\n");
10469 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10471 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
10473 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
10476 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
10477 num_get *numget;
10479 if(loc) {
10480 numget = num_get_wchar_use_facet(loc);
10481 }else {
10482 numget = MSVCRT_operator_new(sizeof(num_get));
10483 if(!numget) {
10484 ERR("Out of memory\n");
10485 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10487 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
10489 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
10492 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
10493 num_put *numput;
10495 if(loc) {
10496 numput = num_put_wchar_use_facet(loc);
10497 }else {
10498 numput = MSVCRT_operator_new(sizeof(num_put));
10499 if(!numput) {
10500 ERR("Out of memory\n");
10501 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10503 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
10505 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
10508 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
10509 numpunct_wchar *numpunct;
10511 if(loc) {
10512 numpunct = numpunct_wchar_use_facet(loc);
10513 }else {
10514 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
10515 if(!numpunct) {
10516 ERR("Out of memory\n");
10517 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10519 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10521 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
10524 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
10525 collate *c;
10527 if(loc) {
10528 c = collate_wchar_use_facet(loc);
10529 }else {
10530 c = MSVCRT_operator_new(sizeof(collate));
10531 if(!c) {
10532 ERR("Out of memory\n");
10533 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10535 collate_wchar_ctor_locinfo(c, locinfo, 0);
10537 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
10540 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
10541 time_put *t;
10543 if(loc) {
10544 t = time_put_wchar_use_facet(loc);
10545 }else {
10546 t = MSVCRT_operator_new(sizeof(time_put));
10547 if(!t) {
10548 ERR("Out of memory\n");
10549 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10551 time_put_wchar_ctor_locinfo(t, locinfo, 0);
10553 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
10556 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
10557 codecvt_wchar *codecvt;
10559 if(loc) {
10560 codecvt = codecvt_wchar_use_facet(loc);
10561 }else {
10562 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
10563 if(!codecvt) {
10564 ERR("Out of memory\n");
10565 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10567 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
10569 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
10573 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10574 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10575 /* List of missing facets:
10576 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10578 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10580 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10582 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
10583 ctype_char *ctype;
10585 if(loc) {
10586 ctype = ctype_char_use_facet(loc);
10587 }else {
10588 ctype = MSVCRT_operator_new(sizeof(ctype_char));
10589 if(!ctype) {
10590 ERR("Out of memory\n");
10591 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10593 ctype_char_ctor_locinfo(ctype, locinfo, 0);
10595 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
10598 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
10599 num_get *numget;
10601 if(loc) {
10602 numget = num_get_char_use_facet(loc);
10603 }else {
10604 numget = MSVCRT_operator_new(sizeof(num_get));
10605 if(!numget) {
10606 ERR("Out of memory\n");
10607 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10609 num_get_char_ctor_locinfo(numget, locinfo, 0);
10611 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
10614 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
10615 num_put *numput;
10617 if(loc) {
10618 numput = num_put_char_use_facet(loc);
10619 }else {
10620 numput = MSVCRT_operator_new(sizeof(num_put));
10621 if(!numput) {
10622 ERR("Out of memory\n");
10623 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10625 num_put_char_ctor_locinfo(numput, locinfo, 0);
10627 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
10630 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
10631 numpunct_char *numpunct;
10633 if(loc) {
10634 numpunct = numpunct_char_use_facet(loc);
10635 }else {
10636 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
10637 if(!numpunct) {
10638 ERR("Out of memory\n");
10639 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10641 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10643 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
10646 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
10647 collate *c;
10649 if(loc) {
10650 c = collate_char_use_facet(loc);
10651 }else {
10652 c = MSVCRT_operator_new(sizeof(collate));
10653 if(!c) {
10654 ERR("Out of memory\n");
10655 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10657 collate_char_ctor_locinfo(c, locinfo, 0);
10659 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
10662 if(cat & (1<<(time_get_char__Getcat(NULL, NULL)-1))) {
10663 time_get_char *t;
10665 if(loc) {
10666 t = time_get_char_use_facet(loc);
10667 }else {
10668 t = MSVCRT_operator_new(sizeof(time_get_char));
10669 if(!t) {
10670 ERR("Out of memory\n");
10671 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10673 time_get_char_ctor_locinfo(t, locinfo, 0);
10675 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_get_char_id));
10678 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
10679 time_put *t;
10681 if(loc) {
10682 t = time_put_char_use_facet(loc);
10683 }else {
10684 t = MSVCRT_operator_new(sizeof(time_put));
10685 if(!t) {
10686 ERR("Out of memory\n");
10687 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10689 time_put_char_ctor_locinfo(t, locinfo, 0);
10691 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
10694 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
10695 codecvt_char *codecvt;
10697 if(loc) {
10698 codecvt = codecvt_char_use_facet(loc);
10699 }else {
10700 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
10701 if(!codecvt) {
10702 ERR("Out of memory\n");
10703 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10705 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
10707 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
10711 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
10712 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10713 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10715 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
10717 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
10718 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
10719 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
10721 locimp->catmask |= cat;
10722 locale_string_char_assign(&locimp->name, &locinfo->newlocname);
10723 return locimp;
10726 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
10727 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
10728 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
10729 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
10731 TRACE("(%p %p)\n", this, locimp);
10732 /* Don't change locimp reference counter */
10733 this->ptr = locimp;
10734 return this;
10737 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
10738 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
10739 locale__Locimp* __cdecl locale__Init(void)
10741 _Lockit lock;
10743 TRACE("\n");
10745 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10746 if(global_locale) {
10747 _Lockit_dtor(&lock);
10748 return global_locale;
10751 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
10752 if(!global_locale) {
10753 _Lockit_dtor(&lock);
10754 ERR("Out of memory\n");
10755 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10756 return NULL;
10759 locale__Locimp_ctor(global_locale);
10760 global_locale->catmask = (1<<(LC_MAX+1))-1;
10761 locale_string_char_dtor(&global_locale->name);
10762 locale_string_char_ctor_cstr(&global_locale->name, "C");
10764 locale__Locimp__Clocptr = global_locale;
10765 global_locale->facet.refs++;
10766 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
10767 _Lockit_dtor(&lock);
10769 return global_locale;
10772 /* ?_Init@locale@std@@CAPAV_Locimp@12@_N@Z */
10773 /* ?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z */
10774 locale__Locimp* __cdecl locale__Init_ref(MSVCP_bool inc_ref)
10776 locale__Locimp *ret;
10777 _Lockit lock;
10779 TRACE("(%x)\n", inc_ref);
10781 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10782 if(inc_ref && global_locale) {
10783 call_locale_facet__Incref(&global_locale->facet);
10784 _Lockit_dtor(&lock);
10785 return global_locale;
10788 ret = locale__Init();
10789 _Lockit_dtor(&lock);
10790 return ret;
10793 /* ?_Iscloc@locale@std@@QBE_NXZ */
10794 /* ?_Iscloc@locale@std@@QEBA_NXZ */
10795 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
10796 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
10798 TRACE("(%p)\n", this);
10799 return this->ptr == locale__Locimp__Clocptr;
10802 /* ??0locale@std@@QAE@ABV01@0H@Z */
10803 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
10804 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
10805 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
10807 _Locinfo locinfo;
10809 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
10811 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10812 if(!this->ptr) {
10813 ERR("Out of memory\n");
10814 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10816 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
10818 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, locale_string_char_c_str(&loc->ptr->name));
10819 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, locale_string_char_c_str(&other->ptr->name));
10820 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
10821 _Locinfo_dtor(&locinfo);
10823 return this;
10826 /* ??0locale@std@@QAE@ABV01@@Z */
10827 /* ??0locale@std@@QEAA@AEBV01@@Z */
10828 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
10829 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
10831 TRACE("(%p %p)\n", this, copy);
10832 this->ptr = copy->ptr;
10833 call_locale_facet__Incref(&this->ptr->facet);
10834 return this;
10837 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
10838 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
10839 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
10840 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
10842 _Locinfo locinfo;
10844 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
10846 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
10847 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
10848 _Locinfo_dtor(&locinfo);
10849 MSVCRT_operator_delete(this->ptr);
10850 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
10853 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10854 if(!this->ptr) {
10855 ERR("Out of memory\n");
10856 _Locinfo_dtor(&locinfo);
10857 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10859 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
10861 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
10862 _Locinfo_dtor(&locinfo);
10863 return this;
10866 /* ??0locale@std@@QAE@PBDH@Z */
10867 /* ??0locale@std@@QEAA@PEBDH@Z */
10868 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
10869 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
10871 _Locinfo locinfo;
10873 TRACE("(%p %s %d)\n", this, locname, cat);
10875 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10876 if(!this->ptr) {
10877 ERR("Out of memory\n");
10878 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10880 locale__Locimp_ctor(this->ptr);
10882 locale__Init();
10884 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
10885 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
10886 _Locinfo_dtor(&locinfo);
10887 MSVCRT_operator_delete(this->ptr);
10888 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
10891 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
10892 _Locinfo_dtor(&locinfo);
10894 return this;
10897 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
10898 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
10899 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
10900 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
10902 TRACE("(%p)\n", this);
10903 this->ptr = NULL;
10904 return this;
10907 /* ??0locale@std@@QAE@XZ */
10908 /* ??0locale@std@@QEAA@XZ */
10909 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
10910 locale* __thiscall locale_ctor(locale *this)
10912 TRACE("(%p)\n", this);
10913 this->ptr = locale__Init();
10914 call_locale_facet__Incref(&this->ptr->facet);
10915 return this;
10918 /* ??1locale@std@@QAE@XZ */
10919 /* ??1locale@std@@QEAA@XZ */
10920 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
10921 void __thiscall locale_dtor(locale *this)
10923 TRACE("(%p)\n", this);
10924 if(this->ptr && call_locale_facet__Decref(&this->ptr->facet))
10926 locale__Locimp_dtor(this->ptr);
10927 MSVCRT_operator_delete(this->ptr);
10931 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
10932 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
10933 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
10934 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
10936 FIXME("(%p %p) stub\n", this, loc);
10937 return NULL;
10940 /* ??8locale@std@@QBE_NABV01@@Z */
10941 /* ??8locale@std@@QEBA_NAEBV01@@Z */
10942 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
10943 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
10945 FIXME("(%p %p) stub\n", this, loc);
10946 return 0;
10949 /* ??9locale@std@@QBE_NABV01@@Z */
10950 /* ??9locale@std@@QEBA_NAEBV01@@Z */
10951 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
10952 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
10954 FIXME("(%p %p) stub\n", this, loc);
10955 return 0;
10958 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
10959 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
10960 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
10961 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
10963 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
10965 if(this->ptr->facet.refs > 1) {
10966 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10967 if(!new_ptr) {
10968 ERR("Out of memory\n");
10969 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10970 return NULL;
10972 locale__Locimp_copy_ctor(new_ptr, this->ptr);
10973 call_locale_facet__Decref(&this->ptr->facet);
10974 this->ptr = new_ptr;
10977 locale__Locimp__Addfac(this->ptr, facet, id);
10979 if(catmask) {
10980 locale_string_char_dtor(&this->ptr->name);
10981 locale_string_char_ctor_cstr(&this->ptr->name, "*");
10983 return this;
10986 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
10987 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
10988 DEFINE_THISCALL_WRAPPER(locale__Getfacet_bool, 12)
10989 const locale_facet* __thiscall locale__Getfacet_bool(const locale *this,
10990 MSVCP_size_t id, MSVCP_bool allow_transparent)
10992 locale_facet *fac;
10994 TRACE("(%p %lu)\n", this, id);
10996 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
10997 if(fac || !this->ptr->transparent || !allow_transparent)
10998 return fac;
11000 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
11003 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
11004 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
11005 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
11006 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
11008 return locale__Getfacet_bool( this, id, TRUE );
11011 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
11012 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
11013 locale__Locimp* __cdecl locale__Getgloballocale(void)
11015 TRACE("\n");
11016 return global_locale;
11019 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
11020 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
11021 void __cdecl locale__Setgloballocale(void *locimp)
11023 TRACE("(%p)\n", locimp);
11024 global_locale = locimp;
11027 /* ?classic@locale@std@@SAABV12@XZ */
11028 /* ?classic@locale@std@@SAAEBV12@XZ */
11029 const locale* __cdecl locale_classic(void)
11031 TRACE("\n");
11032 locale__Init();
11033 return &classic_locale;
11036 /* ?empty@locale@std@@SA?AV12@XZ */
11037 locale* __cdecl locale_empty(locale *ret)
11039 TRACE("\n");
11041 locale__Init();
11043 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
11044 if(!ret->ptr) {
11045 ERR("Out of memory\n");
11046 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
11048 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
11049 return ret;
11052 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
11053 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
11054 locale* __cdecl locale_global(locale *ret, const locale *loc)
11056 _Lockit lock;
11057 int i;
11059 TRACE("(%p %p)\n", loc, ret);
11061 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
11062 locale_ctor(ret);
11064 if(loc->ptr != global_locale) {
11065 call_locale_facet__Decref(&global_locale->facet);
11066 global_locale = loc->ptr;
11067 call_locale_facet__Incref(&global_locale->facet);
11069 for(i=LC_ALL+1; i<=LC_MAX; i++) {
11070 if((global_locale->catmask & (1<<(i-1))) == 0)
11071 continue;
11072 setlocale(i, locale_string_char_c_str(&global_locale->name));
11075 _Lockit_dtor(&lock);
11076 return ret;
11079 #if _MSVCP_VER < 100
11081 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11082 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11083 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
11084 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
11086 TRACE("(%p)\n", this);
11088 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
11089 return ret;
11092 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11093 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11094 DEFINE_THISCALL_WRAPPER(locale_name, 8)
11095 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
11097 TRACE( "(%p)\n", this);
11098 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
11099 return ret;
11102 #else
11104 /* ?_Getname@_Locinfo@std@@QBEPBDXZ */
11105 /* ?_Getname@_Locinfo@std@@QEBAPEBDXZ */
11106 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 4)
11107 const char * __thiscall _Locinfo__Getname( const _Locinfo *this )
11109 return locale_string_char_c_str( &this->newlocname );
11112 #endif /* _MSVCP_VER < 100 */
11114 /* wctrans */
11115 wctrans_t __cdecl wctrans(const char *property)
11117 static const char str_tolower[] = "tolower";
11118 static const char str_toupper[] = "toupper";
11120 if(!strcmp(property, str_tolower))
11121 return 2;
11122 if(!strcmp(property, str_toupper))
11123 return 1;
11124 return 0;
11127 /* towctrans */
11128 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
11130 if(category == 1)
11131 return towupper(c);
11132 return towlower(c);
11135 #if _MSVCP_VER <= 71
11136 /* btowc */
11137 wint_t __cdecl btowc(int c)
11139 wchar_t ret;
11140 int state = 0;
11141 char ch = c;
11143 if (c == EOF || _Mbrtowc( &ret, &ch, 1, &state, NULL ) != 1) return WEOF;
11144 return ret;
11147 /* mbrlen */
11148 size_t __cdecl mbrlen(const char *str, size_t n, mbstate_t *state)
11150 static int local_state;
11152 if (!state) state = &local_state;
11153 return _Mbrtowc( NULL, str, n, state, NULL );
11156 /* mbrtowc */
11157 size_t __cdecl mbrtowc(wchar_t *dst, const char *str, size_t n, mbstate_t *state)
11159 static int local_state;
11161 if (!state) state = &local_state;
11162 return _Mbrtowc( dst, str, n, state, NULL );
11165 /* mbsrtowcs */
11166 size_t __cdecl mbsrtowcs(wchar_t *dst, const char **pstr, size_t n, mbstate_t *state)
11168 static int local_state;
11169 size_t ret = 0;
11170 wchar_t wc;
11171 const char *src;
11173 src = *pstr;
11174 if (!state) state = &local_state;
11176 while (!dst || n > ret)
11178 int len = _Mbrtowc( &wc, src, 2, state, NULL );
11179 if (len < 0) return -1;
11180 if (!len) break;
11181 if (dst) dst[ret] = wc;
11182 ret++;
11183 if (!wc) break;
11184 src += len;
11186 return ret;
11189 /* wctob */
11190 int __cdecl wctob(wint_t wc)
11192 char ret[MB_LEN_MAX];
11194 if (wc == WEOF || _Wcrtomb( ret, wc, NULL, NULL ) != 1) return EOF;
11195 return ret[0];
11198 /* wcrtomb */
11199 size_t __cdecl wcrtomb(char *dst, wchar_t wc, mbstate_t *state)
11201 return _Wcrtomb( dst, wc, state, NULL );
11204 /* wcsrtombs */
11205 size_t __cdecl wcsrtombs(char *dst, const wchar_t **pstr, size_t n, mbstate_t *state)
11207 const wchar_t *src;
11208 char buffer[MB_LEN_MAX];
11209 size_t ret = 0;
11211 src = *pstr;
11213 while (!dst || n > ret)
11215 int len = _Wcrtomb( buffer, *src, state, NULL );
11216 if (len <= 0) return -1;
11217 if (n < ret + len) break;
11218 memcpy( dst + ret, buffer, len );
11219 ret += len;
11220 if (!buffer[0]) break;
11221 src++;
11223 return ret;
11225 #endif
11227 int __cdecl _To_byte(const wchar_t *src, char *dst)
11229 TRACE("(%s %p)\n", debugstr_w(src), dst);
11230 return WideCharToMultiByte(CP_ACP, 0, src, -1, dst, MAX_PATH, NULL, NULL);
11233 int __cdecl _To_wide(const char *src, wchar_t *dst)
11235 TRACE("(%s %p)\n", debugstr_a(src), dst);
11236 return MultiByteToWideChar(CP_ACP, 0, src, -1, dst, MAX_PATH);
11239 DEFINE_RTTI_DATA0(_Facet_base, 0, ".?AV_Facet_base@std@@")
11240 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
11241 DEFINE_RTTI_DATA1(locale__Locimp, 0, &locale_facet_rtti_base_descriptor, ".?AV_Locimp@locale@std@@")
11242 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
11243 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
11244 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
11245 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
11246 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
11247 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
11248 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
11249 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
11250 #if _MSVCP_VER >= 140
11251 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDU_Mbstatet@@@std@@")
11252 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDU_Mbstatet@@@std@@")
11253 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDU_Mbstatet@@@std@@")
11254 #else
11255 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
11256 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
11257 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
11258 #endif
11259 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
11260 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
11261 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
11262 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@@")
11263 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@@")
11264 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@@")
11265 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@@")
11266 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@@")
11267 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@@")
11268 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@@")
11269 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@@")
11270 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@@")
11271 DEFINE_RTTI_DATA1(time_base, 0, &locale_facet_rtti_base_descriptor, ".?AUtime_base@std@@")
11272 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@@")
11274 #ifndef __GNUC__
11275 void __asm_dummy_vtables(void) {
11276 #endif
11277 __ASM_VTABLE(_Facet_base,
11278 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
11279 VTABLE_ADD_FUNC(locale_facet__Incref)
11280 VTABLE_ADD_FUNC(locale_facet__Incref)
11282 __ASM_VTABLE(locale_facet,
11283 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
11284 #if _MSVCP_VER >= 110
11285 VTABLE_ADD_FUNC(locale_facet__Incref)
11286 VTABLE_ADD_FUNC(locale_facet__Decref)
11287 #endif
11289 __ASM_VTABLE(locale__Locimp,
11290 VTABLE_ADD_FUNC(locale__Locimp_vector_dtor)
11291 #if _MSVCP_VER >= 110
11292 VTABLE_ADD_FUNC(locale_facet__Incref)
11293 VTABLE_ADD_FUNC(locale_facet__Decref)
11294 #endif
11296 __ASM_VTABLE(collate_char,
11297 VTABLE_ADD_FUNC(collate_char_vector_dtor)
11298 #if _MSVCP_VER >= 110
11299 VTABLE_ADD_FUNC(locale_facet__Incref)
11300 VTABLE_ADD_FUNC(locale_facet__Decref)
11301 #endif
11302 VTABLE_ADD_FUNC(collate_char_do_compare)
11303 VTABLE_ADD_FUNC(collate_char_do_transform)
11304 VTABLE_ADD_FUNC(collate_char_do_hash));
11305 __ASM_VTABLE(collate_wchar,
11306 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
11307 #if _MSVCP_VER >= 110
11308 VTABLE_ADD_FUNC(locale_facet__Incref)
11309 VTABLE_ADD_FUNC(locale_facet__Decref)
11310 #endif
11311 VTABLE_ADD_FUNC(collate_wchar_do_compare)
11312 VTABLE_ADD_FUNC(collate_wchar_do_transform)
11313 VTABLE_ADD_FUNC(collate_wchar_do_hash));
11314 __ASM_VTABLE(collate_short,
11315 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
11316 #if _MSVCP_VER >= 110
11317 VTABLE_ADD_FUNC(locale_facet__Incref)
11318 VTABLE_ADD_FUNC(locale_facet__Decref)
11319 #endif
11320 VTABLE_ADD_FUNC(collate_wchar_do_compare)
11321 VTABLE_ADD_FUNC(collate_wchar_do_transform)
11322 VTABLE_ADD_FUNC(collate_wchar_do_hash));
11323 __ASM_VTABLE(ctype_base,
11324 VTABLE_ADD_FUNC(ctype_base_vector_dtor)
11325 #if _MSVCP_VER >= 110
11326 VTABLE_ADD_FUNC(locale_facet__Incref)
11327 VTABLE_ADD_FUNC(locale_facet__Decref)
11328 #endif
11330 __ASM_VTABLE(ctype_char,
11331 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
11332 #if _MSVCP_VER >= 110
11333 VTABLE_ADD_FUNC(locale_facet__Incref)
11334 VTABLE_ADD_FUNC(locale_facet__Decref)
11335 #endif
11336 VTABLE_ADD_FUNC(ctype_char_do_tolower)
11337 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
11338 VTABLE_ADD_FUNC(ctype_char_do_toupper)
11339 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
11340 VTABLE_ADD_FUNC(ctype_char_do_widen)
11341 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
11342 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11343 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
11344 VTABLE_ADD_FUNC(ctype_char_do_narrow)
11345 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
11346 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s)
11347 #else
11348 VTABLE_ADD_FUNC(ctype_char_do_narrow)
11349 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
11350 #endif
11352 __ASM_VTABLE(ctype_wchar,
11353 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
11354 #if _MSVCP_VER >= 110
11355 VTABLE_ADD_FUNC(locale_facet__Incref)
11356 VTABLE_ADD_FUNC(locale_facet__Decref)
11357 #endif
11358 VTABLE_ADD_FUNC(ctype_wchar_do_is)
11359 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
11360 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
11361 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
11362 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
11363 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
11364 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
11365 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
11366 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
11367 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
11368 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11369 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
11370 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11371 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11372 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
11373 #else
11374 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11375 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11376 #endif
11378 __ASM_VTABLE(ctype_short,
11379 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
11380 #if _MSVCP_VER >= 110
11381 VTABLE_ADD_FUNC(locale_facet__Incref)
11382 VTABLE_ADD_FUNC(locale_facet__Decref)
11383 #endif
11384 VTABLE_ADD_FUNC(ctype_wchar_do_is)
11385 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
11386 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
11387 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
11388 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
11389 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
11390 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
11391 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
11392 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
11393 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
11394 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11395 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
11396 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11397 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11398 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
11399 #else
11400 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11401 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11402 #endif
11404 __ASM_VTABLE(codecvt_base,
11405 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
11406 #if _MSVCP_VER >= 110
11407 VTABLE_ADD_FUNC(locale_facet__Incref)
11408 VTABLE_ADD_FUNC(locale_facet__Decref)
11409 #endif
11410 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
11411 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
11412 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
11413 __ASM_VTABLE(codecvt_char,
11414 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
11415 #if _MSVCP_VER >= 110
11416 VTABLE_ADD_FUNC(locale_facet__Incref)
11417 VTABLE_ADD_FUNC(locale_facet__Decref)
11418 VTABLE_ADD_FUNC(codecvt_char_do_always_noconv)
11419 #else
11420 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
11421 #endif
11422 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
11423 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11424 VTABLE_ADD_FUNC(codecvt_char_do_in)
11425 VTABLE_ADD_FUNC(codecvt_char_do_out)
11426 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
11427 VTABLE_ADD_FUNC(codecvt_char_do_length));
11428 __ASM_VTABLE(codecvt_wchar,
11429 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
11430 #if _MSVCP_VER >= 110
11431 VTABLE_ADD_FUNC(locale_facet__Incref)
11432 VTABLE_ADD_FUNC(locale_facet__Decref)
11433 #endif
11434 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
11435 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
11436 #if _MSVCP_VER >= 90 && _MSVCP_VER <= 100
11437 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11438 #else
11439 VTABLE_ADD_FUNC(codecvt_wchar_do_encoding)
11440 #endif
11441 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
11442 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
11443 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
11444 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
11445 __ASM_VTABLE(codecvt_short,
11446 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
11447 #if _MSVCP_VER >= 110
11448 VTABLE_ADD_FUNC(locale_facet__Incref)
11449 VTABLE_ADD_FUNC(locale_facet__Decref)
11450 #endif
11451 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
11452 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
11453 #if _MSVCP_VER >= 90 && _MSVCP_VER <= 100
11454 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11455 #else
11456 VTABLE_ADD_FUNC(codecvt_wchar_do_encoding)
11457 #endif
11458 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
11459 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
11460 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
11461 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
11462 __ASM_VTABLE(numpunct_char,
11463 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
11464 #if _MSVCP_VER >= 110
11465 VTABLE_ADD_FUNC(locale_facet__Incref)
11466 VTABLE_ADD_FUNC(locale_facet__Decref)
11467 #endif
11468 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
11469 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
11470 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
11471 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
11472 VTABLE_ADD_FUNC(numpunct_char_do_truename));
11473 __ASM_VTABLE(numpunct_wchar,
11474 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
11475 #if _MSVCP_VER >= 110
11476 VTABLE_ADD_FUNC(locale_facet__Incref)
11477 VTABLE_ADD_FUNC(locale_facet__Decref)
11478 #endif
11479 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
11480 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
11481 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
11482 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
11483 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
11484 __ASM_VTABLE(numpunct_short,
11485 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
11486 #if _MSVCP_VER >= 110
11487 VTABLE_ADD_FUNC(locale_facet__Incref)
11488 VTABLE_ADD_FUNC(locale_facet__Decref)
11489 #endif
11490 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
11491 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
11492 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
11493 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
11494 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
11495 __ASM_VTABLE(num_get_char,
11496 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
11497 #if _MSVCP_VER >= 110
11498 VTABLE_ADD_FUNC(locale_facet__Incref)
11499 VTABLE_ADD_FUNC(locale_facet__Decref)
11500 #endif
11501 VTABLE_ADD_FUNC(num_get_char_do_get_void)
11502 VTABLE_ADD_FUNC(num_get_char_do_get_double)
11503 VTABLE_ADD_FUNC(num_get_char_do_get_double)
11504 VTABLE_ADD_FUNC(num_get_char_do_get_float)
11505 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
11506 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
11507 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
11508 VTABLE_ADD_FUNC(num_get_char_do_get_long)
11509 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
11510 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
11511 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
11512 __ASM_VTABLE(num_get_short,
11513 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
11514 #if _MSVCP_VER >= 110
11515 VTABLE_ADD_FUNC(locale_facet__Incref)
11516 VTABLE_ADD_FUNC(locale_facet__Decref)
11517 #endif
11518 VTABLE_ADD_FUNC(num_get_short_do_get_void)
11519 VTABLE_ADD_FUNC(num_get_short_do_get_double)
11520 VTABLE_ADD_FUNC(num_get_short_do_get_double)
11521 VTABLE_ADD_FUNC(num_get_short_do_get_float)
11522 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
11523 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
11524 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
11525 VTABLE_ADD_FUNC(num_get_short_do_get_long)
11526 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
11527 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
11528 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
11529 __ASM_VTABLE(num_get_wchar,
11530 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
11531 #if _MSVCP_VER >= 110
11532 VTABLE_ADD_FUNC(locale_facet__Incref)
11533 VTABLE_ADD_FUNC(locale_facet__Decref)
11534 #endif
11535 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
11536 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
11537 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
11538 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
11539 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
11540 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
11541 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
11542 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
11543 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
11544 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
11545 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
11546 __ASM_VTABLE(num_put_char,
11547 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
11548 #if _MSVCP_VER >= 110
11549 VTABLE_ADD_FUNC(locale_facet__Incref)
11550 VTABLE_ADD_FUNC(locale_facet__Decref)
11551 #endif
11552 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
11553 VTABLE_ADD_FUNC(num_put_char_do_put_double)
11554 VTABLE_ADD_FUNC(num_put_char_do_put_double)
11555 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
11556 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
11557 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
11558 VTABLE_ADD_FUNC(num_put_char_do_put_long)
11559 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
11560 __ASM_VTABLE(num_put_wchar,
11561 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
11562 #if _MSVCP_VER >= 110
11563 VTABLE_ADD_FUNC(locale_facet__Incref)
11564 VTABLE_ADD_FUNC(locale_facet__Decref)
11565 #endif
11566 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
11567 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
11568 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
11569 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
11570 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
11571 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
11572 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
11573 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
11574 __ASM_VTABLE(num_put_short,
11575 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
11576 #if _MSVCP_VER >= 110
11577 VTABLE_ADD_FUNC(locale_facet__Incref)
11578 VTABLE_ADD_FUNC(locale_facet__Decref)
11579 #endif
11580 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
11581 VTABLE_ADD_FUNC(num_put_short_do_put_double)
11582 VTABLE_ADD_FUNC(num_put_short_do_put_double)
11583 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
11584 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
11585 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
11586 VTABLE_ADD_FUNC(num_put_short_do_put_long)
11587 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
11588 __ASM_VTABLE(time_put_char,
11589 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
11590 #if _MSVCP_VER >= 110
11591 VTABLE_ADD_FUNC(locale_facet__Incref)
11592 VTABLE_ADD_FUNC(locale_facet__Decref)
11593 #endif
11594 VTABLE_ADD_FUNC(time_put_char_do_put));
11595 __ASM_VTABLE(time_put_wchar,
11596 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
11597 #if _MSVCP_VER >= 110
11598 VTABLE_ADD_FUNC(locale_facet__Incref)
11599 VTABLE_ADD_FUNC(locale_facet__Decref)
11600 #endif
11601 VTABLE_ADD_FUNC(time_put_wchar_do_put));
11602 __ASM_VTABLE(time_put_short,
11603 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
11604 #if _MSVCP_VER >= 110
11605 VTABLE_ADD_FUNC(locale_facet__Incref)
11606 VTABLE_ADD_FUNC(locale_facet__Decref)
11607 #endif
11608 VTABLE_ADD_FUNC(time_put_wchar_do_put));
11609 __ASM_VTABLE(time_get_char,
11610 VTABLE_ADD_FUNC(time_get_char_vector_dtor)
11611 #if _MSVCP_VER >= 110
11612 VTABLE_ADD_FUNC(locale_facet__Incref)
11613 VTABLE_ADD_FUNC(locale_facet__Decref)
11614 #endif
11615 VTABLE_ADD_FUNC(time_get_char_do_date_order)
11616 VTABLE_ADD_FUNC(time_get_char_do_get_time)
11617 VTABLE_ADD_FUNC(time_get_char_do_get_date)
11618 VTABLE_ADD_FUNC(time_get_char_do_get_weekday)
11619 VTABLE_ADD_FUNC(time_get_char_do_get_monthname)
11620 VTABLE_ADD_FUNC(time_get_char_do_get_year));
11621 #ifndef __GNUC__
11623 #endif
11625 void init_locale(void *base)
11627 #ifdef __x86_64__
11628 init__Facet_base_rtti(base);
11629 init_locale_facet_rtti(base);
11630 init_locale__Locimp_rtti(base);
11631 init_collate_char_rtti(base);
11632 init_collate_wchar_rtti(base);
11633 init_collate_short_rtti(base);
11634 init_ctype_base_rtti(base);
11635 init_ctype_char_rtti(base);
11636 init_ctype_wchar_rtti(base);
11637 init_ctype_short_rtti(base);
11638 init_codecvt_base_rtti(base);
11639 init_codecvt_char_rtti(base);
11640 init_codecvt_wchar_rtti(base);
11641 init_codecvt_short_rtti(base);
11642 init_numpunct_char_rtti(base);
11643 init_numpunct_wchar_rtti(base);
11644 init_numpunct_short_rtti(base);
11645 init_num_get_char_rtti(base);
11646 init_num_get_wchar_rtti(base);
11647 init_num_get_short_rtti(base);
11648 init_num_put_char_rtti(base);
11649 init_num_put_wchar_rtti(base);
11650 init_num_put_short_rtti(base);
11651 init_time_put_char_rtti(base);
11652 init_time_put_wchar_rtti(base);
11653 init_time_put_short_rtti(base);
11654 init_time_base_rtti(base);
11655 init_time_get_char_rtti(base);
11656 #endif
11659 void free_locale(void)
11661 facets_elem *iter, *safe;
11663 if(global_locale) {
11664 locale_dtor(&classic_locale);
11665 locale__Locimp_dtor(global_locale);
11666 MSVCRT_operator_delete(global_locale);
11669 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
11670 list_remove(&iter->entry);
11671 if(call_locale_facet__Decref(iter->fac))
11672 call_locale_facet_vector_dtor(iter->fac, 1);
11673 MSVCRT_operator_delete(iter);