1/* 2 * Copyright (c) 1999 3 * Silicon Graphics 4 * 5 * Permission to use, copy, modify, distribute and sell this software 6 * and its documentation for any purpose is hereby granted without fee, 7 * provided that the above copyright notice appear in all copies and 8 * that both that copyright notice and this permission notice appear 9 * in supporting documentation. Silicon Graphics makes no 10 * representations about the suitability of this software for any 11 * purpose. It is provided "as is" without express or implied warranty. 12 * 13 */ 14 15#if defined(_STLP_THROW_RANGE_ERRORS) 16# if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_DONT_REDEFINE_STD) 17// In this mode we are going to throw native exception so that catch of 18// exception like std::runtime_error for instance will also catch exception 19// thrown by STLport containers like stlport::vector or stlport::string. 20# include <stdexcept> 21# include <string> 22# define _STLP_THROW_MSG(ex,msg) throw std::ex(msg) 23# else 24# if defined (__BUILDING_STLPORT) 25# include <stdexcept> 26# include <string> 27# else 28# ifndef _STLP_INTERNAL_STDEXCEPT 29# include <stl/_stdexcept.h> 30# endif 31# ifndef _STLP_INTERNAL_STRING_H 32# include <stl/_string.h> 33# endif 34# endif 35# define _STLP_THROW_MSG(ex,msg) throw ex(msg) 36# endif 37#else 38# if defined (__BUILDING_STLPORT) 39# include <cstdlib> 40# include <cstdio> 41# else 42# ifndef _STLP_INTERNAL_CSTDLIB 43# include <stl/_cstdlib.h> 44# endif 45# ifndef _STLP_INTERNAL_CSTDIO 46# include <stl/_cstdio.h> 47# endif 48# endif 49# define _STLP_THROW_MSG(ex,msg) puts(msg),_STLP_ABORT() 50#endif 51 52// For mode without library and throwing range errors, include the 53// stdexcept header and throw the appropriate exceptions directly. 54 55#if defined (_STLP_EXTERN_RANGE_ERRORS) 56# define _STLP_THROW_FUNCT_SPEC void _STLP_DECLSPEC 57#else 58# define _STLP_THROW_FUNCT_SPEC inline void 59#endif 60 61_STLP_BEGIN_NAMESPACE 62 63_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_runtime_error(const char* __msg) 64{ _STLP_THROW_MSG(runtime_error, __msg); } 65 66_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_range_error(const char* __msg) 67{ _STLP_THROW_MSG(range_error, __msg); } 68 69_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char* __msg) 70{ _STLP_THROW_MSG(out_of_range, __msg); } 71 72_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char* __msg) 73{ _STLP_THROW_MSG(length_error, __msg); } 74 75_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_invalid_argument(const char* __msg) 76{ _STLP_THROW_MSG(invalid_argument, __msg); } 77 78_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_overflow_error(const char* __msg) 79{ _STLP_THROW_MSG(overflow_error, __msg); } 80 81_STLP_END_NAMESPACE 82 83#undef _STLP_THROW_FUNCT_SPEC 84#undef _STLP_THROW_MSG 85