dinput: Stub IDirectInputJoyConfig8 interface.
[wine] / dlls / msvcp90 / locale.c
1 /*
2  * Copyright 2010 Piotr Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22
23 #include "msvcp90.h"
24 #include "locale.h"
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
30
31 typedef int category;
32
33 typedef struct _locale_id {
34     MSVCP_size_t id;
35 } locale_id;
36
37 typedef struct _locale_facet {
38     const vtable_ptr *vtable;
39     MSVCP_size_t refs;
40 } locale_facet;
41
42 typedef struct _locale__Locimp {
43     locale_facet facet;
44     locale_facet **facetvec;
45     MSVCP_size_t facet_cnt;
46     category catmask;
47     MSVCP_bool transparent;
48     basic_string_char name;
49 } locale__Locimp;
50
51 typedef struct {
52     void *timeptr;
53 } _Timevec;
54
55 typedef struct {
56     _Lockit lock;
57     basic_string_char days;
58     basic_string_char months;
59     basic_string_char oldlocname;
60     basic_string_char newlocname;
61 } _Locinfo;
62
63 typedef struct {
64     LCID handle;
65     unsigned page;
66 } _Collvec;
67
68 typedef struct {
69     LCID handle;
70     unsigned page;
71     const short *table;
72     int delfl;
73 } _Ctypevec;
74
75 typedef struct {
76     LCID handle;
77     unsigned page;
78 } _Cvtvec;
79
80 /* ?_Id_cnt@id@locale@std@@0HA */
81 int locale_id__Id_cnt = 0;
82
83 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
84 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
85 locale__Locimp *locale__Locimp__Clocptr = NULL;
86
87 /* ??1facet@locale@std@@UAE@XZ */
88 /* ??1facet@locale@std@@UEAA@XZ */
89 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
90 void __thiscall locale_facet_dtor(locale_facet *this)
91 {
92     TRACE("(%p)\n", this);
93 }
94
95 DEFINE_THISCALL_WRAPPER(MSVCP_locale_facet_vector_dtor, 8)
96 locale_facet* __thiscall MSVCP_locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
97 {
98     TRACE("(%p %x)\n", this, flags);
99     if(flags & 2) {
100         /* we have an array, with the number of elements stored before the first object */
101         int i, *ptr = (int *)this-1;
102
103         for(i=*ptr-1; i>=0; i--)
104             locale_facet_dtor(this+i);
105         MSVCRT_operator_delete(ptr);
106     } else {
107         locale_facet_dtor(this);
108         if(flags & 1)
109             MSVCRT_operator_delete(this);
110     }
111
112     return this;
113 }
114
115 static const vtable_ptr MSVCP_locale_facet_vtable[] = {
116     (vtable_ptr)THISCALL_NAME(MSVCP_locale_facet_vector_dtor)
117 };
118 #ifdef __i386__
119 static inline locale_facet* call_locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
120 {
121     locale_facet *ret;
122     void *dummy;
123
124     __asm__ __volatile__ ("pushl %3\n\tcall *%2"
125                           : "=a" (ret), "=c" (dummy)
126                           : "r" (this->vtable[0]), "r" (flags), "1" (this)
127                           : "edx", "memory" );
128     return ret;
129 }
130 #else
131 static inline locale_facet* call_locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
132 {
133     locale_facet * (__thiscall *dtor)(locale_facet *, unsigned int) = (void *)this->vtable[0];
134     return dtor(this, flags);
135 }
136 #endif
137
138 /* ??0id@locale@std@@QAE@I@Z */
139 /* ??0id@locale@std@@QEAA@_K@Z */
140 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
141 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
142 {
143     TRACE("(%p %lu)\n", this, id);
144
145     this->id = id;
146     return this;
147 }
148
149 /* ??_Fid@locale@std@@QAEXXZ */
150 /* ??_Fid@locale@std@@QEAAXXZ */
151 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
152 locale_id* __thiscall locale_id_ctor(locale_id *this)
153 {
154     TRACE("(%p)\n", this);
155
156     this->id = 0;
157     return this;
158 }
159
160 /* ??Bid@locale@std@@QAEIXZ */
161 /* ??Bid@locale@std@@QEAA_KXZ */
162 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
163 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
164 {
165     _Lockit lock;
166
167     TRACE("(%p)\n", this);
168
169     if(!this->id) {
170         _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
171         this->id = ++locale_id__Id_cnt;
172         _Lockit_dtor(&lock);
173     }
174
175     return this->id;
176 }
177
178 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
179 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
180 int* __cdecl locale_id__Id_cnt_func(void)
181 {
182     TRACE("\n");
183     return &locale_id__Id_cnt;
184 }
185
186 /* ??_Ffacet@locale@std@@QAEXXZ */
187 /* ??_Ffacet@locale@std@@QEAAXXZ */
188 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
189 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
190 {
191     TRACE("(%p)\n", this);
192     this->vtable = MSVCP_locale_facet_vtable;
193     this->refs = 0;
194     return this;
195 }
196
197 /* ??0facet@locale@std@@IAE@I@Z */
198 /* ??0facet@locale@std@@IEAA@_K@Z */
199 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
200 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
201 {
202     TRACE("(%p %lu)\n", this, refs);
203     this->vtable = MSVCP_locale_facet_vtable;
204     this->refs = refs;
205     return this;
206 }
207
208 /* ?_Incref@facet@locale@std@@QAEXXZ */
209 /* ?_Incref@facet@locale@std@@QEAAXXZ */
210 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
211 void __thiscall locale_facet__Incref(locale_facet *this)
212 {
213     _Lockit lock;
214
215     TRACE("(%p)\n", this);
216
217     _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
218     this->refs++;
219     _Lockit_dtor(&lock);
220 }
221
222 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
223 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
224 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
225 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
226 {
227     _Lockit lock;
228     locale_facet *ret;
229
230     TRACE("(%p)\n", this);
231
232     _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
233     if(this->refs)
234         this->refs--;
235
236     ret = this->refs ? NULL : this;
237     _Lockit_dtor(&lock);
238
239     return ret;
240 }
241
242 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
243 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
244 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
245 {
246     TRACE("(%p %p)\n", facet, loc);
247     return -1;
248 }
249
250 /* ??0_Locimp@locale@std@@AAE@_N@Z */
251 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
252 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
253 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
254 {
255     TRACE("(%p %d)\n", this, transparent);
256
257     memset(this, 0, sizeof(locale__Locimp));
258     locale_facet_ctor_refs(&this->facet, 1);
259     this->transparent = transparent;
260     MSVCP_basic_string_char_ctor_cstr(&this->name, "*");
261     return this;
262 }
263
264 /* ??_F_Locimp@locale@std@@QAEXXZ */
265 /* ??_F_Locimp@locale@std@@QEAAXXZ */
266 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
267 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
268 {
269     return locale__Locimp_ctor_transparent(this, FALSE);
270 }
271
272 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
273 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
274 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
275 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
276 {
277     _Lockit lock;
278     MSVCP_size_t i;
279
280     TRACE("(%p %p)\n", this, copy);
281
282     _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
283     memcpy(this, copy, sizeof(locale__Locimp));
284     locale_facet_ctor_refs(&this->facet, 1);
285     if(copy->facetvec) {
286         this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
287         if(!this->facetvec) {
288             _Lockit_dtor(&lock);
289             ERR("Out of memory\n");
290             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
291             return NULL;
292         }
293         for(i=0; i<this->facet_cnt; i++)
294             if(this->facetvec[i])
295                 locale_facet__Incref(this->facetvec[i]);
296     }
297     MSVCP_basic_string_char_copy_ctor(&this->name, &copy->name);
298     _Lockit_dtor(&lock);
299     return this;
300 }
301
302 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
303 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
304 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
305 {
306     return locale__Locimp_copy_ctor(this, copy);
307 }
308
309 /* ??1_Locimp@locale@std@@MAE@XZ */
310 /* ??1_Locimp@locale@std@@MEAA@XZ */
311 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
312 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
313 {
314     TRACE("(%p)\n", this);
315
316     if(locale_facet__Decref(&this->facet)) {
317         MSVCP_size_t i;
318         for(i=0; i<this->facet_cnt; i++)
319             if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
320                 call_locale_facet_vector_dtor(this->facetvec[i], 0);
321
322         MSVCRT_operator_delete(this->facetvec);
323         MSVCP_basic_string_char_dtor(&this->name);
324     }
325 }
326
327 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
328 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
329 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
330 {
331     locale__Locimp_dtor(this);
332 }
333
334 DEFINE_THISCALL_WRAPPER(MSVCP_locale__Locimp_vector_dtor, 8)
335 locale__Locimp* __thiscall MSVCP_locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
336 {
337     TRACE("(%p %x)\n", this, flags);
338     if(flags & 2) {
339         /* we have an array, with the number of elements stored before the first object */
340         int i, *ptr = (int *)this-1;
341
342         for(i=*ptr-1; i>=0; i--)
343             locale__Locimp_dtor(this+i);
344         MSVCRT_operator_delete(ptr);
345     } else {
346         locale__Locimp_dtor(this);
347         if(flags & 1)
348             MSVCRT_operator_delete(this);
349     }
350
351     return this;
352 }
353
354 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
355 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
356 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
357 {
358     _Lockit lock;
359
360     TRACE("(%p %p %lu)\n", locimp, facet, id);
361
362     _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
363     if(id >= locimp->facet_cnt) {
364         MSVCP_size_t new_size = id+1;
365         locale_facet **new_facetvec;
366
367         if(new_size < locale_id__Id_cnt+1)
368             new_size = locale_id__Id_cnt+1;
369
370         new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
371         if(!new_facetvec) {
372             _Lockit_dtor(&lock);
373             ERR("Out of memory\n");
374             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
375             return;
376         }
377
378         memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
379         memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
380         MSVCRT_operator_delete(locimp->facetvec);
381         locimp->facetvec = new_facetvec;
382         locimp->facet_cnt = new_size;
383     }
384
385     if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
386         call_locale_facet_vector_dtor(locimp->facetvec[id], 0);
387
388     locimp->facetvec[id] = facet;
389     if(facet)
390         locale_facet__Incref(facet);
391     _Lockit_dtor(&lock);
392 }
393
394 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
395 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
396 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
397 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
398 {
399     locale__Locimp__Locimp_Addfac(this, facet, id);
400 }
401
402 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
403 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
404 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
405 {
406     FIXME("stub\n");
407     return NULL;
408 }
409
410 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
411 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
412 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
413 {
414     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
415     return NULL;
416 }
417
418 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
419 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
420 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
421 {
422     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
423 }
424
425 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
426 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
427 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
428 {
429     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
430 }
431
432 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
433 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
434 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
435 {
436     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
437 }
438
439 /* ??_7_Locimp@locale@std@@6B@ */
440 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
441     (vtable_ptr)THISCALL_NAME(MSVCP_locale__Locimp_vector_dtor)
442 };
443
444 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
445 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
446 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
447 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
448 {
449     TRACE("(%p %p)\n", this, locimp);
450     /* Don't change locimp reference counter */
451     this->ptr = locimp;
452     return this;
453 }
454
455 /* ??0locale@std@@QAE@ABV01@0H@Z */
456 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
457 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
458 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
459 {
460     FIXME("(%p %p %p %d) stub\n", this, loc, other, cat);
461     return NULL;
462 }
463
464 /* ??0locale@std@@QAE@ABV01@@Z */
465 /* ??0locale@std@@QEAA@AEBV01@@Z */
466 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
467 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
468 {
469     TRACE("(%p %p)\n", this, copy);
470     this->ptr = copy->ptr;
471     locale_facet__Incref(&this->ptr->facet);
472     return this;
473 }
474
475 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
476 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
477 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
478 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
479 {
480     FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
481     return NULL;
482 }
483
484 /* ??0locale@std@@QAE@PBDH@Z */
485 /* ??0locale@std@@QEAA@PEBDH@Z */
486 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
487 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
488 {
489     FIXME("(%p %s %d) stub\n", this, locname, cat);
490     return NULL;
491 }
492
493 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
494 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
495 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
496 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
497 {
498     TRACE("(%p)\n", this);
499     this->ptr = NULL;
500     return this;
501 }
502
503 /* ??0locale@std@@QAE@XZ */
504 /* ??0locale@std@@QEAA@XZ */
505 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
506 locale* __thiscall locale_ctor(locale *this)
507 {
508     TRACE("(%p)\n", this);
509     this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
510     if(!this->ptr) {
511         ERR("Out of memory\n");
512         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
513         return NULL;
514     }
515
516     locale__Locimp_ctor(this->ptr);
517     return this;
518 }
519
520 /* ??1locale@std@@QAE@XZ */
521 /* ??1locale@std@@QEAA@XZ */
522 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
523 void __thiscall locale_dtor(locale *this)
524 {
525     TRACE("(%p)\n", this);
526     if(this->ptr)
527         locale__Locimp_dtor(this->ptr);
528 }
529
530 DEFINE_THISCALL_WRAPPER(MSVCP_locale_vector_dtor, 8)
531 locale* __thiscall MSVCP_locale_vector_dtor(locale *this, unsigned int flags)
532 {
533     TRACE("(%p %x)\n", this, flags);
534     if(flags & 2) {
535         /* we have an array, with the number of elements stored before the first object */
536         int i, *ptr = (int *)this-1;
537
538         for(i=*ptr-1; i>=0; i--)
539             locale_dtor(this+i);
540         MSVCRT_operator_delete(ptr);
541     } else {
542         locale_dtor(this);
543         if(flags & 1)
544             MSVCRT_operator_delete(this);
545     }
546
547     return this;
548 }
549
550 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
551 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
552 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
553 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
554 {
555     FIXME("(%p %p) stub\n", this, loc);
556     return NULL;
557 }
558
559 /* ??8locale@std@@QBE_NABV01@@Z */
560 /* ??8locale@std@@QEBA_NAEBV01@@Z */
561 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
562 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
563 {
564     FIXME("(%p %p) stub\n", this, loc);
565     return 0;
566 }
567
568 /* ??9locale@std@@QBE_NABV01@@Z */
569 /* ??9locale@std@@QEBA_NAEBV01@@Z */
570 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
571 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
572 {
573     FIXME("(%p %p) stub\n", this, loc);
574     return 0;
575 }
576
577 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
578 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
579 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
580 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
581 {
582     TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
583
584     if(this->ptr->facet.refs > 1) {
585         locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
586         if(!new_ptr) {
587             ERR("Out of memory\n");
588             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
589             return NULL;
590         }
591         locale__Locimp_copy_ctor(new_ptr, this->ptr);
592         locale_facet__Decref(&this->ptr->facet);
593         this->ptr = new_ptr;
594     }
595
596     locale__Locimp__Addfac(this->ptr, facet, id);
597
598     if(catmask) {
599         MSVCP_basic_string_char_dtor(&this->ptr->name);
600         MSVCP_basic_string_char_ctor_cstr(&this->ptr->name, "*");
601     }
602     return this;
603 }
604
605 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
606 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
607 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
608 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
609 {
610     FIXME("(%p %lu) stub\n", this, id);
611     return NULL;
612 }
613
614 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
615 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
616 locale__Locimp* __cdecl locale__Init(void)
617 {
618     FIXME("stub\n");
619     return NULL;
620 }
621
622 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
623 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
624 locale__Locimp* __cdecl locale__Getgloballocale(void)
625 {
626     FIXME("stub\n");
627     return NULL;
628 }
629
630 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
631 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
632 void __cdecl locale__Setgloballocale(void *locimp)
633 {
634     FIXME("(%p) stub\n", locimp);
635 }
636
637 /* ?classic@locale@std@@SAABV12@XZ */
638 /* ?classic@locale@std@@SAAEBV12@XZ */
639 const locale* __cdecl locale_classic(void)
640 {
641     FIXME("stub\n");
642     return NULL;
643 }
644
645 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
646 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
647 DEFINE_THISCALL_WRAPPER_RETPTR(locale_name, 4)
648 basic_string_char __thiscall locale_name(const locale *this)
649 {
650     TRACE( "(%p)\n", this);
651     return this->ptr->name;
652 }
653
654 /* ??0_Timevec@std@@QAE@ABV01@@Z */
655 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
656 /* This copy constructor modifies copied object */
657 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
658 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
659 {
660     TRACE("(%p %p)\n", this, copy);
661     this->timeptr = copy->timeptr;
662     copy->timeptr = NULL;
663     return this;
664 }
665
666 /* ??0_Timevec@std@@QAE@PAX@Z */
667 /* ??0_Timevec@std@@QEAA@PEAX@Z */
668 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
669 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
670 {
671     TRACE("(%p %p)\n", this, timeptr);
672     this->timeptr = timeptr;
673     return this;
674 }
675
676 /* ??_F_Timevec@std@@QAEXXZ */
677 /* ??_F_Timevec@std@@QEAAXXZ */
678 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
679 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
680 {
681     TRACE("(%p)\n", this);
682     this->timeptr = NULL;
683     return this;
684 }
685
686 /* ??1_Timevec@std@@QAE@XZ */
687 /* ??1_Timevec@std@@QEAA@XZ */
688 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
689 void __thiscall _Timevec_dtor(_Timevec *this)
690 {
691     TRACE("(%p)\n", this);
692     MSVCRT_operator_delete(this->timeptr);
693 }
694
695 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
696 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
697 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
698 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
699 {
700     TRACE("(%p %p)\n", this, right);
701     this->timeptr = right->timeptr;
702     right->timeptr = NULL;
703     return this;
704 }
705
706 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
707 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
708 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
709 void* __thiscall _Timevec__Getptr(_Timevec *this)
710 {
711     TRACE("(%p)\n", this);
712     return this->timeptr;
713 }
714
715 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
716 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
717 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
718 {
719     FIXME("(%p %p) stub\n", locinfo, locstr);
720     return NULL;
721 }
722
723 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
724 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
725 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
726 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
727 {
728     FIXME("(%p %p) stub\n", this, locstr);
729     return NULL;
730 }
731
732 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
733 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
734 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
735 {
736     FIXME("(%p %d %s) stub\n", locinfo, category, locstr);
737     return NULL;
738 }
739
740 /* ??0_Locinfo@std@@QAE@HPBD@Z */
741 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
742 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
743 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
744 {
745     FIXME("(%p %d %s) stub\n", this, category, locstr);
746     return NULL;
747 }
748
749 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
750 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
751 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
752 {
753     FIXME("(%p %s) stub\n", locinfo, locstr);
754     return NULL;
755 }
756
757 /* ??0_Locinfo@std@@QAE@PBD@Z */
758 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
759 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
760 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
761 {
762     FIXME("(%p %s) stub\n", this, locstr);
763     return NULL;
764 }
765
766 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
767 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
768 _Locinfo* __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
769 {
770     FIXME("(%p) stub\n", locinfo);
771     return NULL;
772 }
773
774 /* ??_F_Locinfo@std@@QAEXXZ */
775 /* ??_F_Locinfo@std@@QEAAXXZ */
776 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
777 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
778 {
779     FIXME("(%p) stub\n", this);
780     return NULL;
781 }
782
783 /* ??1_Locinfo@std@@QAE@XZ */
784 /* ??1_Locinfo@std@@QEAA@XZ */
785 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
786 void __thiscall _Locinfo_dtor(_Locinfo *this)
787 {
788     FIXME("(%p) stub\n", this);
789 }
790
791 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
792 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
793 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
794 {
795     FIXME("%p %d %s) stub\n", locinfo, category, locstr);
796     return NULL;
797 }
798
799 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
800 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
801 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
802 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
803 {
804     FIXME("(%p %d %s) stub\n", this, category, locstr);
805     return NULL;
806 }
807
808 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
809 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
810 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 4)
811 _Collvec __thiscall _Locinfo__Getcoll(const _Locinfo *this)
812 {
813     _Collvec ret = { 0 }; /* FIXME */
814     FIXME("(%p) stub\n", this);
815     return ret;
816 }
817
818 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
819 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
820 DEFINE_THISCALL_WRAPPER_RETPTR(_Locinfo__Getctype, 4)
821 _Ctypevec __thiscall _Locinfo__Getctype(const _Locinfo *this)
822 {
823     _Ctypevec ret = { 0 }; /* FIXME */
824     FIXME("(%p) stub\n", this);
825     return ret;
826 }
827
828 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
829 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
830 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 4)
831 _Cvtvec __thiscall _Locinfo__Getcvt(const _Locinfo *this)
832 {
833     _Cvtvec ret = { 0 }; /* FIXME */
834     FIXME("(%p) stub\n", this);
835     return ret;
836 }
837
838 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
839 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
840 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
841 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
842 {
843     FIXME("(%p) stub\n", this);
844     return 0;
845 }
846
847 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
848 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
849 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
850 const char* __thiscall _Locinfo__Getdays(const _Locinfo *this)
851 {
852     FIXME("(%p) stub\n", this);
853     return NULL;
854 }
855
856 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
857 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
858 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
859 const char* __thiscall _Locinfo__Getmonths(const _Locinfo *this)
860 {
861     FIXME("(%p) stub\n", this);
862     return NULL;
863 }
864
865 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
866 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
867 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
868 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
869 {
870     FIXME("(%p) stub\n", this);
871     return NULL;
872 }
873
874 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
875 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
876 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
877 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
878 {
879     FIXME("(%p) stub\n", this);
880     return NULL;
881 }
882
883 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
884 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
885 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
886 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
887 {
888     FIXME("(%p) stub\n", this);
889     return NULL;
890 }
891
892 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
893 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
894 DEFINE_THISCALL_WRAPPER_RETPTR(_Locinfo__Getname, 4)
895 basic_string_char __thiscall _Locinfo__Getname(const _Locinfo *this)
896 {
897     basic_string_char ret = { 0 }; /* FIXME */
898     FIXME("(%p) stub\n", this);
899     return ret;
900 }
901
902 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
903 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
904 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 4)
905 _Timevec __thiscall _Locinfo__Gettnames(const _Locinfo *this)
906 {
907     _Timevec ret = { 0 }; /* FIXME */
908     FIXME("(%p) stub\n", this);
909     return ret;
910 }