// exception standard header
#ifndef _EXCEPTION_
#define _EXCEPTION_

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(level, E)
#endif
#pragma info(restore)

#if __IBMCPP__ < 400
#error This file to be used only with IBM VisualAge C++ v4 and later compilers.
#endif /* __IBMCPP__ */

#pragma namemangling(ansi)

   /********************************************************************/
   /*  <exception> header file                                         */
   /*                                                                  */
   /*  VisualAge C++, Version 4.0                                      */
   /*    Licensed Material - Property of IBM                           */
   /*                                                                  */
   /*  5801-AAR and Other Materials                                    */
   /*                                                                  */
   /*  (c) Copyright IBM Corp 1991, 1998. All rights reserved.         */
   /*                                                                  */
   /*                                                                  */
   /*  Licensed Materials.                                             */
   /*                                                                  */
   /*  Dinkum C++ Library                                              */
   /*  Copyright (c) 1998.  Licensed to IBM Corp. and its suppliers.   */
   /*                                                                  */
   /********************************************************************/

#include <xstddef>
_STD_BEGIN
                // CLASS exception
class exception;
typedef void (*_Prhand)(const exception&);
extern _Prhand _CXX_IMPORT _Raise_handler;
void _Throw(const exception&);
class exception {
public:
        static _Prhand _Set_raise_handler(_Prhand _Pn)
                {const _Prhand _Po = _Raise_handler;
                _Raise_handler = _Pn;
                return _Po; }
        explicit exception(const char *_S = "unknown") 
                _THROW0()
                : _Ptr(_S) {}
        exception(const exception& _R) _THROW0()
                : _Ptr(_R._Ptr) {}
        exception& operator=(const exception& _R) _THROW0()
                {_Ptr = _R._Ptr;
                return *this; }
        virtual ~exception()
                {}
        virtual const char *what() const _THROW0()
                {return _Ptr; }
        void _Raise() const
                {if (_Raise_handler != 0)
                        (*_Raise_handler)(*this);
                _Doraise();
                _RAISE(*this); }
protected:
        virtual void _Doraise() const
                {}
        const char *_Ptr;
        };
                // CLASS bad_exception
class bad_exception : public exception {
public:
        bad_exception(const char *_S = "bad exception") 
                _THROW0()
                : exception(_S) {}
        virtual ~bad_exception() _THROW0()
                {}
protected:
        virtual void _Doraise() const
                {_RAISE(*this); }
        };
                // TYPES
typedef void (*terminate_handler)();
typedef void (*unexpected_handler)();
                // FUNCTION DECLARATIONS
terminate_handler set_terminate(terminate_handler)
        _THROW0();
unexpected_handler set_unexpected(unexpected_handler)
        _THROW0();
#ifdef __IBMCPP__  
#ifdef __MULTI__
terminate_handler _set_mt_terminate(terminate_handler)
        _THROW0();
unexpected_handler _set_mt_unexpected(unexpected_handler)
        _THROW0();
#endif
#endif
void terminate();
void unexpected();
bool uncaught_exception();
_STD_END

#pragma namemangling()

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(pop)
#endif
#pragma info(restore)

#endif /* _EXCEPTION_ */

/*
 * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
 * Consult your license regarding permissions and restrictions.
 */
