williamr@2: /* williamr@2: * Copyright (c) 1999 williamr@2: * Silicon Graphics williamr@2: * williamr@2: * Permission to use, copy, modify, distribute and sell this software williamr@2: * and its documentation for any purpose is hereby granted without fee, williamr@2: * provided that the above copyright notice appear in all copies and williamr@2: * that both that copyright notice and this permission notice appear williamr@2: * in supporting documentation. Silicon Graphics makes no williamr@2: * representations about the suitability of this software for any williamr@2: * purpose. It is provided "as is" without express or implied warranty. williamr@2: * williamr@2: */ williamr@2: williamr@2: #ifndef _STLP_RANGE_ERRORS_H williamr@2: #define _STLP_RANGE_ERRORS_H williamr@2: williamr@2: // A few places in the STL throw range errors, using standard exception williamr@2: // classes defined in . This header file provides functions williamr@2: // to throw those exception objects. williamr@2: williamr@2: // _STLP_DONT_THROW_RANGE_ERRORS is a hook so that users can disable williamr@2: // this exception throwing. williamr@4: #if defined (_STLP_CAN_THROW_RANGE_ERRORS) && defined (_STLP_USE_EXCEPTIONS) && \ williamr@4: !defined (_STLP_DONT_THROW_RANGE_ERRORS) williamr@4: # define _STLP_THROW_RANGE_ERRORS williamr@2: #endif williamr@2: williamr@2: // For the STLport iostreams, only declaration here, definition is in the lib williamr@4: #if !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_EXTERN_RANGE_ERRORS) williamr@2: # define _STLP_EXTERN_RANGE_ERRORS williamr@2: #endif williamr@2: williamr@4: _STLP_BEGIN_NAMESPACE williamr@4: void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg); williamr@4: void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg); williamr@4: void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg); williamr@4: void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg); williamr@4: void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg); williamr@4: void _STLP_FUNCTION_THROWS _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg); williamr@4: _STLP_END_NAMESPACE williamr@4: williamr@4: #if !defined (_STLP_EXTERN_RANGE_ERRORS) williamr@4: williamr@4: # if defined(_STLP_THROW_RANGE_ERRORS) williamr@4: # ifndef _STLP_INTERNAL_STDEXCEPT williamr@4: # include williamr@4: # endif williamr@4: # ifndef _STLP_STRING williamr@4: # include williamr@4: # endif williamr@4: # define _STLP_THROW_MSG(ex,msg) throw ex(string(msg)) williamr@4: # else williamr@4: # if defined (_STLP_RTTI_BUG) williamr@4: # define _STLP_THROW_MSG(ex,msg) TerminateProcess(GetCurrentProcess(), 0) williamr@4: # else williamr@4: # ifndef _STLP_INTERNAL_CSTDLIB williamr@4: # include williamr@4: # endif williamr@4: # ifndef _STLP_INTERNAL_CSTDIO williamr@4: # include williamr@4: # endif williamr@4: # define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT() williamr@4: # endif williamr@4: # endif williamr@4: williamr@4: // For mode without library and throwing range errors, include the williamr@2: // stdexcept header and throw the appropriate exceptions directly. williamr@2: williamr@2: _STLP_BEGIN_NAMESPACE williamr@2: williamr@4: inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg) williamr@4: { _STLP_THROW_MSG(runtime_error, __msg); } williamr@2: williamr@4: inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_range_error(const char* __msg) williamr@4: { _STLP_THROW_MSG(range_error, __msg); } williamr@2: williamr@4: inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) williamr@4: { _STLP_THROW_MSG(out_of_range, __msg); } williamr@2: williamr@4: inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_length_error(const char* __msg) williamr@4: { _STLP_THROW_MSG(length_error, __msg); } williamr@4: williamr@4: inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) williamr@4: { _STLP_THROW_MSG(invalid_argument, __msg); } williamr@4: williamr@4: inline void _STLP_DECLSPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) williamr@4: { _STLP_THROW_MSG(overflow_error, __msg); } williamr@4: williamr@2: _STLP_END_NAMESPACE williamr@2: williamr@4: # undef _STLP_THROW_MSG williamr@2: williamr@4: #endif /* EXTERN_RANGE_ERRORS */ williamr@2: williamr@2: #endif /* _STLP_RANGE_ERRORS_H */ williamr@2: williamr@2: // Local Variables: williamr@2: // mode:C++ williamr@2: // End: