Added msvcrt/eh.h.

Implemented unexpected, terminate and set_unexpected/terminate.
This commit is contained in:
Francois Gouget 2001-05-31 21:32:53 +00:00 committed by Alexandre Julliard
parent 9fcefdd89d
commit a08b165955
3 changed files with 78 additions and 4 deletions

View File

@ -5,6 +5,7 @@
*/
#include "msvcrt.h"
#include "msvcrt/eh.h"
#include "msvcrt/malloc.h"
@ -133,6 +134,48 @@ const char * __stdcall MSVCRT_exception_what(exception * _this)
}
static terminate_function func_terminate=NULL;
static unexpected_function func_unexpected=NULL;
/******************************************************************
* set_terminate (MSVCRT.@)
*/
terminate_function MSVCRT_set_terminate(terminate_function func)
{
terminate_function previous=func_terminate;
TRACE("(%p) returning %p\n",func,previous);
func_terminate=func;
return previous;
}
/******************************************************************
* set_unexpected (MSVCRT.@)
*/
unexpected_function MSVCRT_set_unexpected(unexpected_function func)
{
unexpected_function previous=func_unexpected;
TRACE("(%p) returning %p\n",func,previous);
func_unexpected=func;
return previous;
}
/******************************************************************
* terminate (MSVCRT.@)
*/
void MSVCRT_terminate()
{
(*func_terminate)();
}
/******************************************************************
* unexpected (MSVCRT.@)
*/
void MSVCRT_unexpected()
{
(*func_unexpected)();
}
/******************************************************************
* bad_typeid_copy_ctor (MSVCRT.@)
*/

View File

@ -52,10 +52,10 @@ debug_channels (msvcrt)
@ stdcall ?name@type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_name
@ stdcall ?raw_name@type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_raw_name
@ stub ?set_new_handler@@YAP6AXXZP6AXXZ@Z
@ stub ?set_terminate@@YAP6AXXZP6AXXZ@Z
@ stub ?set_unexpected@@YAP6AXXZP6AXXZ@Z
@ stub ?terminate@@YAXXZ #()
@ stub ?unexpected@@YAXXZ #()
@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_terminate
@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_unexpected
@ cdecl ?terminate@@YAXXZ() MSVCRT_terminate
@ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected
@ stdcall ?what@exception@@UBEPBDXZ(ptr) MSVCRT_exception_what
@ cdecl -noimport _CIacos() _CIacos
@ cdecl -noimport _CIasin() _CIasin

31
include/msvcrt/eh.h Normal file
View File

@ -0,0 +1,31 @@
/*
* C++ exception handling facility
*
* Copyright 2000 Francois Gouget.
*/
#ifndef __WINE_EH_H
#define __WINE_EH_H
#if !defined(__cplusplus) && !defined(__WINE__)
#error "eh.h is meant only for C++ applications"
#endif
#ifdef USE_MSVCRT_PREFIX
#define MSVCRT(x) MSVCRT_##x
#else
#define MSVCRT(x) x
#endif
typedef void (*terminate_handler)();
typedef void (*terminate_function)();
typedef void (*unexpected_handler)();
typedef void (*unexpected_function)();
terminate_function MSVCRT(set_terminate)(terminate_function func);
unexpected_function MSVCRT(set_unexpected)(unexpected_function func);
void MSVCRT(terminate)();
void MSVCRT(unexpected)();
#endif /* __WINE_EH_H */