msvcp90: Added basic_ostream<char> class stub.
[wine/multimedia.git] / dlls / msvcp90 / msvcp90.h
blobd848782161857f8b195c60dca9ecd11f155fb3b3
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 "stdlib.h"
20 #include "windef.h"
22 typedef unsigned char MSVCP_bool;
23 typedef SIZE_T MSVCP_size_t;
24 typedef SIZE_T streamoff;
25 typedef SIZE_T streamsize;
27 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
28 const wchar_t*, unsigned int, uintptr_t);
30 extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
31 extern void (__cdecl *MSVCRT_operator_delete)(void*);
33 /* Copied from dlls/msvcrt/cpp.c */
34 #ifdef __i386__ /* thiscall functions are i386-specific */
36 #define THISCALL(func) __thiscall_ ## func
37 #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
38 #define __thiscall __stdcall
39 #define DEFINE_THISCALL_WRAPPER(func,args) \
40 extern void THISCALL(func)(void); \
41 __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
42 "popl %eax\n\t" \
43 "pushl %ecx\n\t" \
44 "pushl %eax\n\t" \
45 "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
47 #define DEFINE_THISCALL_WRAPPER_RETPTR(func,args) \
48 extern void THISCALL(func)(void); \
49 __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
50 "popl %eax\n\t" \
51 "popl %edx\n\t" \
52 "pushl %ecx\n\t" \
53 "pushl %edx\n\t" \
54 "pushl %eax\n\t" \
55 "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
56 #else /* __i386__ */
58 #define THISCALL(func) func
59 #define THISCALL_NAME(func) __ASM_NAME(#func)
60 #define __thiscall __cdecl
61 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
62 #define DEFINE_THISCALL_WRAPPER_RETPTR(func,args) /* nothing */
64 #endif /* __i386__ */
66 #ifdef _WIN64
68 #define __ASM_VTABLE(name,funcs) \
69 __asm__(".data\n" \
70 "\t.align 8\n" \
71 "\t.quad " __ASM_NAME(#name "_rtti") "\n" \
72 "\t.globl " __ASM_NAME("MSVCP_" #name "_vtable") "\n" \
73 __ASM_NAME("MSVCP_" #name "_vtable") ":\n" \
74 "\t.quad " THISCALL_NAME(MSVCP_ ## name ## _vector_dtor) "\n" \
75 funcs "\n\t.text");
77 #else
79 #define __ASM_VTABLE(name,funcs) \
80 __asm__(".data\n" \
81 "\t.align 4\n" \
82 "\t.long " __ASM_NAME(#name "_rtti") "\n" \
83 "\t.globl " __ASM_NAME("MSVCP_" #name "_vtable") "\n" \
84 __ASM_NAME("MSVCP_" #name "_vtable") ":\n" \
85 "\t.long " THISCALL_NAME(MSVCP_ ## name ## _vector_dtor) "\n" \
86 funcs "\n\t.text");
88 #endif /* _WIN64 */
90 /* exception object */
91 typedef void (*vtable_ptr)(void);
92 typedef struct __exception
94 const vtable_ptr *vtable;
95 char *name; /* Name of this exception, always a new copy for each object */
96 int do_free; /* Whether to free 'name' in our dtor */
97 } exception;
99 /* Internal: throws selected exception */
100 typedef enum __exception_type {
101 EXCEPTION,
102 EXCEPTION_BAD_ALLOC,
103 EXCEPTION_LOGIC_ERROR,
104 EXCEPTION_LENGTH_ERROR,
105 EXCEPTION_OUT_OF_RANGE,
106 EXCEPTION_INVALID_ARGUMENT
107 } exception_type;
108 void throw_exception(exception_type, const char *);
109 void set_exception_vtable(void);
111 /* rtti */
112 typedef struct __type_info
114 const vtable_ptr *vtable;
115 char *name; /* Unmangled name, allocated lazily */
116 char mangled[64]; /* Variable length, but we declare it large enough for static RTTI */
117 } type_info;
119 /* offsets for computing the this pointer */
120 typedef struct
122 int this_offset; /* offset of base class this pointer from start of object */
123 int vbase_descr; /* offset of virtual base class descriptor */
124 int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
125 } this_ptr_offsets;
127 typedef struct _rtti_base_descriptor
129 const type_info *type_descriptor;
130 int num_base_classes;
131 this_ptr_offsets offsets; /* offsets for computing the this pointer */
132 unsigned int attributes;
133 } rtti_base_descriptor;
135 typedef struct _rtti_base_array
137 const rtti_base_descriptor *bases[4]; /* First element is the class itself */
138 } rtti_base_array;
140 typedef struct _rtti_object_hierarchy
142 unsigned int signature;
143 unsigned int attributes;
144 int array_len; /* Size of the array pointed to by 'base_classes' */
145 const rtti_base_array *base_classes;
146 } rtti_object_hierarchy;
148 typedef struct _rtti_object_locator
150 unsigned int signature;
151 int base_class_offset;
152 unsigned int flags;
153 const type_info *type_descriptor;
154 const rtti_object_hierarchy *type_hierarchy;
155 } rtti_object_locator;
157 /* basic_string<char, char_traits<char>, allocator<char>> */
158 #define BUF_SIZE_CHAR 16
159 typedef struct _basic_string_char
161 void *allocator;
162 union {
163 char buf[BUF_SIZE_CHAR];
164 char *ptr;
165 } data;
166 MSVCP_size_t size;
167 MSVCP_size_t res;
168 } basic_string_char;
170 basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
171 basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
172 void __stdcall MSVCP_basic_string_char_dtor(basic_string_char*);
173 const char* __stdcall MSVCP_basic_string_char_c_str(basic_string_char*);
175 #define BUF_SIZE_WCHAR 8
176 typedef struct _basic_string_wchar
178 void *allocator;
179 union {
180 wchar_t buf[BUF_SIZE_WCHAR];
181 wchar_t *ptr;
182 } data;
183 MSVCP_size_t size;
184 MSVCP_size_t res;
185 } basic_string_wchar;
187 char* __stdcall MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
188 void __stdcall MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
189 wchar_t* __stdcall MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
190 void __stdcall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
192 /* class locale */
193 typedef struct
195 struct locale__Locimp *ptr;
196 } locale;
198 /* class _Lockit */
199 typedef struct {
200 int locktype;
201 } _Lockit;
203 void init_lockit(void);
204 void free_lockit(void);
206 /* class mutex */
207 typedef struct {
208 void *mutex;
209 } mutex;