Skip to content

Commit

Permalink
* include/*:
Browse files Browse the repository at this point in the history
* src/*:
* tests/*:
* HISTORY:
* LICENSE: Updated to uSTL 1.6 sources.
  • Loading branch information
sergeig committed Apr 4, 2012
1 parent 9f07124 commit 632d61f
Show file tree
Hide file tree
Showing 99 changed files with 453 additions and 350 deletions.
8 changes: 8 additions & 0 deletions packages/language/cxx/ustl/current/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2012-03-24 Sergei Gavrikov <[email protected]>

* include/*:
* src/*:
* tests/*:
* HISTORY:
* LICENSE: Updated to uSTL 1.6 sources.

2011-11-21 John Dallaway <[email protected]>

* include/ustl/ustring.h: Fix incorrect behaviour of iat when passed
Expand Down
21 changes: 21 additions & 0 deletions packages/language/cxx/ustl/current/HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
2012-02-18 Release 1.6
* Fixed compilation with c++0x
alignof is a keyword in c++0x, so the stream version usually not needed now.
On the other hand, alignof can not be overloaded, so stream_align_of is the
new name for the old alignof. Most code should not require changes due to this.
* Fix iat in string, which did not handle npos argument correctly, sometimes
resulting in failures of other functions using it, like substr.

2011-03-16 Release 1.5
* Updated set, map, and multimap with full set of insert, erase, and search overloads
* Added public lower_bound, upper_bound, and equal_range to map, as per standard
* Added comparator parameter to set, multiset, map, and multimap.
* Implemented FirstBit, Rol, Ror, and a generic NextPow2
* Remove memlink copy because it conflicts with string copy
* Operators returning a new value should be const
* Added char* + string operator, and a noarg erase
* Added --force-inline configure option
* Removed all references to stdc++ headers when not using libstdc++
* Fixed minor glitches compiling with clang++
* Other small fixes

2010-03-21 Release 1.4
* Fixed crash in destructor of empty vector, introduced by 1.3
* Fixed list merge, which previously did not compile
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

The MIT License

Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
Copyright (c) 2005 by Mike Sharov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef USTL_H_6A5A10410D2CD7FC2D78FE470F045EB7
Expand Down
4 changes: 1 addition & 3 deletions packages/language/cxx/ustl/current/include/ustl/bktrace.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2006-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2006 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef BKTRACE_H_63ABB1E4388CEDD975DBE58B57DE474F
Expand Down Expand Up @@ -47,6 +47,4 @@ class CBacktrace {

} // namespace ustl

ALIGNOF(ustl::CBacktrace, sizeof(void*))

#endif
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/cmemlink.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef CMEMLINK_H_7CFAB32C5C6732ED29B34EF00EA40A12
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/fstream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef FSTREAM_H_056E10F70EAD416443E3B36A2D6B5FA3
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/memblock.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef MEMBLOCK_H_7ED63A891164CC43578E63664D52A196
Expand Down
5 changes: 1 addition & 4 deletions packages/language/cxx/ustl/current/include/ustl/memlink.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef MEMLINK_H_798D25827C8E322D2D7E734B169FF5FC
Expand Down Expand Up @@ -64,9 +64,6 @@ class memlink : public cmemlink {
inline void link (void* first, void* last) { link (first, distance (first, last)); }
inline void relink (const void* p, size_type n) { cmemlink::relink (p, n); }
inline void relink (void* p, size_type n) { cmemlink::relink (p, n); }
inline void copy (const cmemlink& l) { copy (begin(), l.cdata(), l.size()); }
inline void copy (const void* p, size_type n) { copy (begin(), p, n); }
void copy (iterator offset, const void* p, size_type n);
inline void swap (memlink& l) { cmemlink::swap (l); }
void fill (iterator start, const void* p, size_type elsize, size_type elCount = 1);
inline void insert (iterator start, size_type size);
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/metamac.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.
//
/// \file metamac.h
Expand Down
6 changes: 3 additions & 3 deletions packages/language/cxx/ustl/current/include/ustl/mistream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef MISTREAM_H_103AEF1F266C04AA1A817D38705983DA
Expand All @@ -13,7 +13,7 @@
#include "uios.h"
#include "config.h"
#if WANT_STREAM_BOUNDS_CHECKING
#include <typeinfo>
#include "typeinfo.h"
#endif

namespace ustl {
Expand Down Expand Up @@ -257,7 +257,7 @@ inline void istream::align (streamsize grain)
template <typename T>
inline void istream::iread (T& v)
{
assert (aligned (alignof (v)));
assert (aligned (stream_align_of (v)));
#if WANT_STREAM_BOUNDS_CHECKING
if (!verify_remaining ("read", USTL_TYPENAME(v), sizeof(T)))
return;
Expand Down
8 changes: 4 additions & 4 deletions packages/language/cxx/ustl/current/include/ustl/mostream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef MOSTREAM_H_24A8C5397E0848216573E5670930FC9A
Expand All @@ -12,7 +12,7 @@
#include "uios.h"
#include "config.h"
#if WANT_STREAM_BOUNDS_CHECKING
#include <typeinfo>
#include "typeinfo.h"
#endif

namespace ustl {
Expand All @@ -28,7 +28,7 @@ class string;
/// This class contains a set of functions to write integral types into an
/// unstructured memory block. Packing binary file data can be done this
/// way, for instance. aligning the data is your responsibility, and can
/// be accomplished by proper ordering of writes and by calling \ref ostream::align.
/// be accomplished by proper ordering of writes and by calling align.
/// Unaligned access is usually slower by orders of magnitude and,
/// on some architectures, such as PowerPC, can cause your program to crash.
/// Therefore, all write functions have asserts to check alignment.
Expand Down Expand Up @@ -253,7 +253,7 @@ inline void ostream::write (const cmemlink& buf)
template <typename T>
inline void ostream::iwrite (const T& v)
{
assert (aligned (alignof (v)));
assert (aligned (stream_align_of (v)));
#if WANT_STREAM_BOUNDS_CHECKING
if (!verify_remaining ("write", USTL_TYPENAME(v), sizeof(T)))
return;
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/ofstream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef FDOSTREAM_H_5E27FC3D530BF3CA04D6C73F5700EECC
Expand Down
4 changes: 2 additions & 2 deletions packages/language/cxx/ustl/current/include/ustl/simd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.
//
/// \file simd.h
Expand Down Expand Up @@ -54,7 +54,7 @@ inline void packop (const Ctr& op1, const Ctr& op2, Ctr& result, BinaryOperation
{
assert (op1.size() <= op2.size() && op1.size() <= result.size());
passign (op1, result);
packop (op2, result);
op (op2, result);
}

/// Copies \p op1 into \p result.
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/sistream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef SISTREAM_H_0CCA102229A49F5D65EE852E62B27CE2
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/sostream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef SOSTREAM_H_5323DC8C26E181D43278F2F53FDCF19F
Expand Down
16 changes: 15 additions & 1 deletion packages/language/cxx/ustl/current/include/ustl/strmsize.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.
//
/// \file strmsize.h
Expand Down Expand Up @@ -28,6 +28,20 @@ inline streamsize stream_size_of (const T& v) {
return (stream_sizer_t()(v));
}

/// \brief Returns the recommended stream alignment for type \p T. Override with ALIGNOF.
/// Because this is occasionally called with a null value, do not access the argument!
template <typename T>
inline size_t stream_align_of (const T&)
{
if (numeric_limits<T>::is_integral)
return (__alignof__(T));
return (4);
}

#define ALIGNOF(type,grain) \
namespace ustl { \
template <> inline size_t stream_align_of (const type&) { return (grain); } }

} // namespace ustl

//
Expand Down
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/traits.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2007-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2007 by Mike Sharov <[email protected]>
//
// This implementation is adapted from the Loki library, distributed under
// the MIT license with Copyright (c) 2001 by Andrei Alexandrescu.
Expand Down
40 changes: 40 additions & 0 deletions packages/language/cxx/ustl/current/include/ustl/typeinfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.
//
#ifndef TYPEINFO_H_E67A267F0BBB5005
#define TYPEINFO_H_E67A267F0BBB5005

#ifndef WITHOUT_LIBSTDCPP
#include <typeinfo>
#else

#include "uexception.h"

namespace __cxxabiv1 { class __class_type_info; }

namespace std {
class type_info {
public:
inline virtual ~type_info (void) { }
inline const char* name (void) const { return (__name[0] == '*' ? __name + 1 : __name); }
inline bool before (const type_info& v) const { return (__name < v.__name); }
inline bool operator==(const type_info& v) const { return (__name == v.__name); }
inline bool operator!=(const type_info& v) const { return (!operator==(v)); }
virtual bool __is_pointer_p (void) const;
virtual bool __is_function_p (void) const;
virtual bool __do_catch (const type_info* __thr_type, void** __thr_obj, unsigned __outer) const;
virtual bool __do_upcast (const __cxxabiv1::__class_type_info* __target, void** __obj_ptr) const;
explicit inline type_info (const char* newname) : __name(newname) { }
private:
inline void operator= (const type_info&) { }
inline type_info (const type_info&) { }
protected:
const char* __name;
};

} // namespace std

#endif
#endif
2 changes: 1 addition & 1 deletion packages/language/cxx/ustl/current/include/ustl/typelist.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2007-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2007 by Mike Sharov <[email protected]>
//
// This implementation is adapted from the Loki library, distributed under
// the MIT license with Copyright (c) 2001 by Andrei Alexandrescu.
Expand Down
5 changes: 3 additions & 2 deletions packages/language/cxx/ustl/current/include/ustl/typet.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2007-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2007 by Mike Sharov <[email protected]>
//
// This implementation is adapted from the Loki library, distributed under
// the MIT license with Copyright (c) 2001 by Andrei Alexandrescu.
Expand Down Expand Up @@ -38,7 +38,8 @@ struct IsSameType<T,T> { enum { value = true }; };
/// Conversion<T,U>::exists2Way is true if U is also convertible to T
/// Conversion<T,U>::sameType is true if U is T
template <typename T, typename U>
class Conversion {
struct Conversion {
private:
typedef char UT;
typedef short TT;
static UT Test (U);
Expand Down
3 changes: 1 addition & 2 deletions packages/language/cxx/ustl/current/include/ustl/ualgo.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef UALGO_H_711AB4214D417A51166694D47A662D6E
Expand All @@ -9,7 +9,6 @@
#include "upair.h"
#include "ualgobase.h"
#include "ufunction.h"
#include "upredalgo.h"
#include "umemory.h"
#include <stdlib.h> // for rand()

Expand Down
6 changes: 3 additions & 3 deletions packages/language/cxx/ustl/current/include/ustl/ualgobase.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the uSTL library, an STL implementation.
//
// Copyright (c) 2005-2009 by Mike Sharov <[email protected]>
// Copyright (c) 2005 by Mike Sharov <[email protected]>
// This file is free software, distributed under the MIT License.

#ifndef UALGOBASE_H_683A0BE77546133C4CE0E3622CFAA2EB
Expand Down Expand Up @@ -258,7 +258,7 @@ COPY_BACKWARD_ALIAS_FUNC(const void, void, uint8_t)
#undef COPY_BACKWARD_ALIAS_FUNC
#define FILL_ALIAS_FUNC(type, alias_type, v_type) \
template <> inline void fill (type* first, type* last, const v_type& value) \
{ fill ((alias_type*) first, (alias_type*) last, (const alias_type&) value); }
{ fill ((alias_type*) first, (alias_type*) last, (const alias_type) value); }
FILL_ALIAS_FUNC(void, uint8_t, char)
FILL_ALIAS_FUNC(void, uint8_t, uint8_t)
#if WANT_UNROLLED_COPY
Expand Down Expand Up @@ -298,7 +298,7 @@ COPY_N_ALIAS_FUNC(const int32_t, int32_t, uint32_t)
#undef COPY_N_ALIAS_FUNC
#define FILL_N_ALIAS_FUNC(type, alias_type, v_type) \
template <> inline type* fill_n (type* first, size_t n, const v_type& value) \
{ return ((type*) fill_n ((alias_type*) first, n, (const alias_type&) value)); }
{ return ((type*) fill_n ((alias_type*) first, n, (const alias_type) value)); }
FILL_N_ALIAS_FUNC(void, uint8_t, char)
FILL_N_ALIAS_FUNC(void, uint8_t, uint8_t)
#if WANT_UNROLLED_COPY
Expand Down
Loading

0 comments on commit 632d61f

Please sign in to comment.