winmm: Make WINMM_DRVMessage() static.
[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 "windef.h"
25 #include "winbase.h"
26 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
28
29 typedef int category;
30
31 typedef struct _locale_id {
32     MSVCP_size_t id;
33 } locale_id;
34
35 typedef struct _locale_facet {
36     const vtable_ptr *vtable;
37     MSVCP_size_t refs;
38 } locale_facet;
39
40 typedef struct _locale__Locimp {
41     locale_facet facet;
42     locale_facet **facetvec;
43     MSVCP_size_t facet_cnt;
44     category catmask;
45     MSVCP_bool transparent;
46     basic_string_char name;
47 } locale__Locimp;
48
49 /* ?_Id_cnt@id@locale@std@@0HA */
50 int locale_id__Id_cnt = 0;
51
52 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
53 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
54 locale__Locimp *locale__Locimp__Clocptr = NULL;
55
56 static const vtable_ptr MSVCP_locale_facet_vtable[];
57
58 /* ??0id@locale@std@@QAE@I@Z */
59 /* ??0id@locale@std@@QEAA@_K@Z */
60 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
61 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
62 {
63     FIXME("(%p %lu) stub\n", this, id);
64     return NULL;
65 }
66
67 /* ??_Fid@locale@std@@QAEXXZ */
68 /* ??_Fid@locale@std@@QEAAXXZ */
69 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
70 locale_id* __thiscall locale_id_ctor(locale_id *this)
71 {
72     FIXME("(%p) stub\n", this);
73     return NULL;
74 }
75
76 /* ??Bid@locale@std@@QAEIXZ */
77 /* ??Bid@locale@std@@QEAA_KXZ */
78 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
79 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
80 {
81     FIXME("(%p) stub\n", this);
82     return 0;
83 }
84
85 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
86 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
87 int* __cdecl locale_id__Id_cnt_func(void)
88 {
89     FIXME("stub\n");
90     return NULL;
91 }
92
93 /* ??_Ffacet@locale@std@@QAEXXZ */
94 /* ??_Ffacet@locale@std@@QEAAXXZ */
95 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
96 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
97 {
98     FIXME("(%p) stub\n", this);
99     this->vtable = MSVCP_locale_facet_vtable;
100     return NULL;
101 }
102
103 /* ??0facet@locale@std@@IAE@I@Z */
104 /* ??0facet@locale@std@@IEAA@_K@Z */
105 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
106 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
107 {
108     FIXME("(%p %lu) stub\n", this, refs);
109     return NULL;
110 }
111
112 /* ??1facet@locale@std@@UAE@XZ */
113 /* ??1facet@locale@std@@UEAA@XZ */
114 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
115 void __thiscall locale_facet_dtor(locale_facet *this)
116 {
117     FIXME("(%p) stub\n", this);
118 }
119
120 DEFINE_THISCALL_WRAPPER(MSVCP_locale_facet_vector_dtor, 8)
121 locale_facet* __thiscall MSVCP_locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
122 {
123     TRACE("(%p %x) stub\n", this, flags);
124     if(flags & 2) {
125         /* we have an array, with the number of elements stored before the first object */
126         int i, *ptr = (int *)this-1;
127
128         for(i=*ptr-1; i>=0; i--)
129             locale_facet_dtor(this+i);
130         MSVCRT_operator_delete(ptr);
131     } else {
132         locale_facet_dtor(this);
133         if(flags & 1)
134             MSVCRT_operator_delete(this);
135     }
136
137     return this;
138 }
139
140 /* ?_Incref@facet@locale@std@@QAEXXZ */
141 /* ?_Incref@facet@locale@std@@QEAAXXZ */
142 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
143 void __thiscall locale_facet__Incref(locale_facet *this)
144 {
145     FIXME("(%p) stub\n", this);
146 }
147
148 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
149 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
150 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
151 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
152 {
153     FIXME("(%p) stub\n", this);
154     return NULL;
155 }
156
157 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
158 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
159 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
160 {
161     FIXME("(%p %p) stub\n", facet, loc);
162     return 0;
163 }
164
165 static const vtable_ptr MSVCP_locale_facet_vtable[] = {
166     (vtable_ptr)THISCALL_NAME(MSVCP_locale_facet_vector_dtor)
167 };
168
169 /* ??_F_Locimp@locale@std@@QAEXXZ */
170 /* ??_F_Locimp@locale@std@@QEAAXXZ */
171 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
172 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
173 {
174     FIXME("(%p) stub\n", this);
175     return NULL;
176 }
177
178 /* ??0_Locimp@locale@std@@AAE@_N@Z */
179 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
180 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
181 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
182 {
183     FIXME("(%p %d) stub\n", this, transparent);
184     return NULL;
185 }
186
187 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
188 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
189 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
190 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
191 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
192 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
193 {
194     FIXME("(%p %p) stub\n", this, copy);
195     return NULL;
196 }
197
198 /* ??1_Locimp@locale@std@@MAE@XZ */
199 /* ??1_Locimp@locale@std@@MEAA@XZ */
200 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
201 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
202 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
203 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
204 {
205     FIXME("(%p) stub\n", this);
206 }
207
208 DEFINE_THISCALL_WRAPPER(MSVCP_locale__Locimp_vector_dtor, 8)
209 locale__Locimp* __thiscall MSVCP_locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
210 {
211     TRACE("(%p %x) stub\n", this, flags);
212     if(flags & 2) {
213         /* we have an array, with the number of elements stored before the first object */
214         int i, *ptr = (int *)this-1;
215
216         for(i=*ptr-1; i>=0; i--)
217             locale__Locimp_dtor(this+i);
218         MSVCRT_operator_delete(ptr);
219     } else {
220         locale__Locimp_dtor(this);
221         if(flags & 1)
222             MSVCRT_operator_delete(this);
223     }
224
225     return this;
226 }
227
228 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
229 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
230 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
231 {
232     FIXME("(%p %p %lu) stub\n", locimp, facet, id);
233 }
234
235 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
236 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
237 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
238 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
239 {
240     FIXME("(%p %p %lu) stub\n", this, facet, id);
241 }
242
243 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
244 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
245 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
246 {
247     FIXME("stub\n");
248     return NULL;
249 }
250
251 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
252 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
253 locale__Locimp* __cdecl locale__Locimp__Makeloc(const /*_Locinfo*/void *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
254 {
255     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
256     return NULL;
257 }
258
259 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
260 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
261 void __cdecl locale__Locimp__Makeushloc(const /*_Locinfo*/void *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
262 {
263     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
264 }
265
266 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
267 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
268 void __cdecl locale__Locimp__Makewloc(const /*_Locinfo*/void *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
269 {
270     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
271 }
272
273 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
274 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
275 void __cdecl locale__Locimp__Makexloc(const /*_Locinfo*/void *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
276 {
277     FIXME("(%p %d %p %p) stub\n", locinfo, cat, locimp, loc);
278 }
279
280 /* ??_7_Locimp@locale@std@@6B@ */
281 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
282     (vtable_ptr)THISCALL_NAME(MSVCP_locale__Locimp_vector_dtor)
283 };
284
285 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
286 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
287 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
288 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
289 {
290     FIXME("(%p %p) stub\n", this, locimp);
291     return NULL;
292 }
293
294 /* ??0locale@std@@QAE@ABV01@0H@Z */
295 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
296 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
297 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
298 {
299     FIXME("(%p %p %p %d) stub\n", this, loc, other, cat);
300     return NULL;
301 }
302
303 /* ??0locale@std@@QAE@ABV01@@Z */
304 /* ??0locale@std@@QEAA@AEBV01@@Z */
305 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
306 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
307 {
308     FIXME("(%p %p) stub\n", this, copy);
309     return NULL;
310 }
311
312 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
313 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
314 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
315 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
316 {
317     FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
318     return NULL;
319 }
320
321 /* ??0locale@std@@QAE@PBDH@Z */
322 /* ??0locale@std@@QEAA@PEBDH@Z */
323 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
324 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
325 {
326     FIXME("(%p %s %d) stub\n", this, locname, cat);
327     return NULL;
328 }
329
330 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
331 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
332 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
333 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
334 {
335     FIXME("(%p %d) stub\n", this, uninitialized);
336     return NULL;
337 }
338
339 /* ??0locale@std@@QAE@XZ */
340 /* ??0locale@std@@QEAA@XZ */
341 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
342 locale* __thiscall locale_ctor(locale *this)
343 {
344     FIXME("(%p) stub\n", this);
345     return NULL;
346 }
347
348 /* ??1locale@std@@QAE@XZ */
349 /* ??1locale@std@@QEAA@XZ */
350 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
351 void __thiscall locale_dtor(locale *this)
352 {
353     FIXME("(%p) stub\n", this);
354 }
355
356 DEFINE_THISCALL_WRAPPER(MSVCP_locale_vector_dtor, 8)
357 locale* __thiscall MSVCP_locale_vector_dtor(locale *this, unsigned int flags)
358 {
359     TRACE("(%p %x) stub\n", this, flags);
360     if(flags & 2) {
361         /* we have an array, with the number of elements stored before the first object */
362         int i, *ptr = (int *)this-1;
363
364         for(i=*ptr-1; i>=0; i--)
365             locale_dtor(this+i);
366         MSVCRT_operator_delete(ptr);
367     } else {
368         locale_dtor(this);
369         if(flags & 1)
370             MSVCRT_operator_delete(this);
371     }
372
373     return this;
374 }
375
376 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
377 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
378 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
379 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
380 {
381     FIXME("(%p %p) stub\n", this, loc);
382     return NULL;
383 }
384
385 /* ??8locale@std@@QBE_NABV01@@Z */
386 /* ??8locale@std@@QEBA_NAEBV01@@Z */
387 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
388 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
389 {
390     FIXME("(%p %p) stub\n", this, loc);
391     return 0;
392 }
393
394 /* ??9locale@std@@QBE_NABV01@@Z */
395 /* ??9locale@std@@QEBA_NAEBV01@@Z */
396 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
397 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
398 {
399     FIXME("(%p %p) stub\n", this, loc);
400     return 0;
401 }
402
403 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
404 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
405 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
406 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
407 {
408     FIXME("(%p %p %lu %lu) stub\n", this, facet, id, catmask);
409     return NULL;
410 }
411
412 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
413 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
414 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
415 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
416 {
417     FIXME("(%p %lu) stub\n", this, id);
418     return NULL;
419 }
420
421 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
422 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
423 locale__Locimp* __cdecl locale__Init(void)
424 {
425     FIXME("stub\n");
426     return NULL;
427 }
428
429 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
430 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
431 locale__Locimp* __cdecl locale__Getgloballocale(void)
432 {
433     FIXME("stub\n");
434     return NULL;
435 }
436
437 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
438 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
439 void __cdecl locale__Setgloballocale(void *locimp)
440 {
441     FIXME("(%p) stub\n", locimp);
442 }
443
444 /* ?classic@locale@std@@SAABV12@XZ */
445 /* ?classic@locale@std@@SAAEBV12@XZ */
446 const locale* __cdecl locale_classic(void)
447 {
448     FIXME("stub\n");
449     return NULL;
450 }
451
452 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
453 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
454 DEFINE_THISCALL_WRAPPER_RETPTR(locale_name, 4)
455 basic_string_char __thiscall locale_name(const locale *this)
456 {
457     basic_string_char ret = { 0 }; /* FIXME */
458     FIXME( "(%p) stub\n", this);
459     return ret;
460 }