2 * msvcrt.dll C++ objects
4 * Copyright 2000 Jon Griffiths
8 DEFAULT_DEBUG_CHANNEL(msvcrt
);
11 void __cdecl
MSVCRT__purecall(void);
13 typedef void (__cdecl
*v_table_ptr
)();
15 static v_table_ptr exception_vtable
[2];
16 static v_table_ptr bad_typeid_vtable
[3];
17 static v_table_ptr __non_rtti_object_vtable
[3];
18 static v_table_ptr bad_cast_vtable
[3];
19 static v_table_ptr type_info_vtable
[1];
21 typedef struct __exception
25 int do_free
; /* FIXME: take string copy with char* ctor? */
28 typedef struct __bad_typeid
33 typedef struct ____non_rtti_object
38 typedef struct __bad_cast
43 typedef struct __type_info
50 /******************************************************************
51 * exception_ctor (MSVCRT.@)
53 void __cdecl
MSVCRT_exception_ctor(exception
* _this
, const char ** name
)
55 TRACE("(%p %s)\n",_this
,*name
);
56 _this
->vtable
= exception_vtable
;
58 TRACE("name = %s\n",_this
->name
);
59 _this
->do_free
= 0; /* FIXME */
62 /******************************************************************
63 * exception_copy_ctor (MSVCRT.@)
65 void __cdecl
MSVCRT_exception_copy_ctor(exception
* _this
, const exception
* rhs
)
67 TRACE("(%p %p)\n",_this
,rhs
);
69 memcpy (_this
, rhs
, sizeof (*_this
));
70 TRACE("name = %s\n",_this
->name
);
73 /******************************************************************
74 * exception_default_ctor (MSVCRT.@)
76 void __cdecl
MSVCRT_exception_default_ctor(exception
* _this
)
78 TRACE("(%p)\n",_this
);
79 _this
->vtable
= exception_vtable
;
81 _this
->do_free
= 0; /* FIXME */
84 /******************************************************************
85 * exception_dtor (MSVCRT.@)
87 void __cdecl
MSVCRT_exception_dtor(exception
* _this
)
89 TRACE("(%p)\n",_this
);
92 /******************************************************************
93 * exception_opequals (MSVCRT.@)
95 exception
* __cdecl
MSVCRT_exception_opequals(exception
* _this
, const exception
* rhs
)
97 TRACE("(%p %p)\n",_this
,rhs
);
98 memcpy (_this
, rhs
, sizeof (*_this
));
99 TRACE("name = %s\n",_this
->name
);
103 /******************************************************************
104 * exception__unknown_E (MSVCRT.@)
106 void * __cdecl
MSVCRT_exception__unknown_E(exception
* _this
, unsigned int arg1
)
108 TRACE("(%p %d)\n",_this
,arg1
);
113 /******************************************************************
114 * exception__unknown_G (MSVCRT.@)
116 void * __cdecl
MSVCRT_exception__unknown_G(exception
* _this
, unsigned int arg1
)
118 TRACE("(%p %d)\n",_this
,arg1
);
123 /******************************************************************
124 * exception_what (MSVCRT.@)
126 const char * __stdcall
MSVCRT_exception_what(exception
* _this
)
128 TRACE("(%p) returning %s\n",_this
,_this
->name
);
133 /******************************************************************
134 * bad_typeid_copy_ctor (MSVCRT.@)
136 void __cdecl
MSVCRT_bad_typeid_copy_ctor(bad_typeid
* _this
, const bad_typeid
* rhs
)
138 TRACE("(%p %p)\n",_this
,rhs
);
139 MSVCRT_exception_copy_ctor(&_this
->base
,&rhs
->base
);
142 /******************************************************************
143 * bad_typeid_ctor (MSVCRT.@)
145 void __cdecl
MSVCRT_bad_typeid_ctor(bad_typeid
* _this
, const char * name
)
147 TRACE("(%p %s)\n",_this
,name
);
148 MSVCRT_exception_ctor(&_this
->base
, &name
);
149 _this
->base
.vtable
= bad_typeid_vtable
;
152 /******************************************************************
153 * bad_typeid_dtor (MSVCRT.@)
155 void __cdecl
MSVCRT_bad_typeid_dtor(bad_typeid
* _this
)
157 TRACE("(%p)\n",_this
);
158 MSVCRT_exception_dtor(&_this
->base
);
161 /******************************************************************
162 * bad_typeid_opequals (MSVCRT.@)
164 bad_typeid
* __cdecl
MSVCRT_bad_typeid_opequals(bad_typeid
* _this
, const bad_typeid
* rhs
)
166 TRACE("(%p %p)\n",_this
,rhs
);
167 MSVCRT_exception_copy_ctor(&_this
->base
,&rhs
->base
);
171 /******************************************************************
172 * __non_rtti_object_copy_ctor (MSVCRT.@)
174 void __cdecl
MSVCRT___non_rtti_object_copy_ctor(__non_rtti_object
* _this
,
175 const __non_rtti_object
* rhs
)
177 TRACE("(%p %p)\n",_this
,rhs
);
178 MSVCRT_bad_typeid_copy_ctor(&_this
->base
,&rhs
->base
);
181 /******************************************************************
182 * __non_rtti_object_ctor (MSVCRT.@)
184 void __cdecl
MSVCRT___non_rtti_object_ctor(__non_rtti_object
* _this
,
187 TRACE("(%p %s)\n",_this
,name
);
188 MSVCRT_bad_typeid_ctor(&_this
->base
,name
);
189 _this
->base
.base
.vtable
= __non_rtti_object_vtable
;
192 /******************************************************************
193 * __non_rtti_object_dtor (MSVCRT.@)
195 void __cdecl
MSVCRT___non_rtti_object_dtor(__non_rtti_object
* _this
)
197 TRACE("(%p)\n",_this
);
198 MSVCRT_bad_typeid_dtor(&_this
->base
);
201 /******************************************************************
202 * __non_rtti_object_opequals (MSVCRT.@)
204 __non_rtti_object
* __cdecl
MSVCRT___non_rtti_object_opequals(__non_rtti_object
* _this
,
205 const __non_rtti_object
*rhs
)
207 TRACE("(%p %p)\n",_this
,rhs
);
208 memcpy (_this
, rhs
, sizeof (*_this
));
209 TRACE("name = %s\n",_this
->base
.base
.name
);
213 /******************************************************************
214 * __non_rtti_object__unknown_E (MSVCRT.@)
216 void * __cdecl
MSVCRT___non_rtti_object__unknown_E(__non_rtti_object
* _this
, unsigned int arg1
)
218 TRACE("(%p %d)\n",_this
,arg1
);
223 /******************************************************************
224 * __non_rtti_object__unknown_G (MSVCRT.@)
226 void * __cdecl
MSVCRT___non_rtti_object__unknown_G(__non_rtti_object
* _this
, unsigned int arg1
)
228 TRACE("(%p %d)\n",_this
,arg1
);
233 /******************************************************************
234 * bad_cast_ctor (MSVCRT.@)
236 void __cdecl
MSVCRT_bad_cast_ctor(bad_cast
* _this
, const char ** name
)
238 TRACE("(%p %s)\n",_this
,*name
);
239 MSVCRT_exception_ctor(&_this
->base
, name
);
240 _this
->base
.vtable
= bad_cast_vtable
;
243 /******************************************************************
244 * bad_cast_copy_ctor (MSVCRT.@)
246 void __cdecl
MSVCRT_bad_cast_copy_ctor(bad_cast
* _this
, const bad_cast
* rhs
)
248 TRACE("(%p %p)\n",_this
,rhs
);
249 MSVCRT_exception_copy_ctor(&_this
->base
,&rhs
->base
);
252 /******************************************************************
253 * bad_cast_dtor (MSVCRT.@)
255 void __cdecl
MSVCRT_bad_cast_dtor(bad_cast
* _this
)
257 TRACE("(%p)\n",_this
);
258 MSVCRT_exception_dtor(&_this
->base
);
261 /******************************************************************
262 * bad_cast_opequals (MSVCRT.@)
264 bad_cast
* __cdecl
MSVCRT_bad_cast_opequals(bad_cast
* _this
, const bad_cast
* rhs
)
266 TRACE("(%p %p)\n",_this
,rhs
);
267 MSVCRT_exception_copy_ctor(&_this
->base
,&rhs
->base
);
271 /******************************************************************
272 * type_info_opequals_equals (MSVCRT.@)
274 int __stdcall
MSVCRT_type_info_opequals_equals(type_info
* _this
, const type_info
* rhs
)
276 TRACE("(%p %p) returning %d\n",_this
,rhs
,_this
->name
== rhs
->name
);
277 return _this
->name
== rhs
->name
;
280 /******************************************************************
281 * type_info_opnot_equals (MSVCRT.@)
283 int __stdcall
MSVCRT_type_info_opnot_equals(type_info
* _this
, const type_info
* rhs
)
285 TRACE("(%p %p) returning %d\n",_this
,rhs
,_this
->name
== rhs
->name
);
286 return _this
->name
!= rhs
->name
;
289 /******************************************************************
290 * type_info_dtor (MSVCRT.@)
292 void __cdecl
MSVCRT_type_info_dtor(type_info
* _this
)
294 TRACE("(%p)\n",_this
);
296 MSVCRT_free(_this
->data
);
299 /******************************************************************
300 * type_info_name (MSVCRT.@)
302 const char * __stdcall
MSVCRT_type_info_name(type_info
* _this
)
304 TRACE("(%p) returning %s\n",_this
,_this
->name
);
308 /******************************************************************
309 * type_info_raw_name (MSVCRT.@)
311 const char * __stdcall
MSVCRT_type_info_raw_name(type_info
* _this
)
313 TRACE("(%p) returning %s\n",_this
,_this
->name
);
318 /* INTERNAL: Set up vtables
319 * FIXME:should be static, cope with versions?
321 void MSVCRT_init_vtables(void)
323 exception_vtable
[0] = MSVCRT_exception_dtor
;
324 exception_vtable
[1] = (void*)MSVCRT_exception_what
;
326 bad_typeid_vtable
[0] = MSVCRT_bad_typeid_dtor
;
327 bad_typeid_vtable
[1] = exception_vtable
[1];
328 bad_typeid_vtable
[2] = MSVCRT__purecall
; /* FIXME */
330 __non_rtti_object_vtable
[0] = MSVCRT___non_rtti_object_dtor
;
331 __non_rtti_object_vtable
[1] = bad_typeid_vtable
[1];
332 __non_rtti_object_vtable
[2] = bad_typeid_vtable
[2];
334 bad_cast_vtable
[0] = MSVCRT_bad_cast_dtor
;
335 bad_cast_vtable
[1] = exception_vtable
[1];
336 bad_cast_vtable
[2] = MSVCRT__purecall
; /* FIXME */
338 type_info_vtable
[0] = MSVCRT_type_info_dtor
;