Mercurial > ecos
changeset 2910:9e1cb7863bef
* src/bktrace.cpp: prevent inclusion of host header <execinfo.h> (eCos builds
for Linux synthetic target).
* src/uexception.cpp:exception::read(): initialise local variable stmSize.
| author | jld |
|---|---|
| date | Mon, 24 Aug 2009 06:46:33 +0000 |
| parents | 3e777a018dc7 |
| children | 7a3b9a2f019b |
| files | packages/language/cxx/ustl/current/ChangeLog packages/language/cxx/ustl/current/README packages/language/cxx/ustl/current/cdl/ustl.cdl packages/language/cxx/ustl/current/include/config.h packages/language/cxx/ustl/current/include/ustlecos.h packages/language/cxx/ustl/current/src/bktrace.cpp packages/language/cxx/ustl/current/src/uexception.cpp packages/language/cxx/ustl/current/src/ustlecos.cpp |
| diffstat | 8 files changed, 866 insertions(+), 859 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/language/cxx/ustl/current/ChangeLog +++ b/packages/language/cxx/ustl/current/ChangeLog @@ -1,27 +1,34 @@ -2009-08-20 Uwe Kindler <uwe_kindler@web.de> - - * Initial contribution of uSTL library - -//=========================================================================== -// ####GPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 or (at your option) any -// later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., 51 Franklin Street, -// Fifth Floor, Boston, MA 02110-1301, USA. -// ------------------------------------------- -// ####GPLCOPYRIGHTEND#### -//=========================================================================== +2009-08-21 Sergei Gavrikov <sergei.gavrikov@gmail.com> + + * src/bktrace.cpp: prevent inclusion of host header <execinfo.h> + (eCos builds for Linux synthetic target). + * src/uexception.cpp:exception::read(): initialise local + variable stmSize. + +2009-08-20 Uwe Kindler <uwe_kindler@web.de> + + * Initial contribution of uSTL library + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 or (at your option) any +// later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//===========================================================================
--- a/packages/language/cxx/ustl/current/README +++ b/packages/language/cxx/ustl/current/README @@ -1,51 +1,51 @@ -Welcome to uSTL Library 1.3 -=========================== - -The eCos uSTL library is a port of Mike Sharov's uSTL implementation. -It has the particular feature of generating small object code sizes -- an important requirement for embedded eCos based applications. -The latest version can be found at: - - http://ustl.sourceforge.net/ - http://sourceforge.net/projects/ustl/ - -The library provides a subset of the full C++ STL standard library. -uSTL is a partial implementation of the STL specification intended to -reduce code size of the derivative programs. This allows the -eCos application to use well known standard C++ STL library -containers, streams, iterators, algorithms and functors. - -For changes, see the HISTORY file. - - -eCos port specific changes/enhancements ---------------------------------------- - -By default eCos is build without exceptions and without RTTI support -(compiler switches -fno-exceptions -fno-rtti). Normally the uSTL -library relies on C++ exceptions to propagate errors and exceptions. -To build the library for eCos all occurrences of try, cath and throw -are replaced by macros USLT_TRY, USLT_CATCH_ALL, and USLT_THROW. Thus -the eCos uSTL port compiles without exceptions and without RTTI support. - -The macro USLT_THROW calls an eCos specific exception handling function -that prints exception information to the diagnostic channel. - -All features of the uSTL library are available except for memory mapped -files or memory mapped streams. - -If you use cout for printing to the console you should know that the -data is only sent if you finish all output with endl and then call -cout.flush(). - -example: - -cout << "Console output" << endl; -cout.flush(); - - -Legal Stuff ------------ - -The uSTL library is subject of copyright under MIT license. For -the license text see LICENSE file. +Welcome to uSTL Library 1.3 +=========================== + +The eCos uSTL library is a port of Mike Sharov's uSTL implementation. +It has the particular feature of generating small object code sizes +- an important requirement for embedded eCos based applications. +The latest version can be found at: + + http://ustl.sourceforge.net/ + http://sourceforge.net/projects/ustl/ + +The library provides a subset of the full C++ STL standard library. +uSTL is a partial implementation of the STL specification intended to +reduce code size of the derivative programs. This allows the +eCos application to use well known standard C++ STL library +containers, streams, iterators, algorithms and functors. + +For changes, see the HISTORY file. + + +eCos port specific changes/enhancements +--------------------------------------- + +By default eCos is build without exceptions and without RTTI support +(compiler switches -fno-exceptions -fno-rtti). Normally the uSTL +library relies on C++ exceptions to propagate errors and exceptions. +To build the library for eCos all occurrences of try, cath and throw +are replaced by macros USLT_TRY, USLT_CATCH_ALL, and USLT_THROW. Thus +the eCos uSTL port compiles without exceptions and without RTTI support. + +The macro USLT_THROW calls an eCos specific exception handling function +that prints exception information to the diagnostic channel. + +All features of the uSTL library are available except for memory mapped +files or memory mapped streams. + +If you use cout for printing to the console you should know that the +data is only sent if you finish all output with endl and then call +cout.flush(). + +example: + +cout << "Console output" << endl; +cout.flush(); + + +Legal Stuff +----------- + +The uSTL library is subject of copyright under MIT license. For +the license text see LICENSE file.
--- a/packages/language/cxx/ustl/current/cdl/ustl.cdl +++ b/packages/language/cxx/ustl/current/cdl/ustl.cdl @@ -1,197 +1,197 @@ -# ==================================================================== -# -# ustl.cdl -# -# uSTL - "Size-optimized STL" library package configuration data -# -# ==================================================================== -## ####ECOSGPLCOPYRIGHTBEGIN#### -## ------------------------------------------- -## This file is part of eCos, the Embedded Configurable Operating System. -## Copyright (C) 2009 Free Software Foundation, Inc. -## -## eCos is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free -## Software Foundation; either version 2 or (at your option) any later -## version. -## -## eCos is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -## for more details. -## -## You should have received a copy of the GNU General Public License -## along with eCos; if not, write to the Free Software Foundation, Inc., -## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -## -## As a special exception, if other files instantiate templates or use -## macros or inline functions from this file, or you compile this file -## and link it with other works to produce a work based on this file, -## this file does not by itself cause the resulting work to be covered by -## the GNU General Public License. However the source code for this file -## must still be made available in accordance with section (3) of the GNU -## General Public License v2. -## -## This exception does not invalidate any other reasons why a work based -## on this file might be covered by the GNU General Public License. -## ------------------------------------------- -## ####ECOSGPLCOPYRIGHTEND#### -# ==================================================================== -######DESCRIPTIONBEGIN#### -# -# Author(s): Uwe Kindler -# Contributors: -# Date: 2009-07-28 -# -#####DESCRIPTIONEND#### -# -# ==================================================================== - - -cdl_package CYGPKG_USTL { - display "uSTL library" - description " - This package provides the uSTL library. uSTL is a - partial implementation of the STL specification intended to - reduce code size of the derivative programs. This allows the - user application to use well known standard C++ STL library - containers, streams, iterators, algorithms and functors." - requires CYGPKG_IO - requires CYGPKG_ERROR - requires CYGPKG_ISOINFRA - requires CYGPKG_LIBM - - # malloc - requires CYGINT_ISO_MALLOC - - # stdio - requires CYGINT_ISO_STDIO_FORMATTED_IO - requires CYGINT_ISO_STDIO_CHAR_IO - requires CYGINT_ISO_STDIO_DIRECT_IO - requires CYGINT_ISO_STDIO_ERROR - - # signals - requires CYGINT_ISO_SIGNAL_NUMBERS - requires CYGINT_ISO_SIGNAL_IMPL - - # time - requires CYGINT_ISO_C_TIME_TYPES - - # startup - requires CYGINT_ISO_EXIT - requires CYGINT_ISO_MAIN_STARTUP - requires CYGINT_ISO_ENVIRON - - #string - requires CYGINT_ISO_STRTOK_R - requires CYGINT_ISO_STRING_LOCALE_FUNCS - requires CYGINT_ISO_STRING_MEMFUNCS - requires CYGINT_ISO_STRING_STRFUNCS - - # common - requires CYGINT_ISO_CTYPE - requires CYGINT_ISO_ERRNO_CODES - requires CYGINT_ISO_ERRNO - requires CYGINT_ISO_LOCALE - requires CYGIMP_LIBC_STDIO_C99_SNPRINTF - - compile bktrace.cpp \ - cmemlink.cpp \ - memblock.cpp \ - memlink.cpp \ - ualgobase.cpp \ - ubitset.cpp \ - uexception.cpp \ - unew.cpp \ - ustdxept.cpp \ - ustring.cpp \ - ustlecos.cpp \ - mistream.cpp \ - sistream.cpp \ - sostream.cpp - - cdl_component CYGCLS_USTL_FSTREAMS { - display "File streams support" - flavor bool - default_value CYGPKG_IO_FILEIO - description " - This option enables file stream support. For file stream - support the File I/O package is required." - requires CYGPKG_IO_FILEIO - requires CYGINT_ISO_STDIO_FILETYPES - requires CYGINT_ISO_STDIO_FILEACCESS - requires CYGINT_ISO_STDIO_FILEPOS - requires CYGINT_ISO_STDIO_STREAMS - compile fstream.cpp \ - ofstream.cpp - - cdl_option CYGVAR_USTL_CIN_COUT_CERR { - display "cin, cout & cerr support" - flavor bool - default_value 1 - description " - Enable this option if you want the standard streams - cin, cout and cerr to be included. You will not be able - to run bvt tests if you don't enable this option." - } - } - - cdl_option CYGSEM_USTL_STREAM_BOUNDS_CHECK { - display "Stream bounds checking" - flavor bool - default_value 0 - description " - Enable this option if you want stream operations to throw - exceptions on insufficient data or insufficient space. - All these errors should be preventable in output code; - the input code should verify the data in a separate step. - It slows down stream operations a lot, but it's your call. - Debug builds always throws exceptions - this option is - only valid for release builds." - } - - cdl_component CYGPKG_USTL_OPTIONS { - display "uSTL library build options" - flavor none - no_define - description " - Package specific build options including control over - compiler flags used only in building this package, - and details of which tests are built." - - - cdl_option CYGPKG_USTL_CFLAGS_ADD { - display "Additional compiler flags" - flavor data - no_define - default_value { "" } - description " - This option modifies the set of compiler flags for - building the uSTL library. These flags are used in addition - to the set of global flags." - } - - cdl_option CYGPKG_USTL_CFLAGS_REMOVE { - display "Suppressed compiler flags" - flavor data - no_define - default_value { "-Wundef" } - description " - This option modifies the set of compiler flags for - building the uSTL library. These flags are removed from - the set of global flags if present." - } - - cdl_option CYGPKG_USTL_TESTS { - display "uSTL tests" - flavor data - no_define - calculated { (CYGVAR_USTL_CIN_COUT_CERR ? "tests/bvt00 tests/bvt01 tests/bvt02 tests/bvt03 tests/bvt04 tests/bvt05 tests/bvt06 tests/bvt07 tests/bvt08 tests/bvt09 tests/bvt10 tests/bvt11 tests/bvt12 tests/bvt13 tests/bvt14 tests/bvt15 tests/bvt16 tests/bvt17 tests/bvt18 tests/bvt19 tests/bvt20 tests/bvt21 tests/bvt22 tests/bvt23 tests/bvt24 tests/bvt25 tests/bvt26 tests/bvt27" : "" )} - description " - This option specifies the set of tests for the uSTL library." - } - } -} - -# ==================================================================== -# EOF ustl.cdl +# ==================================================================== +# +# ustl.cdl +# +# uSTL - "Size-optimized STL" library package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 2009 Free Software Foundation, Inc. +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later +## version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License +## along with eCos; if not, write to the Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## As a special exception, if other files instantiate templates or use +## macros or inline functions from this file, or you compile this file +## and link it with other works to produce a work based on this file, +## this file does not by itself cause the resulting work to be covered by +## the GNU General Public License. However the source code for this file +## must still be made available in accordance with section (3) of the GNU +## General Public License v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Uwe Kindler +# Contributors: +# Date: 2009-07-28 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + + +cdl_package CYGPKG_USTL { + display "uSTL library" + description " + This package provides the uSTL library. uSTL is a + partial implementation of the STL specification intended to + reduce code size of the derivative programs. This allows the + user application to use well known standard C++ STL library + containers, streams, iterators, algorithms and functors." + requires CYGPKG_IO + requires CYGPKG_ERROR + requires CYGPKG_ISOINFRA + requires CYGPKG_LIBM + + # malloc + requires CYGINT_ISO_MALLOC + + # stdio + requires CYGINT_ISO_STDIO_FORMATTED_IO + requires CYGINT_ISO_STDIO_CHAR_IO + requires CYGINT_ISO_STDIO_DIRECT_IO + requires CYGINT_ISO_STDIO_ERROR + + # signals + requires CYGINT_ISO_SIGNAL_NUMBERS + requires CYGINT_ISO_SIGNAL_IMPL + + # time + requires CYGINT_ISO_C_TIME_TYPES + + # startup + requires CYGINT_ISO_EXIT + requires CYGINT_ISO_MAIN_STARTUP + requires CYGINT_ISO_ENVIRON + + #string + requires CYGINT_ISO_STRTOK_R + requires CYGINT_ISO_STRING_LOCALE_FUNCS + requires CYGINT_ISO_STRING_MEMFUNCS + requires CYGINT_ISO_STRING_STRFUNCS + + # common + requires CYGINT_ISO_CTYPE + requires CYGINT_ISO_ERRNO_CODES + requires CYGINT_ISO_ERRNO + requires CYGINT_ISO_LOCALE + requires CYGIMP_LIBC_STDIO_C99_SNPRINTF + + compile bktrace.cpp \ + cmemlink.cpp \ + memblock.cpp \ + memlink.cpp \ + ualgobase.cpp \ + ubitset.cpp \ + uexception.cpp \ + unew.cpp \ + ustdxept.cpp \ + ustring.cpp \ + ustlecos.cpp \ + mistream.cpp \ + sistream.cpp \ + sostream.cpp + + cdl_component CYGCLS_USTL_FSTREAMS { + display "File streams support" + flavor bool + default_value CYGPKG_IO_FILEIO + description " + This option enables file stream support. For file stream + support the File I/O package is required." + requires CYGPKG_IO_FILEIO + requires CYGINT_ISO_STDIO_FILETYPES + requires CYGINT_ISO_STDIO_FILEACCESS + requires CYGINT_ISO_STDIO_FILEPOS + requires CYGINT_ISO_STDIO_STREAMS + compile fstream.cpp \ + ofstream.cpp + + cdl_option CYGVAR_USTL_CIN_COUT_CERR { + display "cin, cout & cerr support" + flavor bool + default_value 1 + description " + Enable this option if you want the standard streams + cin, cout and cerr to be included. You will not be able + to run bvt tests if you don't enable this option." + } + } + + cdl_option CYGSEM_USTL_STREAM_BOUNDS_CHECK { + display "Stream bounds checking" + flavor bool + default_value 0 + description " + Enable this option if you want stream operations to throw + exceptions on insufficient data or insufficient space. + All these errors should be preventable in output code; + the input code should verify the data in a separate step. + It slows down stream operations a lot, but it's your call. + Debug builds always throws exceptions - this option is + only valid for release builds." + } + + cdl_component CYGPKG_USTL_OPTIONS { + display "uSTL library build options" + flavor none + no_define + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_USTL_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the uSTL library. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_USTL_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "-Wundef" } + description " + This option modifies the set of compiler flags for + building the uSTL library. These flags are removed from + the set of global flags if present." + } + + cdl_option CYGPKG_USTL_TESTS { + display "uSTL tests" + flavor data + no_define + calculated { (CYGVAR_USTL_CIN_COUT_CERR ? "tests/bvt00 tests/bvt01 tests/bvt02 tests/bvt03 tests/bvt04 tests/bvt05 tests/bvt06 tests/bvt07 tests/bvt08 tests/bvt09 tests/bvt10 tests/bvt11 tests/bvt12 tests/bvt13 tests/bvt14 tests/bvt15 tests/bvt16 tests/bvt17 tests/bvt18 tests/bvt19 tests/bvt20 tests/bvt21 tests/bvt22 tests/bvt23 tests/bvt24 tests/bvt25 tests/bvt26 tests/bvt27" : "" )} + description " + This option specifies the set of tests for the uSTL library." + } + } +} + +# ==================================================================== +# EOF ustl.cdl
--- a/packages/language/cxx/ustl/current/include/config.h +++ b/packages/language/cxx/ustl/current/include/config.h @@ -1,389 +1,389 @@ -#ifndef CYGONCE_CONFIG_H -#define CYGONCE_CONFIG_H -// ========================================================================== -// -// config.h -// -// Manually constructed uSTL configuration file for eCos RTOS -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Uwe Kindler -// Contributors: -// Date: 2009-07-28 -// Purpose: eCos specific uSTL configuration -// Description: -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ -#include <stdint.h> -#include <pkgconf/ustl.h> // ustl package configuration - - -// -// If there is no RTTI support (normally this is the default eCos setting) -// C++ typeid keyword is not supported. We hide this by using a macro instead -// of using typeid keyword directly. -// -#ifdef __GXX_RTTI - #define USTL_TYPENAME(_t_) typeid(_t_).name() -#else - #define USTL_TYPENAME(_t_) "unknown type (RTTI disabled)" -#endif - -// -// If there is no exception support (normally this is the default eCos setting) -// C++ keywords try, catch and throw are not supported. To compile uSTL without -// exception support we use macros USLT_TRY, USLT_CATCH_ALL and USLT_THROW -// instead of the real keywords. To handle exceptions in debug builds we define -// a "lightwight" exception handler. This handler is simply a function that -// prints exception information do diagnostic channel. -// -#ifdef __EXCEPTIONS - #define USTL_TRY try - #define USTL_CATCH_ALL catch (...) {} - #define USTL_THROW(_exception_) throw (_exception_) -#else - namespace ustl - { - class exception; - extern void exception_handler(const exception& ex); - } - #define USTL_TRY - #define USTL_CATCH_ALL - #define USTL_THROW(_exception_) ustl::exception_handler(_exception_) -#endif - -// -// There is no eCos header that exports this function so we do it here -// -#ifdef CYGCLS_USTL_FSTREAMS -__externC int ioctl( int fd, CYG_ADDRWORD com, ... ); -#endif - - -/// Define to 1 if you want stream operations to throw exceptions on -/// insufficient data or insufficient space. All these errors should -/// be preventable in output code; the input code should verify the -/// data in a separate step. It slows down stream operations a lot, -/// but it's your call. By default only debug builds throw. -/// -#ifdef CYGSEM_USTL_STREAM_BOUNDS_CHECK -#define WANT_STREAM_BOUNDS_CHECKING 1 -#else -#undef WANT_STREAM_BOUNDS_CHECKING -#endif - -#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) - #define WANT_STREAM_BOUNDS_CHECKING 1 -#endif - -/// Define to 1 if you want backtrace symbols demangled. -/// This adds some 15k to the library size, and requires that you link it and -/// any executables you make with the -rdynamic flag (increasing library size -/// even more). By default this option is disable. Enabling this option also -/// pulls in __cxa_demangle from libsupc++ -#undef WANT_NAME_DEMANGLING - -/// Define to 1 if you want to build without libstdc++ -#define WITHOUT_LIBSTDCPP 1 - -/// Define GNU extensions if unavailable. -#ifndef __GNUC__ - /// GCC (and some other compilers) define '__attribute__'; ustl is using this - /// macro to alert the compiler to flag inconsistencies in printf/scanf-like - /// function calls. Just in case '__attribute__' is undefined, make a dummy. - /// - #ifndef __attribute__ - #define __attribute__(p) - #endif -#endif -#if defined(__GNUC__) && __GNUC__ >= 4 - #define INLINE __attribute__((always_inline)) -#else - #define INLINE -#endif -#define DLL_EXPORT -#define DLL_LOCAL -#if defined(__GNUC__) && __GNUC__ >= 3 && (__i386__ || __x86_64__) - /// GCC 3+ supports the prefetch directive, which some CPUs use to improve caching - #define prefetch(p,rw,loc) __builtin_prefetch(p,rw,loc) -#else - #define prefetch(p,rw,loc) -#endif -#if !defined(__GNUC__) || __GNUC__ < 3 - /// __alignof__ returns the recommended alignment for the type - #define __alignof__(v) min(sizeof(v), sizeof(void*)) - /// This macro returns 1 if the value of x is known at compile time. - #ifndef __builtin_constant_p - #define __builtin_constant_p(x) 0 - #endif -#endif - -// Define to 1 if you have the `atexit' function. -#define HAVE_ATEXIT 1 - -// Define to 1 if you have the <assert.h> header file. -#define HAVE_ASSERT_H 1 - -// Define to 1 if you have the <ctype.h> header file. -#define HAVE_CTYPE_H 1 - -// Define to 1 if you have the <errno.h> header file. -#define HAVE_ERRNO_H 1 - -// Define to 1 if you have the <fcntl.h> header file. -#define HAVE_FCNTL_H 1 - -// Define to 1 if you have the <float.h> header file. -#define HAVE_FLOAT_H 1 - -// Define to 1 if you have the <limits.h> header file. -#define HAVE_LIMITS_H 1 - -// Define to 1 if you have the <locale.h> header file. -#define HAVE_LOCALE_H 1 - -// Define to 1 if your system has a working `malloc' function. -#define HAVE_MALLOC 1 - -// Define to 1 if you have the `memchr' function. -#define HAVE_MEMCHR 1 - -// Define to 1 if you have the `memmove' function. -#define HAVE_MEMMOVE 1 - -// Define to 1 if you have the `memset' function. -#define HAVE_MEMSET 1 - -// Define to 1 if the system has the type `ptrdiff_t'. -#define HAVE_PTRDIFF_T 1 - -// Define to 1 if you have the <signal.h> header file. -#define HAVE_SIGNAL_H 1 - -// Define to 1 if you have the <stdarg.h> header file. -#define HAVE_STDARG_H 1 - -// Define to 1 if you have the <stddef.h> header file. -#define HAVE_STDDEF_H 1 - -// Define to 1 if you have the <stdint.h> header file. -#define HAVE_STDINT_H 1 - -// Define to 1 if you have the <stdio.h> header file. -#define HAVE_STDIO_H 1 - -// Define to 1 if you have the <stdlib.h> header file. -#define HAVE_STDLIB_H 1 - -// Define to 1 if you have the `strerror' function. -#define HAVE_STRERROR 1 - -// Define to 1 if you have the <string.h> header file. -#define HAVE_STRING_H 1 - -// Define to 1 if you have the `strrchr' function. -#define HAVE_STRRCHR 1 - -// Define to 1 if you have the `strtol' function. -#define HAVE_STRTOL 1 - -// Define to 1 if you have the <sys/stat.h> header file. -#define HAVE_SYS_STAT_H 1 - -// Define to 1 if you have the <sys/types.h> header file. -#define HAVE_SYS_TYPES_H 1 - -// Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. -#define HAVE_SYS_WAIT_H 1 - -// Define to 1 if you have the <time.h> header file. -#define HAVE_TIME_H 1 - -// Define to 1 if you have the <unistd.h> header file. -#define HAVE_UNISTD_H 1 - -// Define to 1 if you have the <math.h> header file. -#define HAVE_MATH_H 1 - -// Define to 1 if you have the long long type -#define HAVE_LONG_LONG 1 - -// Define to 1 if you have 64 bit types available -#define HAVE_INT64_T 1 - -// Define to 1 if your compiler treats char as a separate type along with -// signed char and unsigned char. This will create overloads for char. -#define HAVE_THREE_CHAR_TYPES 1 - -// Define to 1 if you have the <cxxabi.h> header file. -#if __GNUC__ >= 3 - #define HAVE_CXXABI_H 1 -#endif - -// Define to 1 if you have the rintf function. Will use rint otherwise. -#undef HAVE_RINTF - -// Define to 1 if you have the <strings.h> header file. -#undef HAVE_STRINGS_H - -// Define to 1 if you have the `strsignal' function. -#undef HAVE_STRSIGNAL - -// Define to 1 if you have the __va_copy function -#undef HAVE_VA_COPY - -// Define to 1 if you have the <inttypes.h> header file. -#undef HAVE_INTTYPES_H - -// Define to 1 if you have the <malloc.h> header file. -#undef HAVE_MALLOC_H - -// Define to 1 if you have the <memory.h> header file. -#undef HAVE_MEMORY_H - -// Define to 1 if you have the <alloca.h> header file. -#undef HAVE_ALLOCA_H - -// Define to 1 if `stat' has the bug that it succeeds when given the -// zero-length file name argument. -#undef HAVE_STAT_EMPTY_STRING_BUG - -// STDC_HEADERS is defined to 1 on sane systems. -#if defined(HAVE_ASSERT_H) && defined(HAVE_CTYPE_H) &&\ - defined(HAVE_ERRNO_H) && defined(HAVE_FLOAT_H) &&\ - defined(HAVE_LIMITS_H) && defined(HAVE_LOCALE_H) &&\ - defined(HAVE_MATH_H) && defined(HAVE_SIGNAL_H) &&\ - defined(HAVE_STDARG_H) && defined(HAVE_STDDEF_H) &&\ - defined(HAVE_STDIO_H) && defined(HAVE_STDLIB_H) &&\ - defined(HAVE_STRING_H) && defined(HAVE_TIME_H) -#define STDC_HEADERS 1 -#endif - -// STDC_HEADERS is defined to 1 on unix systems. -#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_STAT_H) && defined(HAVE_UNISTD_H) -#define STDUNIX_HEADERS 1 -#endif - -// Define to 1 if you have the <byteswap.h> header file. -#if (__GNUC__ >= 3) // gcc 2.95 somehow doesn't recognize 'asm volatile' in libc byteswap.h -#undef HAVE_BYTESWAP_H -#endif - -// Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -// Define as the return type of signal handlers (`int' or `void'). -#undef RETSIGTYPE - -// Define to 1 if you want unrolled specializations for fill and copy -#undef WANT_UNROLLED_COPY - -// Define to 1 if you want to use MMX/SSE/3dNow! processor instructions -#undef WANT_MMX - -// Define to byte sizes of types -#define SIZE_OF_CHAR 1 -#define SIZE_OF_SHORT 2 -#define SIZE_OF_INT 4 -#define SIZE_OF_LONG 4 -#define SIZE_OF_LONG_LONG 8 -#define SIZE_OF_POINTER 4 -#define SIZE_OF_SIZE_T 4 -#define SIZE_OF_BOOL 1 - - -// Byte order macros, converted in utypes.h -#define USTL_LITTLE_ENDIAN 4321 -#define USTL_BIG_ENDIAN 1234 -#if (CYG_BYTEORDER == CYG_LSBFIRST) -#define USTL_BYTE_ORDER USTL_BIG_ENDIAN -#else -#define USTL_BYTE_ORDER USTL_LITTLE_ENDIAN -#endif - -// Extended CPU capabilities -#undef CPU_HAS_FPU -#undef CPU_HAS_EXT_DEBUG -#undef CPU_HAS_TIMESTAMPC -#undef CPU_HAS_MSR -#undef CPU_HAS_CMPXCHG8 -#undef CPU_HAS_APIC -#undef CPU_HAS_SYSCALL -#undef CPU_HAS_MTRR -#undef CPU_HAS_CMOV -#undef CPU_HAS_FCMOV -#if defined WANT_MMX -#undef CPU_HAS_MMX -#undef CPU_HAS_FXSAVE -#undef CPU_HAS_SSE -#undef CPU_HAS_SSE2 -#undef CPU_HAS_SSE3 -#undef CPU_HAS_EXT_3DNOW -#undef CPU_HAS_3DNOW -#endif - -// GCC vector extensions -#if defined(CPU_HAS_MMX) || defined(CPU_HAS_SSE) - #undef HAVE_VECTOR_EXTENSIONS -#endif - -#if defined(CPU_HAS_SSE) && defined(__GNUC__) - #define __sse_align __attribute__((aligned(16))) -#else - #define __sse_align -#endif - - -// Define to empty if `const' does not conform to ANSI C. -//#undef const - -// Define as `__inline' if that's what the C compiler calls it, or to nothing -// if it is not supported. -//#undef inline - -// Define to `long' if <sys/types.h> does not define. -//#undef off_t - -// Define to `unsigned' if <sys/types.h> does not define. -//#undef size_t - -// --------------------------------------------------------------------------- -#endif // CYGONCE_CONFIG_H - +#ifndef CYGONCE_CONFIG_H +#define CYGONCE_CONFIG_H +// ========================================================================== +// +// config.h +// +// Manually constructed uSTL configuration file for eCos RTOS +// +// =========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later +// version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License +// along with eCos; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// As a special exception, if other files instantiate templates or use +// macros or inline functions from this file, or you compile this file +// and link it with other works to produce a work based on this file, +// this file does not by itself cause the resulting work to be covered by +// the GNU General Public License. However the source code for this file +// must still be made available in accordance with section (3) of the GNU +// General Public License v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +// =========================================================================== +// =========================================================================== +// #####DESCRIPTIONBEGIN#### +// +// Author(s): Uwe Kindler +// Contributors: +// Date: 2009-07-28 +// Purpose: eCos specific uSTL configuration +// Description: +// +// ####DESCRIPTIONEND#### +// +// ========================================================================*/ +#include <stdint.h> +#include <pkgconf/ustl.h> // ustl package configuration + + +// +// If there is no RTTI support (normally this is the default eCos setting) +// C++ typeid keyword is not supported. We hide this by using a macro instead +// of using typeid keyword directly. +// +#ifdef __GXX_RTTI + #define USTL_TYPENAME(_t_) typeid(_t_).name() +#else + #define USTL_TYPENAME(_t_) "unknown type (RTTI disabled)" +#endif + +// +// If there is no exception support (normally this is the default eCos setting) +// C++ keywords try, catch and throw are not supported. To compile uSTL without +// exception support we use macros USLT_TRY, USLT_CATCH_ALL and USLT_THROW +// instead of the real keywords. To handle exceptions in debug builds we define +// a "lightwight" exception handler. This handler is simply a function that +// prints exception information do diagnostic channel. +// +#ifdef __EXCEPTIONS + #define USTL_TRY try + #define USTL_CATCH_ALL catch (...) {} + #define USTL_THROW(_exception_) throw (_exception_) +#else + namespace ustl + { + class exception; + extern void exception_handler(const exception& ex); + } + #define USTL_TRY + #define USTL_CATCH_ALL + #define USTL_THROW(_exception_) ustl::exception_handler(_exception_) +#endif + +// +// There is no eCos header that exports this function so we do it here +// +#ifdef CYGCLS_USTL_FSTREAMS +__externC int ioctl( int fd, CYG_ADDRWORD com, ... ); +#endif + + +/// Define to 1 if you want stream operations to throw exceptions on +/// insufficient data or insufficient space. All these errors should +/// be preventable in output code; the input code should verify the +/// data in a separate step. It slows down stream operations a lot, +/// but it's your call. By default only debug builds throw. +/// +#ifdef CYGSEM_USTL_STREAM_BOUNDS_CHECK +#define WANT_STREAM_BOUNDS_CHECKING 1 +#else +#undef WANT_STREAM_BOUNDS_CHECKING +#endif + +#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) + #define WANT_STREAM_BOUNDS_CHECKING 1 +#endif + +/// Define to 1 if you want backtrace symbols demangled. +/// This adds some 15k to the library size, and requires that you link it and +/// any executables you make with the -rdynamic flag (increasing library size +/// even more). By default this option is disable. Enabling this option also +/// pulls in __cxa_demangle from libsupc++ +#undef WANT_NAME_DEMANGLING + +/// Define to 1 if you want to build without libstdc++ +#define WITHOUT_LIBSTDCPP 1 + +/// Define GNU extensions if unavailable. +#ifndef __GNUC__ + /// GCC (and some other compilers) define '__attribute__'; ustl is using this + /// macro to alert the compiler to flag inconsistencies in printf/scanf-like + /// function calls. Just in case '__attribute__' is undefined, make a dummy. + /// + #ifndef __attribute__ + #define __attribute__(p) + #endif +#endif +#if defined(__GNUC__) && __GNUC__ >= 4 + #define INLINE __attribute__((always_inline)) +#else + #define INLINE +#endif +#define DLL_EXPORT +#define DLL_LOCAL +#if defined(__GNUC__) && __GNUC__ >= 3 && (__i386__ || __x86_64__) + /// GCC 3+ supports the prefetch directive, which some CPUs use to improve caching + #define prefetch(p,rw,loc) __builtin_prefetch(p,rw,loc) +#else + #define prefetch(p,rw,loc) +#endif +#if !defined(__GNUC__) || __GNUC__ < 3 + /// __alignof__ returns the recommended alignment for the type + #define __alignof__(v) min(sizeof(v), sizeof(void*)) + /// This macro returns 1 if the value of x is known at compile time. + #ifndef __builtin_constant_p + #define __builtin_constant_p(x) 0 + #endif +#endif + +// Define to 1 if you have the `atexit' function. +#define HAVE_ATEXIT 1 + +// Define to 1 if you have the <assert.h> header file. +#define HAVE_ASSERT_H 1 + +// Define to 1 if you have the <ctype.h> header file. +#define HAVE_CTYPE_H 1 + +// Define to 1 if you have the <errno.h> header file. +#define HAVE_ERRNO_H 1 + +// Define to 1 if you have the <fcntl.h> header file. +#define HAVE_FCNTL_H 1 + +// Define to 1 if you have the <float.h> header file. +#define HAVE_FLOAT_H 1 + +// Define to 1 if you have the <limits.h> header file. +#define HAVE_LIMITS_H 1 + +// Define to 1 if you have the <locale.h> header file. +#define HAVE_LOCALE_H 1 + +// Define to 1 if your system has a working `malloc' function. +#define HAVE_MALLOC 1 + +// Define to 1 if you have the `memchr' function. +#define HAVE_MEMCHR 1 + +// Define to 1 if you have the `memmove' function. +#define HAVE_MEMMOVE 1 + +// Define to 1 if you have the `memset' function. +#define HAVE_MEMSET 1 + +// Define to 1 if the system has the type `ptrdiff_t'. +#define HAVE_PTRDIFF_T 1 + +// Define to 1 if you have the <signal.h> header file. +#define HAVE_SIGNAL_H 1 + +// Define to 1 if you have the <stdarg.h> header file. +#define HAVE_STDARG_H 1 + +// Define to 1 if you have the <stddef.h> header file. +#define HAVE_STDDEF_H 1 + +// Define to 1 if you have the <stdint.h> header file. +#define HAVE_STDINT_H 1 + +// Define to 1 if you have the <stdio.h> header file. +#define HAVE_STDIO_H 1 + +// Define to 1 if you have the <stdlib.h> header file. +#define HAVE_STDLIB_H 1 + +// Define to 1 if you have the `strerror' function. +#define HAVE_STRERROR 1 + +// Define to 1 if you have the <string.h> header file. +#define HAVE_STRING_H 1 + +// Define to 1 if you have the `strrchr' function. +#define HAVE_STRRCHR 1 + +// Define to 1 if you have the `strtol' function. +#define HAVE_STRTOL 1 + +// Define to 1 if you have the <sys/stat.h> header file. +#define HAVE_SYS_STAT_H 1 + +// Define to 1 if you have the <sys/types.h> header file. +#define HAVE_SYS_TYPES_H 1 + +// Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. +#define HAVE_SYS_WAIT_H 1 + +// Define to 1 if you have the <time.h> header file. +#define HAVE_TIME_H 1 + +// Define to 1 if you have the <unistd.h> header file. +#define HAVE_UNISTD_H 1 + +// Define to 1 if you have the <math.h> header file. +#define HAVE_MATH_H 1 + +// Define to 1 if you have the long long type +#define HAVE_LONG_LONG 1 + +// Define to 1 if you have 64 bit types available +#define HAVE_INT64_T 1 + +// Define to 1 if your compiler treats char as a separate type along with +// signed char and unsigned char. This will create overloads for char. +#define HAVE_THREE_CHAR_TYPES 1 + +// Define to 1 if you have the <cxxabi.h> header file. +#if __GNUC__ >= 3 + #define HAVE_CXXABI_H 1 +#endif + +// Define to 1 if you have the rintf function. Will use rint otherwise. +#undef HAVE_RINTF + +// Define to 1 if you have the <strings.h> header file. +#undef HAVE_STRINGS_H + +// Define to 1 if you have the `strsignal' function. +#undef HAVE_STRSIGNAL + +// Define to 1 if you have the __va_copy function +#undef HAVE_VA_COPY + +// Define to 1 if you have the <inttypes.h> header file. +#undef HAVE_INTTYPES_H + +// Define to 1 if you have the <malloc.h> header file. +#undef HAVE_MALLOC_H + +// Define to 1 if you have the <memory.h> header file. +#undef HAVE_MEMORY_H + +// Define to 1 if you have the <alloca.h> header file. +#undef HAVE_ALLOCA_H + +// Define to 1 if `stat' has the bug that it succeeds when given the +// zero-length file name argument. +#undef HAVE_STAT_EMPTY_STRING_BUG + +// STDC_HEADERS is defined to 1 on sane systems. +#if defined(HAVE_ASSERT_H) && defined(HAVE_CTYPE_H) &&\ + defined(HAVE_ERRNO_H) && defined(HAVE_FLOAT_H) &&\ + defined(HAVE_LIMITS_H) && defined(HAVE_LOCALE_H) &&\ + defined(HAVE_MATH_H) && defined(HAVE_SIGNAL_H) &&\ + defined(HAVE_STDARG_H) && defined(HAVE_STDDEF_H) &&\ + defined(HAVE_STDIO_H) && defined(HAVE_STDLIB_H) &&\ + defined(HAVE_STRING_H) && defined(HAVE_TIME_H) +#define STDC_HEADERS 1 +#endif + +// STDC_HEADERS is defined to 1 on unix systems. +#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_STAT_H) && defined(HAVE_UNISTD_H) +#define STDUNIX_HEADERS 1 +#endif + +// Define to 1 if you have the <byteswap.h> header file. +#if (__GNUC__ >= 3) // gcc 2.95 somehow doesn't recognize 'asm volatile' in libc byteswap.h +#undef HAVE_BYTESWAP_H +#endif + +// Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +// Define as the return type of signal handlers (`int' or `void'). +#undef RETSIGTYPE + +// Define to 1 if you want unrolled specializations for fill and copy +#undef WANT_UNROLLED_COPY + +// Define to 1 if you want to use MMX/SSE/3dNow! processor instructions +#undef WANT_MMX + +// Define to byte sizes of types +#define SIZE_OF_CHAR 1 +#define SIZE_OF_SHORT 2 +#define SIZE_OF_INT 4 +#define SIZE_OF_LONG 4 +#define SIZE_OF_LONG_LONG 8 +#define SIZE_OF_POINTER 4 +#define SIZE_OF_SIZE_T 4 +#define SIZE_OF_BOOL 1 + + +// Byte order macros, converted in utypes.h +#define USTL_LITTLE_ENDIAN 4321 +#define USTL_BIG_ENDIAN 1234 +#if (CYG_BYTEORDER == CYG_LSBFIRST) +#define USTL_BYTE_ORDER USTL_BIG_ENDIAN +#else +#define USTL_BYTE_ORDER USTL_LITTLE_ENDIAN +#endif + +// Extended CPU capabilities +#undef CPU_HAS_FPU +#undef CPU_HAS_EXT_DEBUG +#undef CPU_HAS_TIMESTAMPC +#undef CPU_HAS_MSR +#undef CPU_HAS_CMPXCHG8 +#undef CPU_HAS_APIC +#undef CPU_HAS_SYSCALL +#undef CPU_HAS_MTRR +#undef CPU_HAS_CMOV +#undef CPU_HAS_FCMOV +#if defined WANT_MMX +#undef CPU_HAS_MMX +#undef CPU_HAS_FXSAVE +#undef CPU_HAS_SSE +#undef CPU_HAS_SSE2 +#undef CPU_HAS_SSE3 +#undef CPU_HAS_EXT_3DNOW +#undef CPU_HAS_3DNOW +#endif + +// GCC vector extensions +#if defined(CPU_HAS_MMX) || defined(CPU_HAS_SSE) + #undef HAVE_VECTOR_EXTENSIONS +#endif + +#if defined(CPU_HAS_SSE) && defined(__GNUC__) + #define __sse_align __attribute__((aligned(16))) +#else + #define __sse_align +#endif + + +// Define to empty if `const' does not conform to ANSI C. +//#undef const + +// Define as `__inline' if that's what the C compiler calls it, or to nothing +// if it is not supported. +//#undef inline + +// Define to `long' if <sys/types.h> does not define. +//#undef off_t + +// Define to `unsigned' if <sys/types.h> does not define. +//#undef size_t + +// --------------------------------------------------------------------------- +#endif // CYGONCE_CONFIG_H +
--- a/packages/language/cxx/ustl/current/include/ustlecos.h +++ b/packages/language/cxx/ustl/current/include/ustlecos.h @@ -1,78 +1,78 @@ -#ifndef CYGONCE_USTLECOS_H -#define CYGONCE_USTLECOS_H -// ========================================================================== -// -// ustlecos.h -// -// eCos specific implementations and additions to uSTL library -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Uwe Kindler -// Contributors: -// Date: 2009-07-28 -// Purpose: eCos specific additions to uSTL library -// Description: -// Usage: Do not include directly #include <ustl.h> -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ - - -// -// If exception handling is disabled then we provide a low level and -// lightwight "exeption handler" -// -#ifndef __EXCEPTIONS -namespace ustl -{ - -typedef void (*app_exception_handler_t)(const exception& ex); - - -// allow an application to register its own ustl exception handler -void set_app_exception_handler(app_exception_handler_t func); - -// an application exception handler may use this function to print the -// exception to diagnostic output -void diag_print_exception(const exception& ex); -} // namespace ustl -#endif - -// --------------------------------------------------------------------------- -#endif // CYGONCE_USTLECOS_H +#ifndef CYGONCE_USTLECOS_H +#define CYGONCE_USTLECOS_H +// ========================================================================== +// +// ustlecos.h +// +// eCos specific implementations and additions to uSTL library +// +// =========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later +// version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License +// along with eCos; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// As a special exception, if other files instantiate templates or use +// macros or inline functions from this file, or you compile this file +// and link it with other works to produce a work based on this file, +// this file does not by itself cause the resulting work to be covered by +// the GNU General Public License. However the source code for this file +// must still be made available in accordance with section (3) of the GNU +// General Public License v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +// =========================================================================== +// =========================================================================== +// #####DESCRIPTIONBEGIN#### +// +// Author(s): Uwe Kindler +// Contributors: +// Date: 2009-07-28 +// Purpose: eCos specific additions to uSTL library +// Description: +// Usage: Do not include directly #include <ustl.h> +// +// ####DESCRIPTIONEND#### +// +// ========================================================================*/ + + +// +// If exception handling is disabled then we provide a low level and +// lightwight "exeption handler" +// +#ifndef __EXCEPTIONS +namespace ustl +{ + +typedef void (*app_exception_handler_t)(const exception& ex); + + +// allow an application to register its own ustl exception handler +void set_app_exception_handler(app_exception_handler_t func); + +// an application exception handler may use this function to print the +// exception to diagnostic output +void diag_print_exception(const exception& ex); +} // namespace ustl +#endif + +// --------------------------------------------------------------------------- +#endif // CYGONCE_USTLECOS_H
--- a/packages/language/cxx/ustl/current/src/bktrace.cpp +++ b/packages/language/cxx/ustl/current/src/bktrace.cpp @@ -6,7 +6,7 @@ #include "bktrace.h" #include "sostream.h" #include "mistream.h" -#if linux && __GNUC__ +#if 0 // linux && __GNUC__ #include <execinfo.h> #else static inline int backtrace (void**, int) { return (0); }
--- a/packages/language/cxx/ustl/current/src/uexception.cpp +++ b/packages/language/cxx/ustl/current/src/uexception.cpp @@ -35,7 +35,7 @@ void exception::info (string& msgbuf, co /// Reads the exception from stream \p is. void exception::read (istream& is) { - uint32_t stmSize; + uint32_t stmSize = 0; xfmt_t fmt = xfmt_Exception; is >> fmt >> stmSize >> m_Backtrace; assert (fmt == m_Format && "The saved exception is of a different type.");
--- a/packages/language/cxx/ustl/current/src/ustlecos.cpp +++ b/packages/language/cxx/ustl/current/src/ustlecos.cpp @@ -1,115 +1,115 @@ -// ========================================================================== -// -// ustlecos.cpp -// -// eCos specific implementations and additions to uSTL library -// -// =========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -// =========================================================================== -// =========================================================================== -// #####DESCRIPTIONBEGIN#### -// -// Author(s): Uwe Kindler -// Contributors: -// Date: 2009-07-28 -// Purpose: eCos specific additions to uSTL library -// Description: -// -// ####DESCRIPTIONEND#### -// -// ========================================================================*/ -#include <cyg/infra/diag.h> -#include <cyg/infra/cyg_trac.h> -#include <ustl.h> -#include <config.h> -#include <ustlecos.h> - -// if exceptions are disabled provide a low level and lightweight -// "exception handler" -#ifndef __EXCEPTIONS -namespace ustl -{ - -// global application specific exception handler -static app_exception_handler_t app_exception_handler = 0; - - -// allow an eCos application to register its own ustl exception handler -void set_app_exception_handler(app_exception_handler_t func) -{ - //app_exception_handler = func; -} - - -// print ustl exception to diagnostic output channel -void diag_print_exception(const exception& ex) -{ - string exstr(64); - ex.info(exstr); - - string failstr = "Exception: "; - failstr += ex.what(); - failstr += "\n"; - failstr += exstr; - failstr += "\n"; - - diag_printf(failstr.c_str()); -} - - -// normally eCos is build with -fno-rtti and -fno-exceptions and does not -// provide C++ exception handling. To detect exceptions in debug builds this -// exception handler prints all exception information to diagnostic channel -// If application registerd an exception handler then exception handling will -// be passed to application exception handler -void exception_handler(const exception& ex) -{ - if (app_exception_handler) - { - app_exception_handler(ex); - } - else - { - diag_print_exception(ex); -#ifdef CYGDBG_USE_ASSERTS - CYG_FAIL("uSTL exception occured"); -#endif - } -} - -} // namespace ustl -#endif // #ifndef __EXCEPTIONS -// --------------------------------------------------------------------------- -// EOF ustlecos.cpp - +// ========================================================================== +// +// ustlecos.cpp +// +// eCos specific implementations and additions to uSTL library +// +// =========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 2009 Free Software Foundation, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later +// version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License +// along with eCos; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// As a special exception, if other files instantiate templates or use +// macros or inline functions from this file, or you compile this file +// and link it with other works to produce a work based on this file, +// this file does not by itself cause the resulting work to be covered by +// the GNU General Public License. However the source code for this file +// must still be made available in accordance with section (3) of the GNU +// General Public License v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +// =========================================================================== +// =========================================================================== +// #####DESCRIPTIONBEGIN#### +// +// Author(s): Uwe Kindler +// Contributors: +// Date: 2009-07-28 +// Purpose: eCos specific additions to uSTL library +// Description: +// +// ####DESCRIPTIONEND#### +// +// ========================================================================*/ +#include <cyg/infra/diag.h> +#include <cyg/infra/cyg_trac.h> +#include <ustl.h> +#include <config.h> +#include <ustlecos.h> + +// if exceptions are disabled provide a low level and lightweight +// "exception handler" +#ifndef __EXCEPTIONS +namespace ustl +{ + +// global application specific exception handler +static app_exception_handler_t app_exception_handler = 0; + + +// allow an eCos application to register its own ustl exception handler +void set_app_exception_handler(app_exception_handler_t func) +{ + //app_exception_handler = func; +} + + +// print ustl exception to diagnostic output channel +void diag_print_exception(const exception& ex) +{ + string exstr(64); + ex.info(exstr); + + string failstr = "Exception: "; + failstr += ex.what(); + failstr += "\n"; + failstr += exstr; + failstr += "\n"; + + diag_printf(failstr.c_str()); +} + + +// normally eCos is build with -fno-rtti and -fno-exceptions and does not +// provide C++ exception handling. To detect exceptions in debug builds this +// exception handler prints all exception information to diagnostic channel +// If application registerd an exception handler then exception handling will +// be passed to application exception handler +void exception_handler(const exception& ex) +{ + if (app_exception_handler) + { + app_exception_handler(ex); + } + else + { + diag_print_exception(ex); +#ifdef CYGDBG_USE_ASSERTS + CYG_FAIL("uSTL exception occured"); +#endif + } +} + +} // namespace ustl +#endif // #ifndef __EXCEPTIONS +// --------------------------------------------------------------------------- +// EOF ustlecos.cpp +
