Merge branch 'master' of git.lyx.org:lyx

This commit is contained in:
Uwe Stöhr 2016-05-29 23:58:10 +02:00
commit b917c4e40f
192 changed files with 3990 additions and 7198 deletions

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
# configure.ac needs to have unix line ends on windows, see #10053
configure.ac eol=lf

14
3rdparty/Makefile.am vendored
View File

@ -6,4 +6,16 @@ if USE_INCLUDED_BOOST
BOOST = boost
endif
SUBDIRS = $(BOOST)
if USE_INCLUDED_HUNSPELL
HUNSPELL = hunspell
endif
if USE_INCLUDED_ICONV
ICONV = libiconv
endif
if USE_INCLUDED_ZLIB
ZLIB = zlib
endif
SUBDIRS = $(BOOST) $(HUNSPELL) $(ICONV) $(ZLIB)

View File

@ -1,59 +0,0 @@
// ----------------------------------------------------------------------------
// format.hpp : primary header
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_HPP
#define BOOST_FORMAT_HPP
#include <vector>
#include <string>
#include <boost/detail/workaround.hpp>
#include <boost/config.hpp>
#ifndef BOOST_NO_STD_LOCALE
#include <locale>
#endif
// *** Compatibility framework
#include <boost/format/detail/compat_workarounds.hpp>
#ifdef BOOST_NO_LOCALE_ISIDIGIT
#include <cctype> // we'll use the non-locale <cctype>'s std::isdigit(int)
#endif
// **** Forward declarations ----------------------------------
#include <boost/format/format_fwd.hpp> // basic_format<Ch,Tr>, and other frontends
#include <boost/format/internals_fwd.hpp> // misc forward declarations for internal use
// **** Auxiliary structs (stream_format_state<Ch,Tr> , and format_item<Ch,Tr> )
#include <boost/format/internals.hpp>
// **** Format class interface --------------------------------
#include <boost/format/format_class.hpp>
// **** Exceptions -----------------------------------------------
#include <boost/format/exceptions.hpp>
// **** Implementation -------------------------------------------
#include <boost/format/format_implementation.hpp> // member functions
#include <boost/format/group.hpp> // class for grouping arguments
#include <boost/format/feed_args.hpp> // argument-feeding functions
#include <boost/format/parsing.hpp> // format-string parsing (member-)functions
// **** Implementation of the free functions ----------------------
#include <boost/format/free_funcs.hpp>
// *** Undefine 'local' macros :
#include <boost/format/detail/unset_macros.hpp>
#endif // BOOST_FORMAT_HPP

View File

@ -1,176 +0,0 @@
// ----------------------------------------------------------------------------
// alt_sstream.hpp : alternative stringstream
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_SK_ALT_SSTREAM_HPP
#define BOOST_SK_ALT_SSTREAM_HPP
#include <string>
#include <boost/format/detail/compat_workarounds.hpp>
#include <boost/utility/base_from_member.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/assert.hpp>
namespace boost {
namespace io {
template<class Ch, class Tr=::std::char_traits<Ch>,
class Alloc=::std::allocator<Ch> >
class basic_altstringbuf;
template<class Ch, class Tr =::std::char_traits<Ch>,
class Alloc=::std::allocator<Ch> >
class basic_oaltstringstream;
template<class Ch, class Tr, class Alloc>
class basic_altstringbuf
: public ::std::basic_streambuf<Ch, Tr>
{
typedef ::std::basic_streambuf<Ch, Tr> streambuf_t;
typedef typename CompatAlloc<Alloc>::compatible_type compat_allocator_type;
typedef typename CompatTraits<Tr>::compatible_type compat_traits_type;
public:
typedef Ch char_type;
typedef Tr traits_type;
typedef typename compat_traits_type::int_type int_type;
typedef typename compat_traits_type::pos_type pos_type;
typedef typename compat_traits_type::off_type off_type;
typedef Alloc allocator_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
typedef typename string_type::size_type size_type;
typedef ::std::streamsize streamsize;
explicit basic_altstringbuf(std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
: putend_(NULL), is_allocated_(false), mode_(mode)
{}
explicit basic_altstringbuf(const string_type& s,
::std::ios_base::openmode mode
= ::std::ios_base::in | ::std::ios_base::out)
: putend_(NULL), is_allocated_(false), mode_(mode)
{ dealloc(); str(s); }
virtual ~basic_altstringbuf()
{ dealloc(); }
using streambuf_t::pbase;
using streambuf_t::pptr;
using streambuf_t::epptr;
using streambuf_t::eback;
using streambuf_t::gptr;
using streambuf_t::egptr;
void clear_buffer();
void str(const string_type& s);
// 0-copy access :
Ch * begin() const;
size_type size() const;
size_type cur_size() const; // stop at current pointer
Ch * pend() const // the highest position reached by pptr() since creation
{ return ((putend_ < pptr()) ? pptr() : putend_); }
size_type pcount() const
{ return static_cast<size_type>( pptr() - pbase()) ;}
// copy buffer to string :
string_type str() const
{ return string_type(begin(), size()); }
string_type cur_str() const
{ return string_type(begin(), cur_size()); }
protected:
explicit basic_altstringbuf (basic_altstringbuf * s,
::std::ios_base::openmode mode
= ::std::ios_base::in | ::std::ios_base::out)
: putend_(NULL), is_allocated_(false), mode_(mode)
{ dealloc(); str(s); }
virtual pos_type seekoff(off_type off, ::std::ios_base::seekdir way,
::std::ios_base::openmode which
= ::std::ios_base::in | ::std::ios_base::out);
virtual pos_type seekpos (pos_type pos,
::std::ios_base::openmode which
= ::std::ios_base::in | ::std::ios_base::out);
virtual int_type underflow();
virtual int_type pbackfail(int_type meta = compat_traits_type::eof());
virtual int_type overflow(int_type meta = compat_traits_type::eof());
void dealloc();
private:
enum { alloc_min = 256}; // minimum size of allocations
Ch *putend_; // remembers (over seeks) the highest value of pptr()
bool is_allocated_;
::std::ios_base::openmode mode_;
compat_allocator_type alloc_; // the allocator object
};
// --- class basic_oaltstringstream ----------------------------------------
template <class Ch, class Tr, class Alloc>
class basic_oaltstringstream
: private base_from_member< shared_ptr< basic_altstringbuf< Ch, Tr, Alloc> > >,
public ::std::basic_ostream<Ch, Tr>
{
class No_Op {
// used as no-op deleter for (not-owner) shared_pointers
public:
template<class T>
const T & operator()(const T & arg) { return arg; }
};
typedef ::std::basic_ostream<Ch, Tr> stream_t;
typedef boost::base_from_member<boost::shared_ptr<
basic_altstringbuf<Ch,Tr, Alloc> > >
pbase_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
typedef typename string_type::size_type size_type;
typedef basic_altstringbuf<Ch, Tr, Alloc> stringbuf_t;
public:
typedef Alloc allocator_type;
basic_oaltstringstream()
: pbase_type(new stringbuf_t), stream_t(rdbuf())
{ }
basic_oaltstringstream(::boost::shared_ptr<stringbuf_t> buf)
: pbase_type(buf), stream_t(rdbuf())
{ }
basic_oaltstringstream(stringbuf_t * buf)
: pbase_type(buf, No_Op() ), stream_t(rdbuf())
{ }
stringbuf_t * rdbuf() const
{ return pbase_type::member.get(); }
void clear_buffer()
{ rdbuf()->clear_buffer(); }
// 0-copy access :
Ch * begin() const
{ return rdbuf()->begin(); }
size_type size() const
{ return rdbuf()->size(); }
size_type cur_size() const // stops at current position
{ return rdbuf()->cur_size(); }
// copy buffer to string :
string_type str() const // [pbase, epptr[
{ return rdbuf()->str(); }
string_type cur_str() const // [pbase, pptr[
{ return rdbuf()->cur_str(); }
void str(const string_type& s)
{ rdbuf()->str(s); }
};
} // N.S. io
} // N.S. boost
#include <boost/format/alt_sstream_impl.hpp>
#endif // include guard

View File

@ -1,313 +0,0 @@
// ----------------------------------------------------------------------------
// alt_sstream_impl.hpp : alternative stringstream, templates implementation
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_SK_ALT_SSTREAM_IMPL_HPP
#define BOOST_SK_ALT_SSTREAM_IMPL_HPP
namespace boost {
namespace io {
// --- Implementation ------------------------------------------------------//
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>::
clear_buffer () {
const Ch * p = pptr();
const Ch * b = pbase();
if(p != NULL && p != b) {
seekpos(0, ::std::ios_base::out);
}
p = gptr();
b = eback();
if(p != NULL && p != b) {
seekpos(0, ::std::ios_base::in);
}
}
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>::
str (const string_type& s) {
size_type sz=s.size();
if(sz != 0 && mode_ & (::std::ios_base::in | ::std::ios_base::out) ) {
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
void *vd_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0);
Ch *new_ptr = static_cast<Ch *>(vd_ptr);
#else
Ch *new_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0);
#endif
// if this didnt throw, we're safe, update the buffer
dealloc();
sz = s.copy(new_ptr, sz);
putend_ = new_ptr + sz;
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(new_ptr, new_ptr, new_ptr + sz);
if(mode_ & ::std::ios_base::out) {
streambuf_t::setp(new_ptr, new_ptr + sz);
if(mode_ & (::std::ios_base::app | ::std::ios_base::ate))
streambuf_t::pbump(static_cast<int>(sz));
if(gptr() == NULL)
streambuf_t::setg(new_ptr, NULL, new_ptr);
}
is_allocated_ = true;
}
else
dealloc();
}
template<class Ch, class Tr, class Alloc>
Ch* basic_altstringbuf<Ch, Tr, Alloc>::
begin () const {
if(mode_ & ::std::ios_base::out && pptr() != NULL)
return pbase();
else if(mode_ & ::std::ios_base::in && gptr() != NULL)
return eback();
return NULL;
}
template<class Ch, class Tr, class Alloc>
typename std::basic_string<Ch,Tr,Alloc>::size_type
basic_altstringbuf<Ch, Tr, Alloc>::
size () const {
if(mode_ & ::std::ios_base::out && pptr())
return static_cast<size_type>(pend() - pbase());
else if(mode_ & ::std::ios_base::in && gptr())
return static_cast<size_type>(egptr() - eback());
else
return 0;
}
template<class Ch, class Tr, class Alloc>
typename std::basic_string<Ch,Tr,Alloc>::size_type
basic_altstringbuf<Ch, Tr, Alloc>::
cur_size () const {
if(mode_ & ::std::ios_base::out && pptr())
return static_cast<streamsize>( pptr() - pbase());
else if(mode_ & ::std::ios_base::in && gptr())
return static_cast<streamsize>( gptr() - eback());
else
return 0;
}
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::pos_type
basic_altstringbuf<Ch, Tr, Alloc>::
seekoff (off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) {
if(pptr() != NULL && putend_ < pptr())
putend_ = pptr();
if(which & ::std::ios_base::in && gptr() != NULL) {
// get area
if(way == ::std::ios_base::end)
off += static_cast<off_type>(putend_ - gptr());
else if(way == ::std::ios_base::beg)
off += static_cast<off_type>(eback() - gptr());
else if(way != ::std::ios_base::cur || (which & ::std::ios_base::out) )
// (altering in&out is only supported if way is beg or end, not cur)
return pos_type(off_type(-1));
if(eback() <= off+gptr() && off+gptr() <= putend_ ) {
// set gptr
streambuf_t::gbump(static_cast<int>(off));
if(which & ::std::ios_base::out && pptr() != NULL)
// update pptr to match gptr
streambuf_t::pbump(static_cast<int>(gptr()-pptr()));
}
else
off = off_type(-1);
}
else if(which & ::std::ios_base::out && pptr() != NULL) {
// put area
if(way == ::std::ios_base::end)
off += static_cast<off_type>(putend_ - pptr());
else if(way == ::std::ios_base::beg)
off += static_cast<off_type>(pbase() - pptr());
else if(way != ::std::ios_base::beg)
return pos_type(off_type(-1));
if(pbase() <= off+pptr() && off+pptr() <= putend_)
// set pptr
streambuf_t::pbump(static_cast<int>(off));
else
off = off_type(-1);
}
else // neither in nor out
off = off_type(-1);
return (pos_type(off));
}
//- end seekoff(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::pos_type
basic_altstringbuf<Ch, Tr, Alloc>::
seekpos (pos_type pos, ::std::ios_base::openmode which) {
off_type off = off_type(pos); // operation guaranteed by 27.4.3.2 table 88
if(pptr() != NULL && putend_ < pptr())
putend_ = pptr();
if(off != off_type(-1)) {
if(which & ::std::ios_base::in && gptr() != NULL) {
// get area
if(0 <= off && off <= putend_ - eback()) {
streambuf_t::gbump(static_cast<int>(eback() - gptr() + off));
if(which & ::std::ios_base::out && pptr() != NULL) {
// update pptr to match gptr
streambuf_t::pbump(static_cast<int>(gptr()-pptr()));
}
}
else
off = off_type(-1);
}
else if(which & ::std::ios_base::out && pptr() != NULL) {
// put area
if(0 <= off && off <= putend_ - eback())
streambuf_t::pbump(static_cast<int>(eback() - pptr() + off));
else
off = off_type(-1);
}
else // neither in nor out
off = off_type(-1);
return (pos_type(off));
}
else {
BOOST_ASSERT(0); // §27.4.3.2 allows undefined-behaviour here
return pos_type(off_type(-1));
}
}
// -end seekpos(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
basic_altstringbuf<Ch, Tr, Alloc>::
underflow () {
if(gptr() == NULL) // no get area -> nothing to get.
return (compat_traits_type::eof());
else if(gptr() < egptr()) // ok, in buffer
return (compat_traits_type::to_int_type(*gptr()));
else if(mode_ & ::std::ios_base::in && pptr() != NULL
&& (gptr() < pptr() || gptr() < putend_) )
{ // expand get area
if(putend_ < pptr())
putend_ = pptr(); // remember pptr reached this far
streambuf_t::setg(eback(), gptr(), putend_);
return (compat_traits_type::to_int_type(*gptr()));
}
else // couldnt get anything. EOF.
return (compat_traits_type::eof());
}
// -end underflow(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
basic_altstringbuf<Ch, Tr, Alloc>::
pbackfail (int_type meta) {
if(gptr() != NULL && (eback() < gptr())
&& (mode_ & (::std::ios_base::out)
|| compat_traits_type::eq_int_type(compat_traits_type::eof(), meta)
|| compat_traits_type::eq(compat_traits_type::to_char_type(meta), gptr()[-1]) ) ) {
streambuf_t::gbump(-1); // back one character
if(!compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
// put-back meta into get area
*gptr() = compat_traits_type::to_char_type(meta);
return (compat_traits_type::not_eof(meta));
}
else
return (compat_traits_type::eof()); // failed putback
}
// -end pbackfail(..)
template<class Ch, class Tr, class Alloc>
typename basic_altstringbuf<Ch, Tr, Alloc>::int_type
basic_altstringbuf<Ch, Tr, Alloc>::
overflow (int_type meta) {
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4996)
#endif
if(compat_traits_type::eq_int_type(compat_traits_type::eof(), meta))
return compat_traits_type::not_eof(meta); // nothing to do
else if(pptr() != NULL && pptr() < epptr()) {
streambuf_t::sputc(compat_traits_type::to_char_type(meta));
return meta;
}
else if(! (mode_ & ::std::ios_base::out))
// no write position, and cant make one
return compat_traits_type::eof();
else { // make a write position available
std::size_t prev_size = pptr() == NULL ? 0 : epptr() - eback();
std::size_t new_size = prev_size;
// exponential growth : size *= 1.5
std::size_t add_size = new_size / 2;
if(add_size < alloc_min)
add_size = alloc_min;
Ch * newptr = NULL, *oldptr = eback();
// make sure adding add_size wont overflow size_t
while (0 < add_size && ((std::numeric_limits<std::size_t>::max)()
- add_size < new_size) )
add_size /= 2;
if(0 < add_size) {
new_size += add_size;
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
void *vdptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0);
newptr = static_cast<Ch *>(vdptr);
#else
newptr = alloc_.allocate(new_size, is_allocated_? oldptr : 0);
#endif
}
if(0 < prev_size)
compat_traits_type::copy(newptr, oldptr, prev_size);
if(is_allocated_)
alloc_.deallocate(oldptr, prev_size);
is_allocated_=true;
if(prev_size == 0) { // first allocation
putend_ = newptr;
streambuf_t::setp(newptr, newptr + new_size);
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(newptr, newptr, newptr + 1);
else
streambuf_t::setg(newptr, 0, newptr);
}
else { // update pointers
putend_ = putend_ - oldptr + newptr;
int pptr_count = static_cast<int>(pptr()-pbase());
int gptr_count = static_cast<int>(gptr()-eback());
streambuf_t::setp(pbase() - oldptr + newptr, newptr + new_size);
streambuf_t::pbump(pptr_count);
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(newptr, newptr + gptr_count, pptr() + 1);
else
streambuf_t::setg(newptr, 0, newptr);
}
streambuf_t::sputc(compat_traits_type::to_char_type(meta));
return meta;
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
}
// -end overflow(..)
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>:: dealloc() {
if(is_allocated_)
alloc_.deallocate(eback(), (pptr() != NULL ? epptr() : egptr()) - eback());
is_allocated_ = false;
streambuf_t::setg(0, 0, 0);
streambuf_t::setp(0, 0);
putend_ = NULL;
}
}// N.S. io
} // N.S. boost
#endif // include guard

View File

@ -1,86 +0,0 @@
// ----------------------------------------------------------------------------
// compat_workarounds : general framework for non-conformance workarounds
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// this file defines wrapper classes to hide non-conforming
// std::char_traits<> and std::allocator<> traits
// and Includes : config_macros.hpp (defines config macros
// and compiler-specific switches)
// Non-conformant Std-libs fail to supply conformant traits (std::char_traits,
// std::allocator) and/or the std::string doesnt support them.
// We don't want to have hundreds of #ifdef workarounds, so we define
// replacement traits.
// But both char_traits and allocator traits are visible in the interface,
// (inside the final string type), thus we need to keep both
// the replacement type (typedefed to 'compatible_type') for real use,
// and the original stdlib type (typedef to 'type_for_string') for interface
// visibility. This is what Compat* classes do (as well as be transparent
// when good allocator and char traits are present)
#ifndef BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
#define BOOST_FORMAT_COMPAT_WORKAROUNDS_HPP
namespace boost {
namespace io {
// gcc-2.95 char traits (non-conformantly named string_char_traits)
// lack several functions so we extend them in a replacement class.
template<class Tr>
class CompatTraits;
// std::allocator<Ch> in gcc-2.95 is ok, but basic_string only works
// with plain 'std::alloc' still, alt_stringbuf requires a functionnal
// alloc template argument, so we need a replacement allocator
template<class Alloc>
class CompatAlloc;
} // N.S. io
}// N.S. boost
#include <boost/format/detail/config_macros.hpp>
// sets-up macros and load compiler-specific workarounds headers.
#if !defined(BOOST_FORMAT_STREAMBUF_DEFINED)
// workarounds-gcc-2.95 might have defined own streambuf
#include <streambuf>
#endif
#if !defined(BOOST_FORMAT_OSTREAM_DEFINED)
// workarounds-gcc-2.95 might already have included <iostream>
#include <ostream>
#endif
namespace boost {
namespace io {
// **** CompatTraits general definitions : ----------------------------
template<class Tr>
class CompatTraits
{ // general case : be transparent
public:
typedef Tr compatible_type;
};
// **** CompatAlloc general definitions : -----------------------------
template<class Alloc>
class CompatAlloc
{ // general case : be transparent
public:
typedef Alloc compatible_type;
};
} //N.S. io
} // N.S. boost
#endif // include guard

View File

@ -1,95 +0,0 @@
// -*- C++ -*-
// ----------------------------------------------------------------------------
// config_macros.hpp : configuration macros for the format library
// only BOOST_IO_STD is absolutely needed (it should be 'std::' in general)
// others are compiler-specific workaround macros used in #ifdef switches
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_CONFIG_MACROS_HPP
#define BOOST_FORMAT_CONFIG_MACROS_HPP
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
// make sure our local macros wont override something :
#if defined(BOOST_NO_LOCALE_ISDIGIT) || defined(BOOST_OVERLOAD_FOR_NON_CONST) \
|| defined(BOOST_IO_STD) || defined( BOOST_IO_NEEDS_USING_DECLARATION ) \
|| defined(BOOST_NO_TEMPLATE_STD_STREAM) \
|| defined(BOOST_FORMAT_STREAMBUF_DEFINED) || defined(BOOST_FORMAT_OSTREAM_DEFINED)
#error "boost::format uses a local macro that is already defined."
#endif
// specific workarounds. each header can define BOOS_IO_STD if it
// needs. (e.g. because of IO_NEEDS_USING_DECLARATION)
#include <boost/format/detail/workarounds_gcc-2_95.hpp>
#include <boost/format/detail/workarounds_stlport.hpp>
#ifndef BOOST_IO_STD
# define BOOST_IO_STD ::std::
#endif
#if defined(BOOST_NO_STD_LOCALE) || \
( BOOST_WORKAROUND(__BORLANDC__, <= 0x564) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) )
// some future __BORLANDC__ >0x564 versions might not need this
// 0x570 is Borland's kylix branch
#define BOOST_NO_LOCALE_ISDIGIT
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300))
#define BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif
// **** Workaround for io streams, stlport and msvc.
#ifdef BOOST_IO_NEEDS_USING_DECLARATION
namespace boost {
using std::char_traits;
using std::basic_ostream;
namespace io {
using std::basic_ostream;
namespace detail {
using std::basic_ios;
using std::basic_ostream;
}
}
#if ! defined(BOOST_NO_STD_LOCALE)
using std::locale;
namespace io {
using std::locale;
namespace detail {
using std::locale;
}
}
#endif // locale
}
// -end N.S. boost
#endif // needs_using_declaration
#if ! defined(BOOST_NO_STD_LOCALE)
#include <locale>
#endif
// *** hide std::locale if it doesnt exist.
// this typedef is either std::locale or int, avoids placing ifdefs everywhere
namespace boost { namespace io { namespace detail {
#if ! defined(BOOST_NO_STD_LOCALE)
typedef BOOST_IO_STD locale locale_t;
#else
typedef int locale_t;
#endif
} } }
// ----------------------------------------------------------------------------
#endif // BOOST_FORMAT_MACROS_DEFAULT_HPP

View File

@ -1,54 +0,0 @@
// ----------------------------------------------------------------------------
// msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads)
// the trick was described in boost's list by Aleksey Gurtovoy
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_MSVC_DISAMBIGUATER_HPP
#define BOOST_MSVC_DISAMBIGUATER_HPP
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
#include <boost/format/group.hpp>
#include <ostream>
namespace boost {
namespace io {
namespace detail {
template< class Ch, class Tr, class T >
struct disambiguater
{
template< typename U >
static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
{
os << group_head(x.a1_);
}
static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
{
}
template< typename U >
static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
{
os << group_last(x.a1_);
}
static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
{
os << x;
}
};
} // namespace detail
} // namespace io
} // namespace boost
#endif // -__DECCXX_VER
#endif // -BOOST_MSVC_DISAMBIGUATER_HPP

View File

@ -1,34 +0,0 @@
// ----------------------------------------------------------------------------
// unset_macros.hpp
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// *** Undefine 'local' macros :
#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST
#undef BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif
#ifdef BOOST_NO_LOCALE_ISDIGIT
#undef BOOST_NO_LOCALE_ISDIGIT
#endif
#ifdef BOOST_IO_STD
#undef BOOST_IO_STD
#endif
#ifdef BOOST_IO_NEEDS_USING_DECLARATION
#undef BOOST_IO_NEEDS_USING_DECLARATION
#endif
#ifdef BOOST_NO_TEMPLATE_STD_STREAM
#undef BOOST_NO_TEMPLATE_STD_STREAM
#endif
#ifdef BOOST_FORMAT_STREAMBUF_DEFINED
#undef BOOST_FORMAT_STREAMBUF_DEFINED
#endif
#ifdef BOOST_FORMAT_OSTREAM_DEFINED
#undef BOOST_FORMAT_OSTREAM_DEFINED
#endif

View File

@ -1,162 +0,0 @@
// ----------------------------------------------------------------------------
// workarounds for gcc < 3.0.
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// There's a lot to do, the stdlib shipped with gcc prior to 3.x
// was terribly non-conforming.
// . defines macros switches
// . supplies template classes basic_foo<char,Tr> where gcc only supplies foo.
// i.e :
// - basic_ios<char, Tr> from ios
// - basic_ostream<char, Tr> from ostream
// - basic_srteambuf<char, Tr> from streambuf
// these can be used transparently. (it obviously does not work for wchar_t)
// . specialise CompatAlloc and CompatTraits to wrap gcc-2.95's
// string_char_traits and std::alloc
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
// only for gcc-2.95's native stdlib
#ifndef BOOST_FORMAT_WORKAROUNDS_GCC295_H
#define BOOST_FORMAT_WORKAROUNDS_GCC295_H
// SGI STL doesnt have <ostream> and others, so we need iostream.
#include <iostream>
#define BOOST_FORMAT_OSTREAM_DEFINED
#include <streambuf.h>
#define BOOST_FORMAT_STREAMBUF_DEFINED
#define BOOST_NO_TEMPLATE_STD_STREAM
#ifndef BOOST_IO_STD
# define BOOST_IO_STD std::
#endif
// ***
// gcc's simple classes turned into standard-like template classes :
namespace std {
// gcc has string_char_traits, it's incomplete.
// we declare a std::char_traits, and specialize CompatTraits<..> on it
// to do what is required
template<class Ch>
class char_traits; // no definition here, we will just use it as a tag.
template <class Ch, class Tr>
class basic_streambuf;
template <class Tr>
class basic_streambuf<char, Tr> : public streambuf {
};
template <class Ch, class Tr=::std::char_traits<Ch> >
class basic_ios;
template <class Tr>
class basic_ios<char, Tr> : public ostream {
public:
basic_ios(streambuf * p) : ostream(p) {};
char fill() const { return ios::fill(); } // gcc returns wchar..
char fill(char c) { return ios::fill(c); } // gcc takes wchar..
char widen(char c) { return c; }
char narrow(char c, char def) { return c; }
basic_ios& copyfmt(const ios& right) {
fill(right.fill());
flags(right.flags() );
exceptions(right.exceptions());
width(right.width());
precision(right.precision());
return *this;
}
};
typedef ios ios_base;
template <class Ch, class Tr>
class basic_ostream;
template <class Tr>
class basic_ostream<char, Tr> : public basic_ios<char, Tr>
{
public:
basic_ostream(streambuf * p) : basic_ios<char,Tr> (p) {}
};
} // namespace std
namespace boost {
namespace io {
// ** CompatTraits gcc2.95 specialisations ----------------------------
template<class Ch>
class CompatTraits< ::std::string_char_traits<Ch> >
: public ::std::string_char_traits<Ch>
{
public:
typedef CompatTraits compatible_type;
typedef Ch char_type;
typedef int int_type;
typedef ::std::streampos pos_type;
typedef ::std::streamoff off_type;
static char_type
to_char_type(const int_type& meta) {
return static_cast<char_type>(meta); }
static int_type
to_int_type(const char_type& ch) {
return static_cast<int_type>(static_cast<unsigned char>(ch) );}
static bool
eq_int_type(const int_type& left, const int_type& right) {
return left == right; }
static int_type
eof() {
return static_cast<int_type>(EOF);
}
static int_type
not_eof(const int_type& meta) {
return (meta == eof()) ? 0 : meta;
}
};
template<class Ch>
class CompatTraits< ::std::char_traits<Ch> > {
public:
typedef CompatTraits< ::std::string_char_traits<Ch> > compatible_type;
};
// ** CompatAlloc gcc-2.95 specialisations ---------------------------
template<>
class CompatAlloc< ::std::alloc>
{
public:
typedef ::std::allocator<char> compatible_type;
};
} // N.S. io
} // N.S. boost
#endif // include guard
#endif // if workaround

View File

@ -1,36 +0,0 @@
// ----------------------------------------------------------------------------
// workarounds_stlport.hpp : workaround STLport issues
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_MACROS_STLPORT_HPP
#define BOOST_MACROS_STLPORT_HPP
// *** This should go to "boost/config/stdlib/stlport.hpp".
// If the streams are not native and there are problems with using templates
// accross namespaces, we define some macros to enable a workaround for this.
// STLport 4.5
#if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE)
# define BOOST_IO_STD
# define BOOST_IO_NEEDS_USING_DECLARATION
#endif
// STLport 4.0
#if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_OWN_NAMESPACE) && defined(BOOST_NO_USING_TEMPLATE)
# define BOOST_IO_STD
# define BOOST_IO_NEEDS_USING_DECLARATION
#endif
// ----------------------------------------------------------------------------
#endif // BOOST_MACROS_STLPORT_HPP

View File

@ -1,103 +0,0 @@
// ----------------------------------------------------------------------------
// boost/format/exceptions.hpp
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
//
// See http://www.boost.org/libs/format/ for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_EXCEPTIONS_HPP
#define BOOST_FORMAT_EXCEPTIONS_HPP
#include <stdexcept>
namespace boost {
namespace io {
// **** exceptions -----------------------------------------------
class format_error : public std::exception
{
public:
format_error() {}
virtual const char *what() const throw() {
return "boost::format_error: "
"format generic failure";
}
};
class bad_format_string : public format_error
{
std::size_t pos_, next_;
public:
bad_format_string(std::size_t pos, std::size_t size)
: pos_(pos), next_(size) {}
std::size_t get_pos() const { return pos_; }
std::size_t get_next() const { return next_; }
virtual const char *what() const throw() {
return "boost::bad_format_string: format-string is ill-formed";
}
};
class too_few_args : public format_error
{
std::size_t cur_, expected_;
public:
too_few_args(std::size_t cur, std::size_t expected)
: cur_(cur), expected_(expected) {}
std::size_t get_cur() const { return cur_; }
std::size_t get_expected() const { return expected_; }
virtual const char *what() const throw() {
return "boost::too_few_args: "
"format-string referred to more arguments than were passed";
}
};
class too_many_args : public format_error
{
std::size_t cur_, expected_;
public:
too_many_args(std::size_t cur, std::size_t expected)
: cur_(cur), expected_(expected) {}
std::size_t get_cur() const { return cur_; }
std::size_t get_expected() const { return expected_; }
virtual const char *what() const throw() {
return "boost::too_many_args: "
"format-string referred to fewer arguments than were passed";
}
};
class out_of_range : public format_error
{
int index_, beg_, end_; // range is [ beg, end [
public:
out_of_range(int index, int beg, int end)
: index_(index), beg_(beg), end_(end) {}
int get_index() const { return index_; }
int get_beg() const { return beg_; }
int get_end() const { return end_; }
virtual const char *what() const throw() {
return "boost::out_of_range: "
"tried to refer to an argument (or item) number which"
" is out of range, according to the format string";
}
};
} // namespace io
} // namespace boost
#endif // BOOST_FORMAT_EXCEPTIONS_HPP

View File

@ -1,319 +0,0 @@
// ----------------------------------------------------------------------------
// feed_args.hpp : functions for processing each argument
// (feed, feed_manip, and distribute)
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_FEED_ARGS_HPP
#define BOOST_FORMAT_FEED_ARGS_HPP
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <boost/format/format_class.hpp>
#include <boost/format/group.hpp>
#include <boost/format/detail/msvc_disambiguater.hpp>
namespace boost {
namespace io {
namespace detail {
template<class Ch, class Tr, class Alloc>
void mk_str( std::basic_string<Ch,Tr, Alloc> & res,
const Ch * beg,
typename std::basic_string<Ch,Tr,Alloc>::size_type size,
std::streamsize w,
const Ch fill_char,
std::ios_base::fmtflags f,
const Ch prefix_space, // 0 if no space-padding
bool center)
// applies centered/left/right padding to the string [beg, beg+size[
// Effects : the result is placed in res.
{
typedef typename std::basic_string<Ch,Tr,Alloc>::size_type size_type;
res.resize(0);
if(w<=0 || static_cast<size_type>(w) <=size) {
// no need to pad.
res.reserve(size + !!prefix_space);
if(prefix_space)
res.append(1, prefix_space);
if (size)
res.append(beg, size);
}
else {
std::streamsize n=static_cast<std::streamsize>(w-size-!!prefix_space);
std::streamsize n_after = 0, n_before = 0;
res.reserve(static_cast<size_type>(w)); // allocate once for the 2 inserts
if(center)
n_after = n/2, n_before = n - n_after;
else
if(f & std::ios_base::left)
n_after = n;
else
n_before = n;
// now make the res string :
if(n_before) res.append(static_cast<size_type>(n_before), fill_char);
if(prefix_space)
res.append(1, prefix_space);
if (size)
res.append(beg, size);
if(n_after) res.append(static_cast<size_type>(n_after), fill_char);
}
} // -mk_str(..)
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// __DECCXX needs to be tricked to disambiguate this simple overload..
// the trick is in "boost/format/msvc_disambiguater.hpp"
template< class Ch, class Tr, class T> inline
void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
disambiguater<Ch, Tr, T>::put_head(os, x, 1L);
}
template< class Ch, class Tr, class T> inline
void put_last (BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
disambiguater<Ch, Tr, T>::put_last(os, x, 1L);
}
#else
template< class Ch, class Tr, class T> inline
void put_head (BOOST_IO_STD basic_ostream<Ch, Tr> &, const T& ) {
}
template< class Ch, class Tr, class T> inline
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const group1<T>& x ) {
os << group_head(x.a1_); // send the first N-1 items, not the last
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const T& x ) {
os << x ;
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const group1<T>& x ) {
os << group_last(x.a1_); // this selects the last element
}
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
template< class Ch, class Tr, class T> inline
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> &, T& ) {
}
template< class Ch, class Tr, class T> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, T& x) {
os << x ;
}
#endif
#endif // -__DECCXX workaround
template< class Ch, class Tr, class T>
void call_put_head(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x) {
put_head(os, *(typename ::boost::remove_reference<T>::type*)x);
}
template< class Ch, class Tr, class T>
void call_put_last(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x) {
put_last(os, *(T*)x);
}
template< class Ch, class Tr>
struct put_holder {
template<class T>
put_holder(T& t)
: arg(&t),
put_head(&call_put_head<Ch, Tr, T>),
put_last(&call_put_last<Ch, Tr, T>)
{}
const void* arg;
void (*put_head)(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x);
void (*put_last)(BOOST_IO_STD basic_ostream<Ch, Tr> & os, const void* x);
};
template< class Ch, class Tr> inline
void put_head( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const put_holder<Ch, Tr>& t) {
t.put_head(os, t.arg);
}
template< class Ch, class Tr> inline
void put_last( BOOST_IO_STD basic_ostream<Ch, Tr> & os, const put_holder<Ch, Tr>& t) {
t.put_last(os, t.arg);
}
template< class Ch, class Tr, class Alloc, class T>
void put( T x,
const format_item<Ch, Tr, Alloc>& specs,
typename basic_format<Ch, Tr, Alloc>::string_type& res,
typename basic_format<Ch, Tr, Alloc>::internal_streambuf_t & buf,
io::detail::locale_t *loc_p = NULL)
{
#ifdef BOOST_MSVC
// If std::min<unsigned> or std::max<unsigned> are already instantiated
// at this point then we get a blizzard of warning messages when we call
// those templates with std::size_t as arguments. Weird and very annoyning...
#pragma warning(push)
#pragma warning(disable:4267)
#endif
// does the actual conversion of x, with given params, into a string
// using the supplied stringbuf.
typedef typename basic_format<Ch, Tr, Alloc>::string_type string_type;
typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t;
typedef typename string_type::size_type size_type;
basic_oaltstringstream<Ch, Tr, Alloc> oss( &buf);
if(loc_p != NULL)
oss.imbue(*loc_p);
specs.fmtstate_.apply_on(oss, loc_p);
// the stream format state can be modified by manipulators in the argument :
put_head( oss, x );
// in case x is a group, apply the manip part of it,
// in order to find width
const std::ios_base::fmtflags fl=oss.flags();
const bool internal = (fl & std::ios_base::internal) != 0;
const std::streamsize w = oss.width();
const bool two_stepped_padding= internal && (w!=0);
res.resize(0);
if(! two_stepped_padding) {
if(w>0) // handle padding via mk_str, not natively in stream
oss.width(0);
put_last( oss, x);
const Ch * res_beg = buf.pbase();
Ch prefix_space = 0;
if(specs.pad_scheme_ & format_item_t::spacepad)
if(buf.pcount()== 0 ||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
prefix_space = oss.widen(' ');
size_type res_size = (std::min)(
static_cast<size_type>(specs.truncate_ - !!prefix_space),
buf.pcount() );
mk_str(res, res_beg, res_size, w, oss.fill(), fl,
prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 );
}
else { // 2-stepped padding
// internal can be implied by zeropad, or user-set.
// left, right, and centered alignment overrule internal,
// but spacepad or truncate might be mixed with internal (using manipulator)
put_last( oss, x); // may pad
const Ch * res_beg = buf.pbase();
size_type res_size = buf.pcount();
bool prefix_space=false;
if(specs.pad_scheme_ & format_item_t::spacepad)
if(buf.pcount()== 0 ||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
prefix_space = true;
if(res_size == static_cast<size_type>(w) && w<=specs.truncate_ && !prefix_space) {
// okay, only one thing was printed and padded, so res is fine
res.assign(res_beg, res_size);
}
else { // length w exceeded
// either it was multi-output with first output padding up all width..
// either it was one big arg and we are fine.
// Note that res_size<w is possible (in case of bad user-defined formatting)
res.assign(res_beg, res_size);
res_beg=NULL; // invalidate pointers.
// make a new stream, to start re-formatting from scratch :
buf.clear_buffer();
basic_oaltstringstream<Ch, Tr, Alloc> oss2( &buf);
specs.fmtstate_.apply_on(oss2, loc_p);
put_head( oss2, x );
oss2.width(0);
if(prefix_space)
oss2 << ' ';
put_last(oss2, x );
if(buf.pcount()==0 && specs.pad_scheme_ & format_item_t::spacepad) {
prefix_space =true;
oss2 << ' ';
}
// we now have the minimal-length output
const Ch * tmp_beg = buf.pbase();
size_type tmp_size = (std::min)(static_cast<size_type>(specs.truncate_),
buf.pcount() );
if(static_cast<size_type>(w) <= tmp_size) {
// minimal length is already >= w, so no padding (cool!)
res.assign(tmp_beg, tmp_size);
}
else { // hum.. we need to pad (multi_output, or spacepad present)
//find where we should pad
size_type sz = (std::min)(res_size + (prefix_space ? 1 : 0), tmp_size);
size_type i = prefix_space;
for(; i<sz && tmp_beg[i] == res[i - (prefix_space ? 1 : 0)]; ++i) {}
if(i>=tmp_size) i=prefix_space;
res.assign(tmp_beg, i);
std::streamsize d = w - static_cast<std::streamsize>(tmp_size);
BOOST_ASSERT(d>0);
res.append(static_cast<size_type>( d ), oss2.fill());
res.append(tmp_beg+i, tmp_size-i);
BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0)
== static_cast<size_type>(w));
BOOST_ASSERT(res.size() == static_cast<size_type>(w));
}
}
}
buf.clear_buffer();
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
} // end- put(..)
template< class Ch, class Tr, class Alloc, class T>
void distribute (basic_format<Ch,Tr, Alloc>& self, T x) {
// call put(x, ..) on every occurrence of the current argument :
if(self.cur_arg_ >= self.num_args_) {
if( self.exceptions() & too_many_args_bit )
boost::throw_exception(too_many_args(self.cur_arg_, self.num_args_));
else return;
}
for(unsigned long i=0; i < self.items_.size(); ++i) {
if(self.items_[i].argN_ == self.cur_arg_) {
put<Ch, Tr, Alloc, T> (x, self.items_[i], self.items_[i].res_,
self.buf_, boost::get_pointer(self.loc_) );
}
}
}
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
feed_impl (basic_format<Ch,Tr, Alloc>& self, T x) {
if(self.dumped_) self.clear();
distribute<Ch, Tr, Alloc, T> (self, x);
++self.cur_arg_;
if(self.bound_.size() != 0) {
while( self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_] )
++self.cur_arg_;
}
return self;
}
template<class Ch, class Tr, class Alloc, class T> inline
basic_format<Ch, Tr, Alloc>&
feed (basic_format<Ch,Tr, Alloc>& self, T x) {
return feed_impl<Ch, Tr, Alloc, const put_holder<Ch, Tr>&>(self, put_holder<Ch, Tr>(x));
}
} // namespace detail
} // namespace io
} // namespace boost
#endif // BOOST_FORMAT_FEED_ARGS_HPP

View File

@ -1,168 +0,0 @@
// ----------------------------------------------------------------------------
// format_class.hpp : class interface
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_CLASS_HPP
#define BOOST_FORMAT_CLASS_HPP
#include <vector>
#include <string>
#include <boost/optional.hpp> // to store locale when needed
#include <boost/format/format_fwd.hpp>
#include <boost/format/internals_fwd.hpp>
#include <boost/format/internals.hpp>
#include <boost/format/alt_sstream.hpp>
namespace boost {
template<class Ch, class Tr, class Alloc>
class basic_format
{
typedef typename io::CompatTraits<Tr>::compatible_type compat_traits;
public:
typedef Ch CharT; // borland fails in operator% if we use Ch and Tr directly
typedef std::basic_string<Ch, Tr, Alloc> string_type;
typedef typename string_type::size_type size_type;
typedef io::detail::format_item<Ch, Tr, Alloc> format_item_t;
typedef io::basic_altstringbuf<Ch, Tr, Alloc> internal_streambuf_t;
explicit basic_format(const Ch* str=NULL);
explicit basic_format(const string_type& s);
basic_format(const basic_format& x);
basic_format& operator= (const basic_format& x);
void swap(basic_format& x);
#if !defined(BOOST_NO_STD_LOCALE)
explicit basic_format(const Ch* str, const std::locale & loc);
explicit basic_format(const string_type& s, const std::locale & loc);
#endif
io::detail::locale_t getloc() const;
basic_format& clear(); // empty all converted string buffers (except bound items)
basic_format& clear_binds(); // unbind all bound items, and call clear()
basic_format& parse(const string_type&); // resets buffers and parse a new format string
// ** formatted result ** //
size_type size() const; // sum of the current string pieces sizes
string_type str() const; // final string
// ** arguments passing ** //
template<class T>
basic_format& operator%(const T& x)
{ return io::detail::feed<CharT, Tr, Alloc, const T&>(*this,x); }
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
template<class T> basic_format& operator%(T& x)
{ return io::detail::feed<CharT, Tr, Alloc, T&>(*this,x); }
#endif
#if defined(__GNUC__)
// GCC can't handle anonymous enums without some help
// ** arguments passing ** //
basic_format& operator%(const int& x)
{ return io::detail::feed<CharT, Tr, Alloc, const int&>(*this,x); }
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
basic_format& operator%(int& x)
{ return io::detail::feed<CharT, Tr, Alloc, int&>(*this,x); }
#endif
#endif
// The total number of arguments expected to be passed to the format objectt
int expected_args() const
{ return num_args_; }
// The number of arguments currently bound (see bind_arg(..) )
int bound_args() const;
// The number of arguments currently fed to the format object
int fed_args() const;
// The index (1-based) of the current argument (i.e. next to be formatted)
int cur_arg() const;
// The number of arguments still required to be fed
int remaining_args() const; // same as expected_args() - bound_args() - fed_args()
// ** object modifying **//
template<class T>
basic_format& bind_arg(int argN, const T& val)
{ return io::detail::bind_arg_body(*this, argN, val); }
basic_format& clear_bind(int argN);
template<class T>
basic_format& modify_item(int itemN, T manipulator)
{ return io::detail::modify_item_body<Ch,Tr, Alloc, T> (*this, itemN, manipulator);}
// Choosing which errors will throw exceptions :
unsigned char exceptions() const;
unsigned char exceptions(unsigned char newexcept);
#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) \
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \
&& !BOOST_WORKAROUND( _CRAYC, != 0) \
&& !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// use friend templates and private members only if supported
#ifndef BOOST_NO_TEMPLATE_STD_STREAM
template<class Ch2, class Tr2, class Alloc2>
friend std::basic_ostream<Ch2, Tr2> &
operator<<( std::basic_ostream<Ch2, Tr2> & ,
const basic_format<Ch2, Tr2, Alloc2>& );
#else
template<class Ch2, class Tr2, class Alloc2>
friend std::ostream &
operator<<( std::ostream & ,
const basic_format<Ch2, Tr2, Alloc2>& );
#endif
template<class Ch2, class Tr2, class Alloc2, class T>
friend basic_format<Ch2, Tr2, Alloc2>&
io::detail::feed_impl (basic_format<Ch2, Tr2, Alloc2>&, T);
template<class Ch2, class Tr2, class Alloc2, class T> friend
void io::detail::distribute (basic_format<Ch2, Tr2, Alloc2>&, T);
template<class Ch2, class Tr2, class Alloc2, class T> friend
basic_format<Ch2, Tr2, Alloc2>&
io::detail::modify_item_body (basic_format<Ch2, Tr2, Alloc2>&, int, T);
template<class Ch2, class Tr2, class Alloc2, class T> friend
basic_format<Ch2, Tr2, Alloc2>&
io::detail::bind_arg_body (basic_format<Ch2, Tr2, Alloc2>&, int, const T&);
private:
#endif
typedef io::detail::stream_format_state<Ch, Tr> stream_format_state;
// flag bits, used for style_
enum style_values { ordered = 1, // set only if all directives are positional
special_needs = 4 };
void make_or_reuse_data(std::size_t nbitems);// used for (re-)initialisation
// member data --------------------------------------------//
std::vector<format_item_t> items_; // each '%..' directive leads to a format_item
std::vector<bool> bound_; // stores which arguments were bound. size() == 0 || num_args
int style_; // style of format-string : positional or not, etc
int cur_arg_; // keep track of wich argument is current
int num_args_; // number of expected arguments
mutable bool dumped_; // true only after call to str() or <<
string_type prefix_; // piece of string to insert before first item
unsigned char exceptions_;
internal_streambuf_t buf_; // the internal stream buffer.
boost::optional<io::detail::locale_t> loc_;
}; // class basic_format
} // namespace boost
#endif // BOOST_FORMAT_CLASS_HPP

View File

@ -1,43 +0,0 @@
// ----------------------------------------------------------------------------
// format_fwd.hpp : forward declarations
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_FWD_HPP
#define BOOST_FORMAT_FWD_HPP
#include <string>
#include <iosfwd>
#include <boost/format/detail/compat_workarounds.hpp>
namespace boost {
template <class Ch,
class Tr = BOOST_IO_STD char_traits<Ch>, class Alloc = std::allocator<Ch> >
class basic_format;
typedef basic_format<char > format;
#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF)
typedef basic_format<wchar_t > wformat;
#endif
namespace io {
enum format_error_bits { bad_format_string_bit = 1,
too_few_args_bit = 2, too_many_args_bit = 4,
out_of_range_bit = 8,
all_error_bits = 255, no_error_bits=0 };
} // namespace io
} // namespace boost
#endif // BOOST_FORMAT_FWD_HPP

View File

@ -1,329 +0,0 @@
// ----------------------------------------------------------------------------
// format_implementation.hpp Implementation of the basic_format class
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_IMPLEMENTATION_HPP
#define BOOST_FORMAT_IMPLEMENTATION_HPP
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/assert.hpp>
#include <boost/format/format_class.hpp>
#include <algorithm> // std::swap
namespace boost {
// --- basic_format implementation -----------------------------------------//
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
{
if( s)
parse( s );
}
#if !defined(BOOST_NO_STD_LOCALE)
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const Ch* s, const std::locale & loc)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits), loc_(loc)
{
if(s) parse( s );
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s, const std::locale & loc)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits), loc_(loc)
{
parse(s);
}
#endif // ! BOOST_NO_STD_LOCALE
template< class Ch, class Tr, class Alloc>
io::detail::locale_t basic_format<Ch, Tr, Alloc>::
getloc() const {
return loc_ ? loc_.get() : io::detail::locale_t();
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>:: basic_format(const string_type& s)
: style_(0), cur_arg_(0), num_args_(0), dumped_(false),
exceptions_(io::all_error_bits)
{
parse(s);
}
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>:: basic_format(const basic_format& x)
: items_(x.items_), bound_(x.bound_), style_(x.style_),
cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(x.dumped_),
prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_)
{
}
template< class Ch, class Tr, class Alloc> // just don't copy the buf_ member
basic_format<Ch, Tr, Alloc>& basic_format<Ch, Tr, Alloc>::
operator= (const basic_format& x) {
if(this == &x)
return *this;
(basic_format<Ch, Tr, Alloc>(x)).swap(*this);
return *this;
}
template< class Ch, class Tr, class Alloc>
void basic_format<Ch, Tr, Alloc>::
swap (basic_format & x) {
std::swap(exceptions_, x.exceptions_);
std::swap(style_, x.style_);
std::swap(cur_arg_, x.cur_arg_);
std::swap(num_args_, x.num_args_);
std::swap(dumped_, x.dumped_);
items_.swap(x.items_);
prefix_.swap(x.prefix_);
bound_.swap(x.bound_);
}
template< class Ch, class Tr, class Alloc>
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions() const {
return exceptions_;
}
template< class Ch, class Tr, class Alloc>
unsigned char basic_format<Ch,Tr, Alloc>:: exceptions(unsigned char newexcept) {
unsigned char swp = exceptions_;
exceptions_ = newexcept;
return swp;
}
template<class Ch, class Tr, class Alloc>
void basic_format<Ch, Tr, Alloc>::
make_or_reuse_data (std::size_t nbitems) {
#if !defined(BOOST_NO_STD_LOCALE)
Ch fill = ( BOOST_USE_FACET(std::ctype<Ch>, getloc()) ). widen(' ');
#else
Ch fill = ' ';
#endif
if(items_.size() == 0)
items_.assign( nbitems, format_item_t(fill) );
else {
if(nbitems>items_.size())
items_.resize(nbitems, format_item_t(fill));
bound_.resize(0);
for(std::size_t i=0; i < nbitems; ++i)
items_[i].reset(fill); // strings are resized, instead of reallocated
}
prefix_.resize(0);
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear () {
// empty the string buffers (except bound arguments)
// and make the format object ready for formatting a new set of arguments
BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast<int>(bound_.size()) );
for(unsigned long i=0; i<items_.size(); ++i) {
// clear converted strings only if the corresponding argument is not bound :
if( bound_.size()==0 || items_[i].argN_<0 || !bound_[ items_[i].argN_ ] )
items_[i].res_.resize(0);
}
cur_arg_=0; dumped_=false;
// maybe first arg is bound:
if(bound_.size() != 0) {
for(; cur_arg_ < num_args_ && bound_[cur_arg_]; ++cur_arg_)
{}
}
return *this;
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear_binds () {
// remove all binds, then clear()
bound_.resize(0);
clear();
return *this;
}
template< class Ch, class Tr, class Alloc>
basic_format<Ch,Tr, Alloc>& basic_format<Ch,Tr, Alloc>::
clear_bind (int argN) {
// remove the bind of ONE argument then clear()
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] ) {
if( exceptions() & io::out_of_range_bit)
boost::throw_exception(io::out_of_range(argN, 1, num_args_+1 ) );
else return *this;
}
bound_[argN-1]=false;
clear();
return *this;
}
template< class Ch, class Tr, class Alloc>
int basic_format<Ch,Tr, Alloc>::
bound_args() const {
if(bound_.size()==0)
return 0;
int n=0;
for(int i=0; i<num_args_ ; ++i)
if(bound_[i])
++n;
return n;
}
template< class Ch, class Tr, class Alloc>
int basic_format<Ch,Tr, Alloc>::
fed_args() const {
if(bound_.size()==0)
return cur_arg_;
int n=0;
for(int i=0; i<cur_arg_ ; ++i)
if(!bound_[i])
++n;
return n;
}
template< class Ch, class Tr, class Alloc>
int basic_format<Ch,Tr, Alloc>::
cur_arg() const {
return cur_arg_+1; }
template< class Ch, class Tr, class Alloc>
int basic_format<Ch,Tr, Alloc>::
remaining_args() const {
if(bound_.size()==0)
return num_args_-cur_arg_;
int n=0;
for(int i=cur_arg_; i<num_args_ ; ++i)
if(!bound_[i])
++n;
return n;
}
template< class Ch, class Tr, class Alloc>
typename basic_format<Ch, Tr, Alloc>::string_type
basic_format<Ch,Tr, Alloc>::
str () const {
if(items_.size()==0)
return prefix_;
if( cur_arg_ < num_args_)
if( exceptions() & io::too_few_args_bit )
// not enough variables supplied
boost::throw_exception(io::too_few_args(cur_arg_, num_args_));
unsigned long i;
string_type res;
res.reserve(size());
res += prefix_;
for(i=0; i < items_.size(); ++i) {
const format_item_t& item = items_[i];
res += item.res_;
if( item.argN_ == format_item_t::argN_tabulation) {
BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation);
if( static_cast<size_type>(item.fmtstate_.width_) > res.size() )
res.append( static_cast<size_type>(item.fmtstate_.width_) - res.size(),
item.fmtstate_.fill_ );
}
res += item.appendix_;
}
dumped_=true;
return res;
}
template< class Ch, class Tr, class Alloc>
typename std::basic_string<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr, Alloc>::
size () const {
#ifdef BOOST_MSVC
// If std::min<unsigned> or std::max<unsigned> are already instantiated
// at this point then we get a blizzard of warning messages when we call
// those templates with std::size_t as arguments. Weird and very annoyning...
#pragma warning(push)
#pragma warning(disable:4267)
#endif
BOOST_USING_STD_MAX();
size_type sz = prefix_.size();
unsigned long i;
for(i=0; i < items_.size(); ++i) {
const format_item_t& item = items_[i];
sz += item.res_.size();
if( item.argN_ == format_item_t::argN_tabulation)
sz = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz,
static_cast<size_type>(item.fmtstate_.width_) );
sz += item.appendix_.size();
}
return sz;
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
}
namespace io {
namespace detail {
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
bind_arg_body (basic_format<Ch, Tr, Alloc>& self, int argN, const T& val) {
// bind one argument to a fixed value
// this is persistent over clear() calls, thus also over str() and <<
if(self.dumped_)
self.clear(); // needed because we will modify cur_arg_
if(argN<1 || argN > self.num_args_) {
if( self.exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range(argN, 1, self.num_args_+1 ) );
else return self;
}
if(self.bound_.size()==0)
self.bound_.assign(self.num_args_,false);
else
BOOST_ASSERT( self.num_args_ == static_cast<signed int>(self.bound_.size()) );
int o_cur_arg = self.cur_arg_;
self.cur_arg_ = argN-1; // arrays begin at 0
self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets..
self.operator%(val); // put val at the right place, because cur_arg is set
// Now re-position cur_arg before leaving :
self.cur_arg_ = o_cur_arg;
self.bound_[argN-1]=true;
if(self.cur_arg_ == argN-1 ) {
// hum, now this arg is bound, so move to next free arg
while(self.cur_arg_ < self.num_args_ && self.bound_[self.cur_arg_])
++self.cur_arg_;
}
// In any case, we either have all args, or are on an unbound arg :
BOOST_ASSERT( self.cur_arg_ >= self.num_args_ || ! self.bound_[self.cur_arg_]);
return self;
}
template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>&
modify_item_body (basic_format<Ch, Tr, Alloc>& self, int itemN, T manipulator) {
// applies a manipulator to the format_item describing a given directive.
// this is a permanent change, clear or reset won't cancel that.
if(itemN<1 || itemN > static_cast<signed int>(self.items_.size() )) {
if( self.exceptions() & io::out_of_range_bit )
boost::throw_exception(io::out_of_range(itemN, 1, static_cast<int>(self.items_.size()) ));
else return self;
}
self.items_[itemN-1].fmtstate_. template apply_manip<T> ( manipulator );
return self;
}
} // namespace detail
} // namespace io
} // namespace boost
#endif // BOOST_FORMAT_IMPLEMENTATION_HPP

View File

@ -1,70 +0,0 @@
// ----------------------------------------------------------------------------
// free_funcs.hpp : implementation of the free functions of boost::format
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_FUNCS_HPP
#define BOOST_FORMAT_FUNCS_HPP
#include <boost/format/format_class.hpp>
#include <boost/throw_exception.hpp>
namespace boost {
template<class Ch, class Tr, class Alloc> inline
std::basic_string<Ch, Tr, Alloc> str(const basic_format<Ch, Tr, Alloc>& f) {
// adds up all pieces of strings and converted items, and return the formatted string
return f.str();
}
namespace io {
using ::boost::str; // keep compatibility with when it was defined in this N.S.
} // - namespace io
#ifndef BOOST_NO_TEMPLATE_STD_STREAM
template<class Ch, class Tr, class Alloc>
std::basic_ostream<Ch, Tr> &
operator<<( std::basic_ostream<Ch, Tr> & os,
const basic_format<Ch, Tr, Alloc>& f)
#else
template<class Ch, class Tr, class Alloc>
std::ostream &
operator<<( std::ostream & os,
const basic_format<Ch, Tr, Alloc>& f)
#endif
// effect: "return os << str(f);" but we can do it faster
{
typedef boost::basic_format<Ch, Tr, Alloc> format_t;
if(f.items_.size()==0)
os << f.prefix_;
else {
if(f.cur_arg_ < f.num_args_)
if( f.exceptions() & io::too_few_args_bit )
// not enough variables supplied
boost::throw_exception(io::too_few_args(f.cur_arg_, f.num_args_));
if(f.style_ & format_t::special_needs)
os << f.str();
else {
// else we dont have to count chars output, so we dump directly to os :
os << f.prefix_;
for(unsigned long i=0; i<f.items_.size(); ++i) {
const typename format_t::format_item_t& item = f.items_[i];
os << item.res_;
os << item.appendix_;
}
}
}
f.dumped_=true;
return os;
}
} // namespace boost
#endif // BOOST_FORMAT_FUNCS_HPP

View File

@ -1,684 +0,0 @@
// ----------------------------------------------------------------------------
// group.hpp : encapsulates a group of manipulators along with an argument
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
// group_head : cut the last element of a group out.
// (is overloaded below on each type of group)
// group_last : returns the last element of a group
// (is overloaded below on each type of group)
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_GROUP_HPP
#define BOOST_FORMAT_GROUP_HPP
#include <boost/config.hpp>
namespace boost {
namespace io {
namespace detail {
// empty group, but useful even though.
struct group0
{
group0() {}
};
template <class Ch, class Tr>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << ( BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group0& )
{
return os;
}
template <class T1>
struct group1
{
T1 a1_;
group1(T1 a1)
: a1_(a1)
{}
private:
group1& operator=(const group1&);
};
template <class Ch, class Tr, class T1>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group1<T1>& x)
{
os << x.a1_;
return os;
}
template <class T1,class T2>
struct group2
{
T1 a1_;
T2 a2_;
group2(T1 a1,T2 a2)
: a1_(a1),a2_(a2)
{}
private:
group2& operator=(const group2&);
};
template <class Ch, class Tr, class T1,class T2>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group2<T1,T2>& x)
{
os << x.a1_<< x.a2_;
return os;
}
template <class T1,class T2,class T3>
struct group3
{
T1 a1_;
T2 a2_;
T3 a3_;
group3(T1 a1,T2 a2,T3 a3)
: a1_(a1),a2_(a2),a3_(a3)
{}
private:
group3& operator=(const group3&);
};
template <class Ch, class Tr, class T1,class T2,class T3>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group3<T1,T2,T3>& x)
{
os << x.a1_<< x.a2_<< x.a3_;
return os;
}
template <class T1,class T2,class T3,class T4>
struct group4
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
group4(T1 a1,T2 a2,T3 a3,T4 a4)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4)
{}
private:
group4& operator=(const group4&);
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group4<T1,T2,T3,T4>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_;
return os;
}
template <class T1,class T2,class T3,class T4,class T5>
struct group5
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
T5 a5_;
group5(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5)
{}
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group5<T1,T2,T3,T4,T5>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_;
return os;
}
template <class T1,class T2,class T3,class T4,class T5,class T6>
struct group6
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
T5 a5_;
T6 a6_;
group6(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6)
{}
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group6<T1,T2,T3,T4,T5,T6>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_;
return os;
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7>
struct group7
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
T5 a5_;
T6 a6_;
T7 a7_;
group7(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7)
{}
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group7<T1,T2,T3,T4,T5,T6,T7>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_;
return os;
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
struct group8
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
T5 a5_;
T6 a6_;
T7 a7_;
T8 a8_;
group8(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8)
{}
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group8<T1,T2,T3,T4,T5,T6,T7,T8>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_;
return os;
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
struct group9
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
T5 a5_;
T6 a6_;
T7 a7_;
T8 a8_;
T9 a9_;
group9(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9)
{}
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group9<T1,T2,T3,T4,T5,T6,T7,T8,T9>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_;
return os;
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
struct group10
{
T1 a1_;
T2 a2_;
T3 a3_;
T4 a4_;
T5 a5_;
T6 a6_;
T7 a7_;
T8 a8_;
T9 a9_;
T10 a10_;
group10(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9,T10 a10)
: a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9),a10_(a10)
{}
};
template <class Ch, class Tr, class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>& x)
{
os << x.a1_<< x.a2_<< x.a3_<< x.a4_<< x.a5_<< x.a6_<< x.a7_<< x.a8_<< x.a9_<< x.a10_;
return os;
}
template <class T1,class T2>
inline
group1<T1>
group_head( group2<T1,T2> const& x)
{
return group1<T1> (x.a1_);
}
template <class T1,class T2>
inline
group1<T2>
group_last( group2<T1,T2> const& x)
{
return group1<T2> (x.a2_);
}
template <class T1,class T2,class T3>
inline
group2<T1,T2>
group_head( group3<T1,T2,T3> const& x)
{
return group2<T1,T2> (x.a1_,x.a2_);
}
template <class T1,class T2,class T3>
inline
group1<T3>
group_last( group3<T1,T2,T3> const& x)
{
return group1<T3> (x.a3_);
}
template <class T1,class T2,class T3,class T4>
inline
group3<T1,T2,T3>
group_head( group4<T1,T2,T3,T4> const& x)
{
return group3<T1,T2,T3> (x.a1_,x.a2_,x.a3_);
}
template <class T1,class T2,class T3,class T4>
inline
group1<T4>
group_last( group4<T1,T2,T3,T4> const& x)
{
return group1<T4> (x.a4_);
}
template <class T1,class T2,class T3,class T4,class T5>
inline
group4<T1,T2,T3,T4>
group_head( group5<T1,T2,T3,T4,T5> const& x)
{
return group4<T1,T2,T3,T4> (x.a1_,x.a2_,x.a3_,x.a4_);
}
template <class T1,class T2,class T3,class T4,class T5>
inline
group1<T5>
group_last( group5<T1,T2,T3,T4,T5> const& x)
{
return group1<T5> (x.a5_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6>
inline
group5<T1,T2,T3,T4,T5>
group_head( group6<T1,T2,T3,T4,T5,T6> const& x)
{
return group5<T1,T2,T3,T4,T5> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6>
inline
group1<T6>
group_last( group6<T1,T2,T3,T4,T5,T6> const& x)
{
return group1<T6> (x.a6_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7>
inline
group6<T1,T2,T3,T4,T5,T6>
group_head( group7<T1,T2,T3,T4,T5,T6,T7> const& x)
{
return group6<T1,T2,T3,T4,T5,T6> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7>
inline
group1<T7>
group_last( group7<T1,T2,T3,T4,T5,T6,T7> const& x)
{
return group1<T7> (x.a7_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
inline
group7<T1,T2,T3,T4,T5,T6,T7>
group_head( group8<T1,T2,T3,T4,T5,T6,T7,T8> const& x)
{
return group7<T1,T2,T3,T4,T5,T6,T7> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
inline
group1<T8>
group_last( group8<T1,T2,T3,T4,T5,T6,T7,T8> const& x)
{
return group1<T8> (x.a8_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
inline
group8<T1,T2,T3,T4,T5,T6,T7,T8>
group_head( group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> const& x)
{
return group8<T1,T2,T3,T4,T5,T6,T7,T8> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_,x.a8_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
inline
group1<T9>
group_last( group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> const& x)
{
return group1<T9> (x.a9_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
inline
group9<T1,T2,T3,T4,T5,T6,T7,T8,T9>
group_head( group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> const& x)
{
return group9<T1,T2,T3,T4,T5,T6,T7,T8,T9> (x.a1_,x.a2_,x.a3_,x.a4_,x.a5_,x.a6_,x.a7_,x.a8_,x.a9_);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
inline
group1<T10>
group_last( group10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> const& x)
{
return group1<T10> (x.a10_);
}
} // namespace detail
// helper functions
inline detail::group1< detail::group0 >
group() { return detail::group1< detail::group0 > ( detail::group0() ); }
template <class T1, class Var>
inline
detail::group1< detail::group2<T1, Var const&> >
group(T1 a1, Var const& var)
{
return detail::group1< detail::group2<T1, Var const&> >
( detail::group2<T1, Var const&>
(a1, var)
);
}
template <class T1,class T2, class Var>
inline
detail::group1< detail::group3<T1,T2, Var const&> >
group(T1 a1,T2 a2, Var const& var)
{
return detail::group1< detail::group3<T1,T2, Var const&> >
( detail::group3<T1,T2, Var const&>
(a1,a2, var)
);
}
template <class T1,class T2,class T3, class Var>
inline
detail::group1< detail::group4<T1,T2,T3, Var const&> >
group(T1 a1,T2 a2,T3 a3, Var const& var)
{
return detail::group1< detail::group4<T1,T2,T3, Var const&> >
( detail::group4<T1,T2,T3, Var const&>
(a1,a2,a3, var)
);
}
template <class T1,class T2,class T3,class T4, class Var>
inline
detail::group1< detail::group5<T1,T2,T3,T4, Var const&> >
group(T1 a1,T2 a2,T3 a3,T4 a4, Var const& var)
{
return detail::group1< detail::group5<T1,T2,T3,T4, Var const&> >
( detail::group5<T1,T2,T3,T4, Var const&>
(a1,a2,a3,a4, var)
);
}
template <class T1,class T2,class T3,class T4,class T5, class Var>
inline
detail::group1< detail::group6<T1,T2,T3,T4,T5, Var const&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var const& var)
{
return detail::group1< detail::group6<T1,T2,T3,T4,T5, Var const&> >
( detail::group6<T1,T2,T3,T4,T5, Var const&>
(a1,a2,a3,a4,a5, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6, class Var>
inline
detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var const&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var const& var)
{
return detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var const&> >
( detail::group7<T1,T2,T3,T4,T5,T6, Var const&>
(a1,a2,a3,a4,a5,a6, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7, class Var>
inline
detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var const& var)
{
return detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&> >
( detail::group8<T1,T2,T3,T4,T5,T6,T7, Var const&>
(a1,a2,a3,a4,a5,a6,a7, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8, class Var>
inline
detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var const& var)
{
return detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&> >
( detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var const&>
(a1,a2,a3,a4,a5,a6,a7,a8, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9, class Var>
inline
detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var const& var)
{
return detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&> >
( detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var const&>
(a1,a2,a3,a4,a5,a6,a7,a8,a9, var)
);
}
#ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST
template <class T1, class Var>
inline
detail::group1< detail::group2<T1, Var&> >
group(T1 a1, Var& var)
{
return detail::group1< detail::group2<T1, Var&> >
( detail::group2<T1, Var&>
(a1, var)
);
}
template <class T1,class T2, class Var>
inline
detail::group1< detail::group3<T1,T2, Var&> >
group(T1 a1,T2 a2, Var& var)
{
return detail::group1< detail::group3<T1,T2, Var&> >
( detail::group3<T1,T2, Var&>
(a1,a2, var)
);
}
template <class T1,class T2,class T3, class Var>
inline
detail::group1< detail::group4<T1,T2,T3, Var&> >
group(T1 a1,T2 a2,T3 a3, Var& var)
{
return detail::group1< detail::group4<T1,T2,T3, Var&> >
( detail::group4<T1,T2,T3, Var&>
(a1,a2,a3, var)
);
}
template <class T1,class T2,class T3,class T4, class Var>
inline
detail::group1< detail::group5<T1,T2,T3,T4, Var&> >
group(T1 a1,T2 a2,T3 a3,T4 a4, Var& var)
{
return detail::group1< detail::group5<T1,T2,T3,T4, Var&> >
( detail::group5<T1,T2,T3,T4, Var&>
(a1,a2,a3,a4, var)
);
}
template <class T1,class T2,class T3,class T4,class T5, class Var>
inline
detail::group1< detail::group6<T1,T2,T3,T4,T5, Var&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5, Var& var)
{
return detail::group1< detail::group6<T1,T2,T3,T4,T5, Var&> >
( detail::group6<T1,T2,T3,T4,T5, Var&>
(a1,a2,a3,a4,a5, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6, class Var>
inline
detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6, Var& var)
{
return detail::group1< detail::group7<T1,T2,T3,T4,T5,T6, Var&> >
( detail::group7<T1,T2,T3,T4,T5,T6, Var&>
(a1,a2,a3,a4,a5,a6, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7, class Var>
inline
detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7, Var& var)
{
return detail::group1< detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&> >
( detail::group8<T1,T2,T3,T4,T5,T6,T7, Var&>
(a1,a2,a3,a4,a5,a6,a7, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8, class Var>
inline
detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, Var& var)
{
return detail::group1< detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&> >
( detail::group9<T1,T2,T3,T4,T5,T6,T7,T8, Var&>
(a1,a2,a3,a4,a5,a6,a7,a8, var)
);
}
template <class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9, class Var>
inline
detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> >
group(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9, Var& var)
{
return detail::group1< detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&> >
( detail::group10<T1,T2,T3,T4,T5,T6,T7,T8,T9, Var&>
(a1,a2,a3,a4,a5,a6,a7,a8,a9, var)
);
}
#endif // - BOOST_NO_OVERLOAD_FOR_NON_CONST
} // namespace io
} // namespace boost
#endif // BOOST_FORMAT_GROUP_HPP

View File

@ -1,202 +0,0 @@
// ----------------------------------------------------------------------------
// internals.hpp : internal structs : stream_format_state, format_item.
// included by format.hpp
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_INTERNALS_HPP
#define BOOST_FORMAT_INTERNALS_HPP
#include <string>
#include <boost/assert.hpp>
#include <boost/optional.hpp>
#include <boost/limits.hpp>
#include <boost/format/detail/compat_workarounds.hpp>
#include <boost/format/alt_sstream.hpp> // used as a dummy stream
namespace boost {
namespace io {
namespace detail {
//---- stream_format_state --------------------------------------------------//
// set of params that define the format state of a stream
template<class Ch, class Tr>
struct stream_format_state
{
typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
stream_format_state(Ch fill) { reset(fill); }
// stream_format_state(const basic_ios& os) { set_by_stream(os); }
void reset(Ch fill); //- sets to default state.
void set_by_stream(const basic_ios& os); //- sets to os's state.
void apply_on(basic_ios & os, //- applies format_state to the stream
boost::io::detail::locale_t * loc_default = 0) const;
template<class T>
void apply_manip(T manipulator) //- modifies state by applying manipulator
{ apply_manip_body<Ch, Tr, T>( *this, manipulator) ; }
// --- data ---
std::streamsize width_;
std::streamsize precision_;
Ch fill_;
std::ios_base::fmtflags flags_;
std::ios_base::iostate rdstate_;
std::ios_base::iostate exceptions_;
boost::optional<boost::io::detail::locale_t> loc_;
};
//---- format_item ---------------------------------------------------------//
// stores all parameters that can be specified in format strings
template<class Ch, class Tr, class Alloc>
struct format_item
{
enum pad_values { zeropad = 1, spacepad =2, centered=4, tabulation = 8 };
// 1. if zeropad is set, all other bits are not,
// 2. if tabulation is set, all others are not.
// centered and spacepad can be mixed freely.
enum arg_values { argN_no_posit = -1, // non-positional directive. will set argN later
argN_tabulation = -2, // tabulation directive. (no argument read)
argN_ignored = -3 // ignored directive. (no argument read)
};
typedef BOOST_IO_STD basic_ios<Ch, Tr> basic_ios;
typedef detail::stream_format_state<Ch, Tr> stream_format_state;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
format_item(Ch fill) :argN_(argN_no_posit), fmtstate_(fill),
truncate_(max_streamsize()), pad_scheme_(0) {}
void reset(Ch fill);
void compute_states(); // sets states according to truncate and pad_scheme.
static std::streamsize max_streamsize() {
return (std::numeric_limits<std::streamsize>::max)();
}
// --- data ---
int argN_; //- argument number (starts at 0, eg : %1 => argN=0)
// negative values for items that don't process an argument
string_type res_; //- result of the formatting of this item
string_type appendix_; //- piece of string between this item and the next
stream_format_state fmtstate_;// set by parsing, is only affected by modify_item
std::streamsize truncate_;//- is set for directives like %.5s that ask truncation
unsigned int pad_scheme_;//- several possible padding schemes can mix. see pad_values
};
//--- Definitions ------------------------------------------------------------
// - stream_format_state:: -------------------------------------------------
template<class Ch, class Tr>
void stream_format_state<Ch,Tr>:: apply_on (basic_ios & os,
boost::io::detail::locale_t * loc_default) const {
// If a locale is available, set it first. "os.fill(fill_);" may chrash otherwise.
#if !defined(BOOST_NO_STD_LOCALE)
if(loc_)
os.imbue(loc_.get());
else if(loc_default)
os.imbue(*loc_default);
#else
(void) loc_default; // keep compiler quiet if we don't support locales
#endif
// set the state of this stream according to our params
if(width_ != -1)
os.width(width_);
if(precision_ != -1)
os.precision(precision_);
if(fill_ != 0)
os.fill(fill_);
os.flags(flags_);
os.clear(rdstate_);
os.exceptions(exceptions_);
}
template<class Ch, class Tr>
void stream_format_state<Ch,Tr>:: set_by_stream(const basic_ios& os) {
// set our params according to the state of this stream
flags_ = os.flags();
width_ = os.width();
precision_ = os.precision();
fill_ = os.fill();
rdstate_ = os.rdstate();
exceptions_ = os.exceptions();
}
template<class Ch, class Tr, class T>
void apply_manip_body( stream_format_state<Ch, Tr>& self,
T manipulator) {
// modify our params according to the manipulator
basic_oaltstringstream<Ch, Tr> ss;
self.apply_on( ss );
ss << manipulator;
self.set_by_stream( ss );
}
template<class Ch, class Tr> inline
void stream_format_state<Ch,Tr>:: reset(Ch fill) {
// set our params to standard's default state. cf 27.4.4.1 of the C++ norm
width_=0; precision_=6;
fill_=fill; // default is widen(' '), but we cant compute it without the locale
flags_ = std::ios_base::dec | std::ios_base::skipws;
// the adjust_field part is left equal to 0, which means right.
exceptions_ = std::ios_base::goodbit;
rdstate_ = std::ios_base::goodbit;
}
// --- format_item:: --------------------------------------------------------
template<class Ch, class Tr, class Alloc>
void format_item<Ch, Tr, Alloc>::
reset (Ch fill) {
argN_=argN_no_posit; truncate_ = max_streamsize(); pad_scheme_ =0;
res_.resize(0); appendix_.resize(0);
fmtstate_.reset(fill);
}
template<class Ch, class Tr, class Alloc>
void format_item<Ch, Tr, Alloc>::
compute_states() {
// reflect pad_scheme_ on fmt_state_
// because some pad_schemes has complex consequences on several state params.
if(pad_scheme_ & zeropad) {
// ignore zeropad in left alignment :
if(fmtstate_.flags_ & std::ios_base::left) {
BOOST_ASSERT(!(fmtstate_.flags_ &(std::ios_base::adjustfield ^std::ios_base::left)));
// only left bit might be set. (not right, nor internal)
pad_scheme_ = pad_scheme_ & (~zeropad);
}
else {
pad_scheme_ &= ~spacepad; // printf ignores spacepad when zeropadding
fmtstate_.fill_='0';
fmtstate_.flags_ = (fmtstate_.flags_ & ~std::ios_base::adjustfield)
| std::ios_base::internal;
// removes all adjustfield bits, and adds internal.
}
}
if(pad_scheme_ & spacepad) {
if(fmtstate_.flags_ & std::ios_base::showpos)
pad_scheme_ &= ~spacepad;
}
}
} } } // namespaces boost :: io :: detail
#endif // BOOST_FORMAT_INTERNALS_HPP

View File

@ -1,64 +0,0 @@
// ----------------------------------------------------------------------------
// internals_fwd.hpp : forward declarations, for internal headers
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_INTERNAL_FWD_HPP
#define BOOST_FORMAT_INTERNAL_FWD_HPP
#include <boost/format/format_fwd.hpp>
#include <boost/config.hpp>
namespace boost {
namespace io {
namespace detail {
template<class Ch, class Tr> struct stream_format_state;
template<class Ch, class Tr, class Alloc> struct format_item;
// these functions were intended as methods,
// but MSVC have problems with template member functions :
// defined in format_implementation.hpp :
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
modify_item_body (basic_format<Ch, Tr, Alloc>& self,
int itemN, T manipulator);
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
bind_arg_body (basic_format<Ch, Tr, Alloc>& self,
int argN, const T& val);
// in internals.hpp :
template<class Ch, class Tr, class T>
void apply_manip_body (stream_format_state<Ch, Tr>& self,
T manipulator);
// argument feeding (defined in feed_args.hpp ) :
template<class Ch, class Tr, class Alloc, class T>
void distribute (basic_format<Ch,Tr, Alloc>& self, T x);
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
feed (basic_format<Ch,Tr, Alloc>& self, T x);
template<class Ch, class Tr, class Alloc, class T>
basic_format<Ch, Tr, Alloc>&
feed_impl (basic_format<Ch,Tr, Alloc>& self, T x);
} // namespace detail
} // namespace io
} // namespace boost
#endif // BOOST_FORMAT_INTERNAL_FWD_HPP

View File

@ -1,501 +0,0 @@
// ----------------------------------------------------------------------------
// parsing.hpp : implementation of the parsing member functions
// ( parse, parse_printf_directive)
// ----------------------------------------------------------------------------
// Copyright Samuel Krempp 2003. Use, modification, and distribution are
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// see http://www.boost.org/libs/format for library home page
// ----------------------------------------------------------------------------
#ifndef BOOST_FORMAT_PARSING_HPP
#define BOOST_FORMAT_PARSING_HPP
#include <boost/format/format_class.hpp>
#include <boost/format/exceptions.hpp>
#include <boost/throw_exception.hpp>
#include <boost/assert.hpp>
namespace boost {
namespace io {
namespace detail {
#if defined(BOOST_NO_STD_LOCALE)
// streams will be used for narrow / widen. but these methods are not const
template<class T>
T& const_or_not(const T& x) {
return const_cast<T&> (x);
}
#else
template<class T>
const T& const_or_not(const T& x) {
return x;
}
#endif
template<class Ch, class Facet> inline
char wrap_narrow(const Facet& fac, Ch c, char deflt) {
return const_or_not(fac).narrow(c, deflt);
}
template<class Ch, class Facet> inline
bool wrap_isdigit(const Facet& fac, Ch c) {
#if ! defined( BOOST_NO_LOCALE_ISDIGIT )
return fac.is(std::ctype<Ch>::digit, c);
# else
(void) fac; // remove "unused parameter" warning
using namespace std;
return isdigit(c) != 0;
#endif
}
template<class Iter, class Facet>
Iter wrap_scan_notdigit(const Facet & fac, Iter beg, Iter end) {
using namespace std;
for( ; beg!=end && wrap_isdigit(fac, *beg); ++beg) ;
return beg;
}
// Input : [start, last) iterators range and a
// a Facet to use its widen/narrow member function
// Effects : read sequence and convert digits into integral n, of type Res
// Returns : n
template<class Res, class Iter, class Facet>
Iter str2int (const Iter & start, const Iter & last, Res & res,
const Facet& fac)
{
using namespace std;
Iter it;
res=0;
for(it=start; it != last && wrap_isdigit(fac, *it); ++it ) {
char cur_ch = wrap_narrow(fac, *it, 0); // cant fail.
res *= 10;
res += cur_ch - '0'; // 22.2.1.1.2.13 of the C++ standard
}
return it;
}
// skip printf's "asterisk-fields" directives in the format-string buf
// Input : char string, with starting index *pos_p
// a Facet merely to use its widen/narrow member function
// Effects : advance *pos_p by skipping printf's asterisk fields.
// Returns : nothing
template<class Iter, class Facet>
Iter skip_asterisk(Iter start, Iter last, const Facet& fac)
{
using namespace std;
++ start;
start = wrap_scan_notdigit(fac, start, last);
if(start!=last && *start== const_or_not(fac).widen( '$') )
++start;
return start;
}
// auxiliary func called by parse_printf_directive
// for centralising error handling
// it either throws if user sets the corresponding flag, or does nothing.
inline void maybe_throw_exception(unsigned char exceptions,
std::size_t pos, std::size_t size)
{
if(exceptions & io::bad_format_string_bit)
boost::throw_exception(io::bad_format_string(pos, size) );
}
// Input: the position of a printf-directive in the format-string
// a basic_ios& merely to use its widen/narrow member function
// a bitset'exceptions' telling whether to throw exceptions on errors.
// Returns:
// true if parse succeeded (ignore some errors if exceptions disabled)
// false if it failed so bad that the directive should be printed verbatim
// Effects:
// start is incremented so that *start is the first char after
// this directive
// *fpar is set with the parameters read in the directive
template<class Ch, class Tr, class Alloc, class Iter, class Facet>
bool parse_printf_directive(Iter & start, const Iter& last,
detail::format_item<Ch, Tr, Alloc> * fpar,
const Facet& fac,
std::size_t offset, unsigned char exceptions)
{
typedef typename basic_format<Ch, Tr, Alloc>::format_item_t format_item_t;
fpar->argN_ = format_item_t::argN_no_posit; // if no positional-directive
bool precision_set = false;
bool in_brackets=false;
Iter start0 = start;
std::size_t fstring_size = last-start0+offset;
if(start>= last) { // empty directive : this is a trailing %
maybe_throw_exception(exceptions, start-start0 + offset, fstring_size);
return false;
}
if(*start== const_or_not(fac).widen( '|')) {
in_brackets=true;
if( ++start >= last ) {
maybe_throw_exception(exceptions, start-start0 + offset, fstring_size);
return false;
}
}
// the flag '0' would be picked as a digit for argument order, but here it's a flag :
if(*start== const_or_not(fac).widen( '0'))
goto parse_flags;
// handle argument order (%2$d) or possibly width specification: %2d
if(wrap_isdigit(fac, *start)) {
int n;
start = str2int(start, last, n, fac);
if( start >= last ) {
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
return false;
}
// %N% case : this is already the end of the directive
if( *start == const_or_not(fac).widen( '%') ) {
fpar->argN_ = n-1;
++start;
if( in_brackets)
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
// but don't return. maybe "%" was used in lieu of '$', so we go on.
else
return true;
}
if ( *start== const_or_not(fac).widen( '$') ) {
fpar->argN_ = n-1;
++start;
}
else {
// non-positionnal directive
fpar->fmtstate_.width_ = n;
fpar->argN_ = format_item_t::argN_no_posit;
goto parse_precision;
}
}
parse_flags:
// handle flags
while ( start != last) { // as long as char is one of + - = _ # 0 l h or ' '
// misc switches
switch ( wrap_narrow(fac, *start, 0)) {
case '\'' : break; // no effect yet. (painful to implement)
case 'l':
case 'h': // short/long modifier : for printf-comaptibility (no action needed)
break;
case '-':
fpar->fmtstate_.flags_ |= std::ios_base::left;
break;
case '=':
fpar->pad_scheme_ |= format_item_t::centered;
break;
case '_':
fpar->fmtstate_.flags_ |= std::ios_base::internal;
break;
case ' ':
fpar->pad_scheme_ |= format_item_t::spacepad;
break;
case '+':
fpar->fmtstate_.flags_ |= std::ios_base::showpos;
break;
case '0':
fpar->pad_scheme_ |= format_item_t::zeropad;
// need to know alignment before really setting flags,
// so just add 'zeropad' flag for now, it will be processed later.
break;
case '#':
fpar->fmtstate_.flags_ |= std::ios_base::showpoint | std::ios_base::showbase;
break;
default:
goto parse_width;
}
++start;
} // loop on flag.
if( start>=last) {
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
return true;
}
parse_width:
// handle width spec
// first skip 'asterisk fields' : *, or *N$
if(*start == const_or_not(fac).widen( '*') )
start = skip_asterisk(start, last, fac);
if(start!=last && wrap_isdigit(fac, *start))
start = str2int(start, last, fpar->fmtstate_.width_, fac);
parse_precision:
if( start>= last) {
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
return true;
}
// handle precision spec
if (*start== const_or_not(fac).widen( '.')) {
++start;
if(start != last && *start == const_or_not(fac).widen( '*') )
start = skip_asterisk(start, last, fac);
if(start != last && wrap_isdigit(fac, *start)) {
start = str2int(start, last, fpar->fmtstate_.precision_, fac);
precision_set = true;
}
else
fpar->fmtstate_.precision_ =0;
}
// handle formatting-type flags :
while( start != last && ( *start== const_or_not(fac).widen( 'l')
|| *start== const_or_not(fac).widen( 'L')
|| *start== const_or_not(fac).widen( 'h')) )
++start;
if( start>=last) {
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
return true;
}
if( in_brackets && *start== const_or_not(fac).widen( '|') ) {
++start;
return true;
}
switch ( wrap_narrow(fac, *start, 0) ) {
case 'X':
fpar->fmtstate_.flags_ |= std::ios_base::uppercase;
case 'p': // pointer => set hex.
case 'x':
fpar->fmtstate_.flags_ &= ~std::ios_base::basefield;
fpar->fmtstate_.flags_ |= std::ios_base::hex;
break;
case 'o':
fpar->fmtstate_.flags_ &= ~std::ios_base::basefield;
fpar->fmtstate_.flags_ |= std::ios_base::oct;
break;
case 'E':
fpar->fmtstate_.flags_ |= std::ios_base::uppercase;
case 'e':
fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield;
fpar->fmtstate_.flags_ |= std::ios_base::scientific;
fpar->fmtstate_.flags_ &= ~std::ios_base::basefield;
fpar->fmtstate_.flags_ |= std::ios_base::dec;
break;
case 'f':
fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield;
fpar->fmtstate_.flags_ |= std::ios_base::fixed;
case 'u':
case 'd':
case 'i':
fpar->fmtstate_.flags_ &= ~std::ios_base::basefield;
fpar->fmtstate_.flags_ |= std::ios_base::dec;
break;
case 'T':
++start;
if( start >= last)
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
else
fpar->fmtstate_.fill_ = *start;
fpar->pad_scheme_ |= format_item_t::tabulation;
fpar->argN_ = format_item_t::argN_tabulation;
break;
case 't':
fpar->fmtstate_.fill_ = const_or_not(fac).widen( ' ');
fpar->pad_scheme_ |= format_item_t::tabulation;
fpar->argN_ = format_item_t::argN_tabulation;
break;
case 'G':
fpar->fmtstate_.flags_ |= std::ios_base::uppercase;
break;
case 'g': // 'g' conversion is default for floats.
fpar->fmtstate_.flags_ &= ~std::ios_base::basefield;
fpar->fmtstate_.flags_ |= std::ios_base::dec;
// CLEAR all floatield flags, so stream will CHOOSE
fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield;
break;
case 'C':
case 'c':
fpar->truncate_ = 1;
break;
case 'S':
case 's':
if(precision_set) // handle truncation manually, with own parameter.
fpar->truncate_ = fpar->fmtstate_.precision_;
fpar->fmtstate_.precision_ = 6; // default stream precision.
break;
case 'n' :
fpar->argN_ = format_item_t::argN_ignored;
break;
default:
maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
}
++start;
if( in_brackets ) {
if( start != last && *start== const_or_not(fac).widen( '|') ) {
++start;
return true;
}
else maybe_throw_exception(exceptions, start-start0+offset, fstring_size);
}
return true;
}
// -end parse_printf_directive()
template<class String, class Facet>
int upper_bound_from_fstring(const String& buf,
const typename String::value_type arg_mark,
const Facet& fac,
unsigned char exceptions)
{
// quick-parsing of the format-string to count arguments mark (arg_mark, '%')
// returns : upper bound on the number of format items in the format strings
using namespace boost::io;
typename String::size_type i1=0;
int num_items=0;
while( (i1=buf.find(arg_mark,i1)) != String::npos ) {
if( i1+1 >= buf.size() ) {
if(exceptions & bad_format_string_bit)
boost::throw_exception(bad_format_string(i1, buf.size() )); // must not end in ".. %"
else {
++num_items;
break;
}
}
if(buf[i1+1] == buf[i1] ) {// escaped "%%"
i1+=2; continue;
}
++i1;
// in case of %N% directives, dont count it double (wastes allocations..) :
i1 = detail::wrap_scan_notdigit(fac, buf.begin()+i1, buf.end()) - buf.begin();
if( i1 < buf.size() && buf[i1] == arg_mark )
++i1;
++num_items;
}
return num_items;
}
template<class String> inline
void append_string(String& dst, const String& src,
const typename String::size_type beg,
const typename String::size_type end) {
dst.append(src.begin()+beg, src.begin()+end);
}
} // detail namespace
} // io namespace
// -----------------------------------------------
// format :: parse(..)
template<class Ch, class Tr, class Alloc>
basic_format<Ch, Tr, Alloc>& basic_format<Ch, Tr, Alloc>::
parse (const string_type& buf) {
// parse the format-string
using namespace std;
#if !defined(BOOST_NO_STD_LOCALE)
const std::ctype<Ch> & fac = BOOST_USE_FACET( std::ctype<Ch>, getloc());
#else
io::basic_oaltstringstream<Ch, Tr, Alloc> fac;
//has widen and narrow even on compilers without locale
#endif
const Ch arg_mark = io::detail::const_or_not(fac).widen( '%');
bool ordered_args=true;
int max_argN=-1;
// A: find upper_bound on num_items and allocates arrays
int num_items = io::detail::upper_bound_from_fstring(buf, arg_mark, fac, exceptions());
make_or_reuse_data(num_items);
// B: Now the real parsing of the format string :
num_items=0;
typename string_type::size_type i0=0, i1=0;
typename string_type::const_iterator it;
bool special_things=false;
int cur_item=0;
while( (i1=buf.find(arg_mark,i1)) != string_type::npos ) {
string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_;
if( buf[i1+1] == buf[i1] ) { // escaped mark, '%%'
io::detail::append_string(piece, buf, i0, i1+1);
i1+=2; i0=i1;
continue;
}
BOOST_ASSERT( static_cast<unsigned int>(cur_item) < items_.size() || cur_item==0);
if(i1!=i0) {
io::detail::append_string(piece, buf, i0, i1);
i0=i1;
}
++i1;
it = buf.begin()+i1;
bool parse_ok = io::detail::parse_printf_directive(
it, buf.end(), &items_[cur_item], fac, i1, exceptions());
i1 = it - buf.begin();
if( ! parse_ok ) // the directive will be printed verbatim
continue;
i0=i1;
items_[cur_item].compute_states(); // process complex options, like zeropad, into params
int argN=items_[cur_item].argN_;
if(argN == format_item_t::argN_ignored)
continue;
if(argN ==format_item_t::argN_no_posit)
ordered_args=false;
else if(argN == format_item_t::argN_tabulation) special_things=true;
else if(argN > max_argN) max_argN = argN;
++num_items;
++cur_item;
} // loop on %'s
BOOST_ASSERT(cur_item == num_items);
// store the final piece of string
{
string_type & piece = (cur_item==0) ? prefix_ : items_[cur_item-1].appendix_;
io::detail::append_string(piece, buf, i0, buf.size());
}
if( !ordered_args) {
if(max_argN >= 0 ) { // dont mix positional with non-positionnal directives
if(exceptions() & io::bad_format_string_bit)
boost::throw_exception(
io::bad_format_string(static_cast<std::size_t>(max_argN), 0));
// else do nothing. => positionnal arguments are processed as non-positionnal
}
// set things like it would have been with positional directives :
int non_ordered_items = 0;
for(int i=0; i< num_items; ++i)
if(items_[i].argN_ == format_item_t::argN_no_posit) {
items_[i].argN_ = non_ordered_items;
++non_ordered_items;
}
max_argN = non_ordered_items-1;
}
// C: set some member data :
items_.resize(num_items, format_item_t(io::detail::const_or_not(fac).widen( ' ')) );
if(special_things) style_ |= special_needs;
num_args_ = max_argN + 1;
if(ordered_args) style_ |= ordered;
else style_ &= ~ordered;
return *this;
}
} // namespace boost
#endif // BOOST_FORMAT_PARSING_HPP

View File

@ -1,95 +0,0 @@
// Copyright David Abrahams 2003. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_
# define BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_
# include <boost/static_assert.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/type_traits/is_same.hpp>
# include <boost/mpl/placeholders.hpp>
# include <boost/mpl/aux_/lambda_support.hpp>
namespace boost {
namespace iterators {
namespace detail {
template <bool GreaterEqual, bool LessEqual>
struct minimum_category_impl;
template <class T1, class T2>
struct error_not_related_by_convertibility;
template <>
struct minimum_category_impl<true,false>
{
template <class T1, class T2> struct apply
{
typedef T2 type;
};
};
template <>
struct minimum_category_impl<false,true>
{
template <class T1, class T2> struct apply
{
typedef T1 type;
};
};
template <>
struct minimum_category_impl<true,true>
{
template <class T1, class T2> struct apply
{
BOOST_STATIC_ASSERT((is_same<T1,T2>::value));
typedef T1 type;
};
};
template <>
struct minimum_category_impl<false,false>
{
template <class T1, class T2> struct apply
: error_not_related_by_convertibility<T1,T2>
{
};
};
} // namespace detail
//
// Returns the minimum category type or fails to compile
// if T1 and T2 are unrelated.
//
template <class T1 = mpl::_1, class T2 = mpl::_2>
struct minimum_category
{
typedef boost::iterators::detail::minimum_category_impl<
::boost::is_convertible<T1,T2>::value
, ::boost::is_convertible<T2,T1>::value
> outer;
typedef typename outer::template apply<T1,T2> inner;
typedef typename inner::type type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,minimum_category,(T1,T2))
};
template <>
struct minimum_category<mpl::_1,mpl::_2>
{
template <class T1, class T2>
struct apply : minimum_category<T1,T2>
{};
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,minimum_category,(mpl::_1,mpl::_2))
};
} // namespace iterators
} // namespace boost
#endif // BOOST_ITERATOR_MINIMUM_CATEGORY_HPP_INCLUDED_

View File

@ -1,43 +0,0 @@
#ifndef BOOST_MPL_AUX_EMPTY_IMPL_HPP_INCLUDED
#define BOOST_MPL_AUX_EMPTY_IMPL_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/empty_fwd.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace mpl {
// default implementation; conrete sequences might override it by
// specializing either the 'empty_impl' or the primary 'empty' template
template< typename Tag >
struct empty_impl
{
template< typename Sequence > struct apply
: is_same<
typename begin<Sequence>::type
, typename end<Sequence>::type
>
{
};
};
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(1,empty_impl)
}}
#endif // BOOST_MPL_AUX_EMPTY_IMPL_HPP_INCLUDED

View File

@ -1,68 +0,0 @@
#ifndef BOOST_MPL_INSERT_IMPL_HPP_INCLUDED
#define BOOST_MPL_INSERT_IMPL_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/reverse_fold.hpp>
#include <boost/mpl/iterator_range.hpp>
#include <boost/mpl/clear.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace mpl {
// default implementation; conrete sequences might override it by
// specializing either the 'insert_impl' or the primary 'insert' template
template< typename Tag >
struct insert_impl
{
template<
typename Sequence
, typename Pos
, typename T
>
struct apply
{
typedef iterator_range<
typename begin<Sequence>::type
, Pos
> first_half_;
typedef iterator_range<
Pos
, typename end<Sequence>::type
> second_half_;
typedef typename reverse_fold<
second_half_
, typename clear<Sequence>::type
, push_front<_,_>
>::type half_sequence_;
typedef typename reverse_fold<
first_half_
, typename push_front<half_sequence_,T>::type
, push_front<_,_>
>::type type;
};
};
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_impl)
}}
#endif // BOOST_MPL_INSERT_IMPL_HPP_INCLUDED

View File

@ -1,80 +0,0 @@
#ifndef BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
#define BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/mpl/clear.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/iterator_range.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/iter_push_front.hpp>
#include <boost/mpl/aux_/traits_lambda_spec.hpp>
#include <boost/mpl/aux_/config/forwarding.hpp>
#include <boost/type_traits/same_traits.hpp>
namespace boost { namespace mpl {
// default implementation; conrete sequences might override it by
// specializing either the 'insert_range_impl' or the primary
// 'insert_range' template
template< typename Tag >
struct insert_range_impl
{
template<
typename Sequence
, typename Pos
, typename Range
>
struct apply
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
: reverse_fold<
joint_view<
iterator_range<typename begin<Sequence>::type,Pos>
, joint_view<
Range
, iterator_range<Pos,typename end<Sequence>::type>
>
>
, typename clear<Sequence>::type
, insert<_1, begin<_1>, _2>
>
{
#else
{
typedef typename reverse_fold<
joint_view<
iterator_range<typename begin<Sequence>::type,Pos>
, joint_view<
Range
, iterator_range<Pos,typename end<Sequence>::type>
>
>
, typename clear<Sequence>::type
, insert<_1, begin<_1>, _2>
>::type type;
#endif
};
};
BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(3,insert_range_impl)
}}
#endif // BOOST_MPL_AUX_INSERT_RANGE_IMPL_HPP_INCLUDED

View File

@ -1,36 +0,0 @@
#ifndef BOOST_MPL_ITER_PUSH_FRONT_HPP_INCLUDED
#define BOOST_MPL_ITER_PUSH_FRONT_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2002-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/deref.hpp>
namespace boost { namespace mpl { namespace aux {
template<
typename Sequence
, typename Iterator
>
struct iter_push_front
{
typedef typename push_front<
Sequence
, typename deref<Iterator>::type
>::type type;
};
}}}
#endif // BOOST_MPL_ITER_PUSH_FRONT_HPP_INCLUDED

View File

@ -1,120 +0,0 @@
#ifndef BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
#define BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/next_prior.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/iterator_tags.hpp>
#include <boost/mpl/aux_/lambda_spec.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
# include <boost/type_traits/is_same.hpp>
#endif
namespace boost { namespace mpl {
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template<
typename Iterator1
, typename LastIterator1
, typename Iterator2
>
struct joint_iter
{
typedef Iterator1 base;
typedef forward_iterator_tag category;
};
template<
typename LastIterator1
, typename Iterator2
>
struct joint_iter<LastIterator1,LastIterator1,Iterator2>
{
typedef Iterator2 base;
typedef forward_iterator_tag category;
};
template< typename I1, typename L1, typename I2 >
struct deref< joint_iter<I1,L1,I2> >
{
typedef typename joint_iter<I1,L1,I2>::base base_;
typedef typename deref<base_>::type type;
};
template< typename I1, typename L1, typename I2 >
struct next< joint_iter<I1,L1,I2> >
{
typedef joint_iter< typename mpl::next<I1>::type,L1,I2 > type;
};
template< typename L1, typename I2 >
struct next< joint_iter<L1,L1,I2> >
{
typedef joint_iter< L1,L1,typename mpl::next<I2>::type > type;
};
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<
typename Iterator1
, typename LastIterator1
, typename Iterator2
>
struct joint_iter;
template< bool > struct joint_iter_impl
{
template< typename I1, typename L1, typename I2 > struct result_
{
typedef I1 base;
typedef forward_iterator_tag category;
typedef joint_iter< typename mpl::next<I1>::type,L1,I2 > next;
typedef typename deref<I1>::type type;
};
};
template<> struct joint_iter_impl<true>
{
template< typename I1, typename L1, typename I2 > struct result_
{
typedef I2 base;
typedef forward_iterator_tag category;
typedef joint_iter< L1,L1,typename mpl::next<I2>::type > next;
typedef typename deref<I2>::type type;
};
};
template<
typename Iterator1
, typename LastIterator1
, typename Iterator2
>
struct joint_iter
: joint_iter_impl< is_same<Iterator1,LastIterator1>::value >
::template result_<Iterator1,LastIterator1,Iterator2>
{
};
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
BOOST_MPL_AUX_PASS_THROUGH_LAMBDA_SPEC(3, joint_iter)
}}
#endif // BOOST_MPL_AUX_JOINT_ITER_HPP_INCLUDED

View File

@ -1,22 +0,0 @@
#ifndef BOOST_MPL_CHAR_HPP_INCLUDED
#define BOOST_MPL_CHAR_HPP_INCLUDED
// Copyright Eric Niebler 2008
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source$
// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $
// $Revision: 24874 $
#include <boost/mpl/char_fwd.hpp>
#define AUX_WRAPPER_VALUE_TYPE char
#include <boost/mpl/aux_/integral_wrapper.hpp>
#endif // BOOST_MPL_CHAR_HPP_INCLUDED

View File

@ -1,27 +0,0 @@
#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED
#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED
// Copyright Eric Niebler 2008
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source$
// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $
// $Revision: 24874 $
#include <boost/mpl/aux_/adl_barrier.hpp>
#include <boost/mpl/aux_/nttp_decl.hpp>
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_;
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
BOOST_MPL_AUX_ADL_BARRIER_DECL(char_)
#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED

View File

@ -1,58 +0,0 @@
#ifndef BOOST_MPL_COPY_HPP_INCLUDED
#define BOOST_MPL_COPY_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright David Abrahams 2003-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/fold.hpp>
#include <boost/mpl/reverse_fold.hpp>
#include <boost/mpl/aux_/inserter_algorithm.hpp>
namespace boost { namespace mpl {
namespace aux {
template<
typename Sequence
, typename Inserter
>
struct copy_impl
: fold<
Sequence
, typename Inserter::state
, typename Inserter::operation
>
{
};
template<
typename Sequence
, typename Inserter
>
struct reverse_copy_impl
: reverse_fold<
Sequence
, typename Inserter::state
, typename Inserter::operation
>
{
};
} // namespace aux
BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(2, copy)
}}
#endif // BOOST_MPL_COPY_HPP_INCLUDED

View File

@ -1,39 +0,0 @@
#ifndef BOOST_MPL_EMPTY_HPP_INCLUDED
#define BOOST_MPL_EMPTY_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/empty_fwd.hpp>
#include <boost/mpl/sequence_tag.hpp>
#include <boost/mpl/aux_/empty_impl.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
>
struct empty
: empty_impl< typename sequence_tag<Sequence>::type >
::template apply< Sequence >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,empty,(Sequence))
};
BOOST_MPL_AUX_NA_SPEC(1, empty)
}}
#endif // BOOST_MPL_EMPTY_HPP_INCLUDED

View File

@ -1,41 +0,0 @@
#ifndef BOOST_MPL_INSERT_HPP_INCLUDED
#define BOOST_MPL_INSERT_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/insert_fwd.hpp>
#include <boost/mpl/sequence_tag.hpp>
#include <boost/mpl/aux_/insert_impl.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
, typename BOOST_MPL_AUX_NA_PARAM(Pos_or_T)
, typename BOOST_MPL_AUX_NA_PARAM(T)
>
struct insert
: insert_impl< typename sequence_tag<Sequence>::type >
::template apply< Sequence,Pos_or_T,T >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,insert,(Sequence,Pos_or_T,T))
};
BOOST_MPL_AUX_NA_SPEC(3, insert)
}}
#endif // BOOST_MPL_INSERT_HPP_INCLUDED

View File

@ -1,24 +0,0 @@
#ifndef BOOST_MPL_INSERT_FWD_HPP_INCLUDED
#define BOOST_MPL_INSERT_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
namespace boost { namespace mpl {
template< typename Tag > struct insert_impl;
template< typename Sequence, typename Pos_or_T, typename T > struct insert;
}}
#endif // BOOST_MPL_INSERT_FWD_HPP_INCLUDED

View File

@ -1,41 +0,0 @@
#ifndef BOOST_MPL_INSERT_RANGE_HPP_INCLUDED
#define BOOST_MPL_INSERT_RANGE_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/insert_range_fwd.hpp>
#include <boost/mpl/sequence_tag.hpp>
#include <boost/mpl/aux_/insert_range_impl.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
, typename BOOST_MPL_AUX_NA_PARAM(Pos)
, typename BOOST_MPL_AUX_NA_PARAM(Range)
>
struct insert_range
: insert_range_impl< typename sequence_tag<Sequence>::type >
::template apply< Sequence,Pos,Range >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,insert_range,(Sequence,Pos,Range))
};
BOOST_MPL_AUX_NA_SPEC(3, insert_range)
}}
#endif // BOOST_MPL_INSERT_RANGE_HPP_INCLUDED

View File

@ -1,24 +0,0 @@
#ifndef BOOST_MPL_INSERT_RANGE_FWD_HPP_INCLUDED
#define BOOST_MPL_INSERT_RANGE_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
namespace boost { namespace mpl {
template< typename Tag > struct insert_range_impl;
template< typename Sequence, typename Pos, typename Range > struct insert_range;
}}
#endif // BOOST_MPL_INSERT_RANGE_FWD_HPP_INCLUDED

View File

@ -1,65 +0,0 @@
#ifndef BOOST_MPL_JOINT_VIEW_HPP_INCLUDED
#define BOOST_MPL_JOINT_VIEW_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/joint_iter.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/size_fwd.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
namespace boost { namespace mpl {
namespace aux {
struct joint_view_tag;
}
template<>
struct size_impl< aux::joint_view_tag >
{
template < typename JointView > struct apply
: plus<
size<typename JointView::sequence1_>
, size<typename JointView::sequence2_>
>
{};
};
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence1_)
, typename BOOST_MPL_AUX_NA_PARAM(Sequence2_)
>
struct joint_view
{
typedef typename mpl::begin<Sequence1_>::type first1_;
typedef typename mpl::end<Sequence1_>::type last1_;
typedef typename mpl::begin<Sequence2_>::type first2_;
typedef typename mpl::end<Sequence2_>::type last2_;
// agurt, 25/may/03: for the 'size_traits' implementation above
typedef Sequence1_ sequence1_;
typedef Sequence2_ sequence2_;
typedef joint_view type;
typedef aux::joint_view_tag tag;
typedef joint_iter<first1_,last1_,first2_> begin;
typedef joint_iter<last1_,last1_,last2_> end;
};
BOOST_MPL_AUX_NA_SPEC(2, joint_view)
}}
#endif // BOOST_MPL_JOINT_VIEW_HPP_INCLUDED

View File

@ -1,21 +0,0 @@
#ifndef BOOST_MPL_LIMITS_STRING_HPP_INCLUDED
#define BOOST_MPL_LIMITS_STRING_HPP_INCLUDED
// Copyright Eric Niebler 2009
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $
// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $
// $Revision: 49239 $
#if !defined(BOOST_MPL_LIMIT_STRING_SIZE)
# define BOOST_MPL_LIMIT_STRING_SIZE 32
#endif
#endif // BOOST_MPL_LIMITS_STRING_HPP_INCLUDED

View File

@ -1,607 +0,0 @@
#ifndef BOOST_MPL_STRING_HPP_INCLUDED
#define BOOST_MPL_STRING_HPP_INCLUDED
// Copyright Eric Niebler 2009
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $
// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $
// $Revision: 49239 $
//
// Thanks to:
// Dmitry Goncharov for porting this to the Sun compiler
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/predef/other/endian.h>
#include <boost/mpl/limits/string.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/char.hpp>
#include <boost/mpl/copy.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/insert_range.hpp>
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/front_inserter.hpp>
#include <boost/mpl/iterator_range.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/div.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <iterator> // for bidirectional_iterator_tag
#include <climits>
namespace boost { namespace mpl
{
#define BOOST_MPL_STRING_MAX_PARAMS \
BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_LIMIT_STRING_SIZE, 3), 4)
// Low-level bit-twiddling is done by macros. Any implementation-defined behavior of
// multi-character literals should be localized to these macros.
#define BOOST_MPL_MULTICHAR_LENGTH(c) \
(std::size_t)((c<CHAR_MIN) ? 4 : ((c>0xffffff)+(c>0xffff)+(c>0xff)+1))
#if BOOST_ENDIAN_LITTLE_BYTE && defined(__SUNPRO_CC)
#define BOOST_MPL_MULTICHAR_AT(c,i) \
(char)(0xff&((unsigned)(c)>>(8*(std::size_t)(i))))
#define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \
((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c))
#define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \
(((unsigned)(c)<<8)|(unsigned char)(i))
#define BOOST_MPL_MULTICHAR_POP_BACK(c) \
(((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c))
#define BOOST_MPL_MULTICHAR_POP_FRONT(c) \
((unsigned)(c)>>8)
#else
#define BOOST_MPL_MULTICHAR_AT(c,i) \
(char)(0xff&((unsigned)(c)>>(8*(BOOST_MPL_MULTICHAR_LENGTH(c)-(std::size_t)(i)-1))))
#define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \
(((unsigned)(c)<<8)|(unsigned char)(i))
#define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \
((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c))
#define BOOST_MPL_MULTICHAR_POP_BACK(c) \
((unsigned)(c)>>8)
#define BOOST_MPL_MULTICHAR_POP_FRONT(c) \
(((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c))
#endif
struct string_tag;
struct string_iterator_tag;
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_MPL_STRING_MAX_PARAMS, int C, 0)>
struct string;
template<typename Sequence, int I, int J>
struct string_iterator;
template<typename Sequence>
struct sequence_tag;
template<typename Tag>
struct size_impl;
template<>
struct size_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply;
#define M0(z, n, data) \
+ BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C,n))
#define M1(z, n, data) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \
: mpl::size_t<(0 BOOST_PP_REPEAT_ ## z(n, M0, ~))> \
{};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M1, ~)
#undef M0
#undef M1
};
template<>
struct size_impl<mpl::string_tag>::apply<mpl::string<> >
: mpl::size_t<0>
{};
template<typename Tag>
struct begin_impl;
template<>
struct begin_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply
{
typedef mpl::string_iterator<Sequence, 0, 0> type;
};
};
template<typename Tag>
struct end_impl;
template<>
struct end_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply;
#define M0(z,n,data) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \
{ \
typedef mpl::string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, n, 0> type; \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~)
#undef M0
};
template<>
struct end_impl<mpl::string_tag>::apply<mpl::string<> >
{
typedef mpl::string_iterator<mpl::string<>, 0, 0> type;
};
template<typename Tag>
struct push_back_impl;
template<>
struct push_back_impl<mpl::string_tag>
{
template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::back_))>
struct apply
{
BOOST_MPL_ASSERT_MSG(
(BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)
, PUSH_BACK_FAILED_MPL_STRING_IS_FULL
, (Sequence)
);
// If the above assertion didn't fire, then the string is sparse.
// Repack the string and retry the push_back
typedef
typename mpl::push_back<
typename mpl::copy<
Sequence
, mpl::back_inserter<mpl::string<> >
>::type
, Value
>::type
type;
};
template<typename Value>
struct apply<mpl::string<>, Value, false>
{
typedef mpl::string<(char)Value::value> type;
};
#define M0(z,n,data) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, false> \
{ \
typedef \
mpl::string< \
BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \
?BOOST_PP_CAT(C,BOOST_PP_DEC(n)) \
:BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n)), Value::value) \
, ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \
?(char)Value::value \
:0 \
> \
type; \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
#undef M0
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value>
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false>
{
typedef
mpl::string<
BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), C)
, BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)), Value::value)
>
type;
};
};
template<typename Tag>
struct has_push_back_impl;
template<>
struct has_push_back_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
template<typename Tag>
struct pop_back_impl;
template<>
struct pop_back_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply;
#define M0(z,n,data) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)> > \
{ \
BOOST_MPL_ASSERT_MSG((C0 != 0), POP_BACK_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \
typedef \
mpl::string< \
BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \
BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \
BOOST_MPL_MULTICHAR_POP_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n))) \
> \
type; \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~)
#undef M0
};
template<typename Tag>
struct has_pop_back_impl;
template<>
struct has_pop_back_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
template<typename Tag>
struct push_front_impl;
template<>
struct push_front_impl<mpl::string_tag>
{
template<typename Sequence, typename Value, bool B = (4==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))>
struct apply
{
BOOST_MPL_ASSERT_MSG(
(BOOST_MPL_LIMIT_STRING_SIZE != mpl::size<Sequence>::type::value)
, PUSH_FRONT_FAILED_MPL_STRING_IS_FULL
, (Sequence)
);
// If the above assertion didn't fire, then the string is sparse.
// Repack the string and retry the push_front.
typedef
typename mpl::push_front<
typename mpl::reverse_copy<
Sequence
, mpl::front_inserter<string<> >
>::type
, Value
>::type
type;
};
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
template<typename Value>
struct apply<mpl::string<>, Value, false>
{
typedef mpl::string<(char)Value::value> type;
};
#endif
#define M0(z,n,data) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C), typename Value> \
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, Value, true> \
{ \
typedef \
mpl::string< \
(char)Value::value \
BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, C) \
> \
type; \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
#undef M0
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), typename Value>
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, Value, false>
{
typedef
mpl::string<
BOOST_MPL_MULTICHAR_PUSH_FRONT(C0, Value::value)
, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)
>
type0;
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
typedef
typename mpl::if_<
mpl::empty<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> >
, mpl::string<(char)Value::value>
, type0
>::type
type;
#else
typedef type0 type;
#endif
};
};
template<typename Tag>
struct has_push_front_impl;
template<>
struct has_push_front_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
template<typename Tag>
struct pop_front_impl;
template<>
struct pop_front_impl<mpl::string_tag>
{
template<typename Sequence, bool B = (1==BOOST_MPL_MULTICHAR_LENGTH(Sequence::front_))>
struct apply;
#define M0(z,n,data) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, int C)> \
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS_Z(z, n, C)>, true> \
{ \
BOOST_MPL_ASSERT_MSG((C0 != 0), POP_FRONT_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \
typedef \
mpl::string<BOOST_PP_ENUM_SHIFTED_PARAMS_Z(z, n, C)> \
type; \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
#undef M0
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)>
struct apply<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, false>
{
typedef
mpl::string<
BOOST_MPL_MULTICHAR_POP_FRONT(C0)
, BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)
>
type;
};
};
template<typename Tag>
struct has_pop_front_impl;
template<>
struct has_pop_front_impl<mpl::string_tag>
{
template<typename Sequence>
struct apply
: mpl::true_
{};
};
template<typename Tag>
struct insert_range_impl;
template<>
struct insert_range_impl<mpl::string_tag>
{
template<typename Sequence, typename Pos, typename Range>
struct apply
: mpl::copy<
mpl::joint_view<
mpl::iterator_range<
mpl::string_iterator<Sequence, 0, 0>
, Pos
>
, mpl::joint_view<
Range
, mpl::iterator_range<
Pos
, typename mpl::end<Sequence>::type
>
>
>
, mpl::back_inserter<mpl::string<> >
>
{};
};
template<typename Tag>
struct insert_impl;
template<>
struct insert_impl<mpl::string_tag>
{
template<typename Sequence, typename Pos, typename Value>
struct apply
: mpl::insert_range<Sequence, Pos, mpl::string<(char)Value::value> >
{};
};
template<typename Tag>
struct erase_impl;
template<>
struct erase_impl<mpl::string_tag>
{
template<typename Sequence, typename First, typename Last>
struct apply
: mpl::copy<
mpl::joint_view<
mpl::iterator_range<
mpl::string_iterator<Sequence, 0, 0>
, First
>
, mpl::iterator_range<
typename mpl::if_na<Last, typename mpl::next<First>::type>::type
, typename mpl::end<Sequence>::type
>
>
, mpl::back_inserter<mpl::string<> >
>
{};
};
template<typename Tag>
struct clear_impl;
template<>
struct clear_impl<mpl::string_tag>
{
template<typename>
struct apply
{
typedef mpl::string<> type;
};
};
#define M0(z, n, data) \
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C), int J> \
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, J> \
{ \
enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == J + 1) }; \
typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
typedef std::bidirectional_iterator_tag category; \
typedef \
mpl::string_iterator<string, n + eomc_, eomc_ ? 0 : J + 1> \
next; \
typedef \
mpl::string_iterator<string, n, J - 1> \
prior; \
typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), J)> type; \
}; \
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)> \
struct string_iterator<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)>, n, 0> \
{ \
enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == 1) }; \
typedef mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> string; \
typedef std::bidirectional_iterator_tag category; \
typedef \
mpl::string_iterator<string, n + eomc_, !eomc_> \
next; \
typedef \
mpl::string_iterator< \
string \
, n - 1 \
, BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, BOOST_PP_DEC(n))) - 1 \
> \
prior; \
typedef mpl::char_<BOOST_MPL_MULTICHAR_AT(BOOST_PP_CAT(C, n), 0)> type; \
};
BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_PARAMS, M0, ~)
#undef M0
template<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, int C)>
struct string
{
/// INTERNAL ONLY
enum
{
front_ = C0
, back_ = BOOST_PP_CAT(C, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS))
};
typedef char value_type;
typedef string type;
typedef string_tag tag;
};
namespace aux_
{
template<typename It, typename End>
struct next_unless
: mpl::next<It>
{};
template<typename End>
struct next_unless<End, End>
{
typedef End type;
};
template<typename It, typename End>
struct deref_unless
: mpl::deref<It>
{};
template<typename End>
struct deref_unless<End, End>
{
typedef mpl::char_<'\0'> type;
};
}
template<typename Sequence>
struct c_str
{
typedef typename mpl::end<Sequence>::type iend;
typedef typename mpl::begin<Sequence>::type i0;
#define M0(z, n, data) \
typedef \
typename mpl::aux_::next_unless<BOOST_PP_CAT(i, n), iend>::type \
BOOST_PP_CAT(i, BOOST_PP_INC(n));
BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
#undef M0
typedef c_str type;
static typename Sequence::value_type const value[BOOST_MPL_LIMIT_STRING_SIZE+1];
};
template<typename Sequence>
typename Sequence::value_type const c_str<Sequence>::value[BOOST_MPL_LIMIT_STRING_SIZE+1] =
{
#define M0(z, n, data) \
mpl::aux_::deref_unless<BOOST_PP_CAT(i, n), iend>::type::value,
BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~)
#undef M0
'\0'
};
}} // namespace boost
#endif // BOOST_MPL_STRING_HPP_INCLUDED

View File

@ -1,39 +0,0 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * Distributed under the Boost Software License, Version 1.0. (See
# * accompanying file LICENSE_1_0.txt or copy at
# * http://www.boost.org/LICENSE_1_0.txt)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_ARITHMETIC_DIV_HPP
# define BOOST_PREPROCESSOR_ARITHMETIC_DIV_HPP
#
# include <boost/preprocessor/arithmetic/detail/div_base.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
#
# /* BOOST_PP_DIV */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_DIV(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y))
# else
# define BOOST_PP_DIV(x, y) BOOST_PP_DIV_I(x, y)
# define BOOST_PP_DIV_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y))
# endif
#
# /* BOOST_PP_DIV_D */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_DIV_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y))
# else
# define BOOST_PP_DIV_D(d, x, y) BOOST_PP_DIV_D_I(d, x, y)
# define BOOST_PP_DIV_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y))
# endif
#
# endif

View File

@ -1,651 +0,0 @@
// Boost token_functions.hpp ------------------------------------------------//
// Copyright John R. Bandela 2001.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/tokenizer/ for documentation.
// Revision History:
// 01 Oct 2004 Joaquin M Lopez Munoz
// Workaround for a problem with string::assign in msvc-stlport
// 06 Apr 2004 John Bandela
// Fixed a bug involving using char_delimiter with a true input iterator
// 28 Nov 2003 Robert Zeh and John Bandela
// Converted into "fast" functions that avoid using += when
// the supplied iterator isn't an input_iterator; based on
// some work done at Archelon and a version that was checked into
// the boost CVS for a short period of time.
// 20 Feb 2002 John Maddock
// Removed using namespace std declarations and added
// workaround for BOOST_NO_STDC_NAMESPACE (the library
// can be safely mixed with regex).
// 06 Feb 2002 Jeremy Siek
// Added char_separator.
// 02 Feb 2002 Jeremy Siek
// Removed tabs and a little cleanup.
#ifndef BOOST_TOKEN_FUNCTIONS_JRB120303_HPP_
#define BOOST_TOKEN_FUNCTIONS_JRB120303_HPP_
#include <vector>
#include <stdexcept>
#include <string>
#include <cctype>
#include <algorithm> // for find_if
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/if.hpp>
#include <boost/throw_exception.hpp>
#if !defined(BOOST_NO_CWCTYPE)
#include <cwctype>
#endif
//
// the following must not be macros if we are to prefix them
// with std:: (they shouldn't be macros anyway...)
//
#ifdef ispunct
# undef ispunct
#endif
#ifdef iswpunct
# undef iswpunct
#endif
#ifdef isspace
# undef isspace
#endif
#ifdef iswspace
# undef iswspace
#endif
//
// fix namespace problems:
//
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{
using ::ispunct;
using ::isspace;
#if !defined(BOOST_NO_CWCTYPE)
using ::iswpunct;
using ::iswspace;
#endif
}
#endif
namespace boost{
//===========================================================================
// The escaped_list_separator class. Which is a model of TokenizerFunction
// An escaped list is a super-set of what is commonly known as a comma
// separated value (csv) list.It is separated into fields by a comma or
// other character. If the delimiting character is inside quotes, then it is
// counted as a regular character.To allow for embedded quotes in a field,
// there can be escape sequences using the \ much like C.
// The role of the comma, the quotation mark, and the escape
// character (backslash \), can be assigned to other characters.
struct escaped_list_error : public std::runtime_error{
escaped_list_error(const std::string& what_arg):std::runtime_error(what_arg) { }
};
// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
// MSVC does not like the following typename
template <class Char,
class Traits = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type >
class escaped_list_separator {
private:
typedef std::basic_string<Char,Traits> string_type;
struct char_eq {
Char e_;
char_eq(Char e):e_(e) { }
bool operator()(Char c) {
return Traits::eq(e_,c);
}
};
string_type escape_;
string_type c_;
string_type quote_;
bool last_;
bool is_escape(Char e) {
char_eq f(e);
return std::find_if(escape_.begin(),escape_.end(),f)!=escape_.end();
}
bool is_c(Char e) {
char_eq f(e);
return std::find_if(c_.begin(),c_.end(),f)!=c_.end();
}
bool is_quote(Char e) {
char_eq f(e);
return std::find_if(quote_.begin(),quote_.end(),f)!=quote_.end();
}
template <typename iterator, typename Token>
void do_escape(iterator& next,iterator end,Token& tok) {
if (++next == end)
BOOST_THROW_EXCEPTION(escaped_list_error(std::string("cannot end with escape")));
if (Traits::eq(*next,'n')) {
tok+='\n';
return;
}
else if (is_quote(*next)) {
tok+=*next;
return;
}
else if (is_c(*next)) {
tok+=*next;
return;
}
else if (is_escape(*next)) {
tok+=*next;
return;
}
else
BOOST_THROW_EXCEPTION(escaped_list_error(std::string("unknown escape sequence")));
}
public:
explicit escaped_list_separator(Char e = '\\',
Char c = ',',Char q = '\"')
: escape_(1,e), c_(1,c), quote_(1,q), last_(false) { }
escaped_list_separator(string_type e, string_type c, string_type q)
: escape_(e), c_(c), quote_(q), last_(false) { }
void reset() {last_=false;}
template <typename InputIterator, typename Token>
bool operator()(InputIterator& next,InputIterator end,Token& tok) {
bool bInQuote = false;
tok = Token();
if (next == end) {
if (last_) {
last_ = false;
return true;
}
else
return false;
}
last_ = false;
for (;next != end;++next) {
if (is_escape(*next)) {
do_escape(next,end,tok);
}
else if (is_c(*next)) {
if (!bInQuote) {
// If we are not in quote, then we are done
++next;
// The last character was a c, that means there is
// 1 more blank field
last_ = true;
return true;
}
else tok+=*next;
}
else if (is_quote(*next)) {
bInQuote=!bInQuote;
}
else {
tok += *next;
}
}
return true;
}
};
//===========================================================================
// The classes here are used by offset_separator and char_separator to implement
// faster assigning of tokens using assign instead of +=
namespace tokenizer_detail {
//===========================================================================
// Tokenizer was broken for wide character separators, at least on Windows, since
// CRT functions isspace etc only expect values in [0, 0xFF]. Debug build asserts
// if higher values are passed in. The traits extension class should take care of this.
// Assuming that the conditional will always get optimized out in the function
// implementations, argument types are not a problem since both forms of character classifiers
// expect an int.
#if !defined(BOOST_NO_CWCTYPE)
template<typename traits, int N>
struct traits_extension_details : public traits {
typedef typename traits::char_type char_type;
static bool isspace(char_type c)
{
return std::iswspace(c) != 0;
}
static bool ispunct(char_type c)
{
return std::iswpunct(c) != 0;
}
};
template<typename traits>
struct traits_extension_details<traits, 1> : public traits {
typedef typename traits::char_type char_type;
static bool isspace(char_type c)
{
return std::isspace(c) != 0;
}
static bool ispunct(char_type c)
{
return std::ispunct(c) != 0;
}
};
#endif
// In case there is no cwctype header, we implement the checks manually.
// We make use of the fact that the tested categories should fit in ASCII.
template<typename traits>
struct traits_extension : public traits {
typedef typename traits::char_type char_type;
static bool isspace(char_type c)
{
#if !defined(BOOST_NO_CWCTYPE)
return traits_extension_details<traits, sizeof(char_type)>::isspace(c);
#else
return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0;
#endif
}
static bool ispunct(char_type c)
{
#if !defined(BOOST_NO_CWCTYPE)
return traits_extension_details<traits, sizeof(char_type)>::ispunct(c);
#else
return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0;
#endif
}
};
// The assign_or_plus_equal struct contains functions that implement
// assign, +=, and clearing based on the iterator type. The
// generic case does nothing for plus_equal and clearing, while
// passing through the call for assign.
//
// When an input iterator is being used, the situation is reversed.
// The assign method does nothing, plus_equal invokes operator +=,
// and the clearing method sets the supplied token to the default
// token constructor's result.
//
template<class IteratorTag>
struct assign_or_plus_equal {
template<class Iterator, class Token>
static void assign(Iterator b, Iterator e, Token &t) {
t.assign(b, e);
}
template<class Token, class Value>
static void plus_equal(Token &, const Value &) { }
// If we are doing an assign, there is no need for the
// the clear.
//
template<class Token>
static void clear(Token &) { }
};
template <>
struct assign_or_plus_equal<std::input_iterator_tag> {
template<class Iterator, class Token>
static void assign(Iterator , Iterator , Token &) { }
template<class Token, class Value>
static void plus_equal(Token &t, const Value &v) {
t += v;
}
template<class Token>
static void clear(Token &t) {
t = Token();
}
};
template<class Iterator>
struct pointer_iterator_category{
typedef std::random_access_iterator_tag type;
};
template<class Iterator>
struct class_iterator_category{
typedef typename Iterator::iterator_category type;
};
// This portably gets the iterator_tag without partial template specialization
template<class Iterator>
struct get_iterator_category{
typedef typename mpl::if_<is_pointer<Iterator>,
pointer_iterator_category<Iterator>,
class_iterator_category<Iterator>
>::type cat;
typedef typename cat::type iterator_category;
};
} // namespace tokenizer_detail
//===========================================================================
// The offset_separator class, which is a model of TokenizerFunction.
// Offset breaks a string into tokens based on a range of offsets
class offset_separator {
private:
std::vector<int> offsets_;
unsigned int current_offset_;
bool wrap_offsets_;
bool return_partial_last_;
public:
template <typename Iter>
offset_separator(Iter begin, Iter end, bool wrap_offsets = true,
bool return_partial_last = true)
: offsets_(begin,end), current_offset_(0),
wrap_offsets_(wrap_offsets),
return_partial_last_(return_partial_last) { }
offset_separator()
: offsets_(1,1), current_offset_(),
wrap_offsets_(true), return_partial_last_(true) { }
void reset() {
current_offset_ = 0;
}
template <typename InputIterator, typename Token>
bool operator()(InputIterator& next, InputIterator end, Token& tok)
{
typedef tokenizer_detail::assign_or_plus_equal<
BOOST_DEDUCED_TYPENAME tokenizer_detail::get_iterator_category<
InputIterator
>::iterator_category
> assigner;
BOOST_ASSERT(!offsets_.empty());
assigner::clear(tok);
InputIterator start(next);
if (next == end)
return false;
if (current_offset_ == offsets_.size())
{
if (wrap_offsets_)
current_offset_=0;
else
return false;
}
int c = offsets_[current_offset_];
int i = 0;
for (; i < c; ++i) {
if (next == end)break;
assigner::plus_equal(tok,*next++);
}
assigner::assign(start,next,tok);
if (!return_partial_last_)
if (i < (c-1) )
return false;
++current_offset_;
return true;
}
};
//===========================================================================
// The char_separator class breaks a sequence of characters into
// tokens based on the character delimiters (very much like bad old
// strtok). A delimiter character can either be kept or dropped. A
// kept delimiter shows up as an output token, whereas a dropped
// delimiter does not.
// This class replaces the char_delimiters_separator class. The
// constructor for the char_delimiters_separator class was too
// confusing and needed to be deprecated. However, because of the
// default arguments to the constructor, adding the new constructor
// would cause ambiguity, so instead I deprecated the whole class.
// The implementation of the class was also simplified considerably.
enum empty_token_policy { drop_empty_tokens, keep_empty_tokens };
// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
template <typename Char,
typename Tr = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type >
class char_separator
{
typedef tokenizer_detail::traits_extension<Tr> Traits;
typedef std::basic_string<Char,Tr> string_type;
public:
explicit
char_separator(const Char* dropped_delims,
const Char* kept_delims = 0,
empty_token_policy empty_tokens = drop_empty_tokens)
: m_dropped_delims(dropped_delims),
m_use_ispunct(false),
m_use_isspace(false),
m_empty_tokens(empty_tokens),
m_output_done(false)
{
// Borland workaround
if (kept_delims)
m_kept_delims = kept_delims;
}
// use ispunct() for kept delimiters and isspace for dropped.
explicit
char_separator()
: m_use_ispunct(true),
m_use_isspace(true),
m_empty_tokens(drop_empty_tokens) { }
void reset() { }
template <typename InputIterator, typename Token>
bool operator()(InputIterator& next, InputIterator end, Token& tok)
{
typedef tokenizer_detail::assign_or_plus_equal<
BOOST_DEDUCED_TYPENAME tokenizer_detail::get_iterator_category<
InputIterator
>::iterator_category
> assigner;
assigner::clear(tok);
// skip past all dropped_delims
if (m_empty_tokens == drop_empty_tokens)
for (; next != end && is_dropped(*next); ++next)
{ }
InputIterator start(next);
if (m_empty_tokens == drop_empty_tokens) {
if (next == end)
return false;
// if we are on a kept_delims move past it and stop
if (is_kept(*next)) {
assigner::plus_equal(tok,*next);
++next;
} else
// append all the non delim characters
for (; next != end && !is_dropped(*next) && !is_kept(*next); ++next)
assigner::plus_equal(tok,*next);
}
else { // m_empty_tokens == keep_empty_tokens
// Handle empty token at the end
if (next == end)
{
if (m_output_done == false)
{
m_output_done = true;
assigner::assign(start,next,tok);
return true;
}
else
return false;
}
if (is_kept(*next)) {
if (m_output_done == false)
m_output_done = true;
else {
assigner::plus_equal(tok,*next);
++next;
m_output_done = false;
}
}
else if (m_output_done == false && is_dropped(*next)) {
m_output_done = true;
}
else {
if (is_dropped(*next))
start=++next;
for (; next != end && !is_dropped(*next) && !is_kept(*next); ++next)
assigner::plus_equal(tok,*next);
m_output_done = true;
}
}
assigner::assign(start,next,tok);
return true;
}
private:
string_type m_kept_delims;
string_type m_dropped_delims;
bool m_use_ispunct;
bool m_use_isspace;
empty_token_policy m_empty_tokens;
bool m_output_done;
bool is_kept(Char E) const
{
if (m_kept_delims.length())
return m_kept_delims.find(E) != string_type::npos;
else if (m_use_ispunct) {
return Traits::ispunct(E) != 0;
} else
return false;
}
bool is_dropped(Char E) const
{
if (m_dropped_delims.length())
return m_dropped_delims.find(E) != string_type::npos;
else if (m_use_isspace) {
return Traits::isspace(E) != 0;
} else
return false;
}
};
//===========================================================================
// The following class is DEPRECATED, use class char_separators instead.
//
// The char_delimiters_separator class, which is a model of
// TokenizerFunction. char_delimiters_separator breaks a string
// into tokens based on character delimiters. There are 2 types of
// delimiters. returnable delimiters can be returned as
// tokens. These are often punctuation. nonreturnable delimiters
// cannot be returned as tokens. These are often whitespace
// The out of the box GCC 2.95 on cygwin does not have a char_traits class.
template <class Char,
class Tr = BOOST_DEDUCED_TYPENAME std::basic_string<Char>::traits_type >
class char_delimiters_separator {
private:
typedef tokenizer_detail::traits_extension<Tr> Traits;
typedef std::basic_string<Char,Tr> string_type;
string_type returnable_;
string_type nonreturnable_;
bool return_delims_;
bool no_ispunct_;
bool no_isspace_;
bool is_ret(Char E)const
{
if (returnable_.length())
return returnable_.find(E) != string_type::npos;
else{
if (no_ispunct_) {return false;}
else{
int r = Traits::ispunct(E);
return r != 0;
}
}
}
bool is_nonret(Char E)const
{
if (nonreturnable_.length())
return nonreturnable_.find(E) != string_type::npos;
else{
if (no_isspace_) {return false;}
else{
int r = Traits::isspace(E);
return r != 0;
}
}
}
public:
explicit char_delimiters_separator(bool return_delims = false,
const Char* returnable = 0,
const Char* nonreturnable = 0)
: returnable_(returnable ? returnable : string_type().c_str()),
nonreturnable_(nonreturnable ? nonreturnable:string_type().c_str()),
return_delims_(return_delims), no_ispunct_(returnable!=0),
no_isspace_(nonreturnable!=0) { }
void reset() { }
public:
template <typename InputIterator, typename Token>
bool operator()(InputIterator& next, InputIterator end,Token& tok) {
tok = Token();
// skip past all nonreturnable delims
// skip past the returnable only if we are not returning delims
for (;next!=end && ( is_nonret(*next) || (is_ret(*next)
&& !return_delims_ ) );++next) { }
if (next == end) {
return false;
}
// if we are to return delims and we are one a returnable one
// move past it and stop
if (is_ret(*next) && return_delims_) {
tok+=*next;
++next;
}
else
// append all the non delim characters
for (;next!=end && !is_nonret(*next) && !is_ret(*next);++next)
tok+=*next;
return true;
}
};
} //namespace boost
#endif

View File

@ -1,128 +0,0 @@
// Boost token_iterator.hpp -------------------------------------------------//
// Copyright John R. Bandela 2001
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/tokenizer for documentation.
// Revision History:
// 16 Jul 2003 John Bandela
// Allowed conversions from convertible base iterators
// 03 Jul 2003 John Bandela
// Converted to new iterator adapter
#ifndef BOOST_TOKENIZER_POLICY_JRB070303_HPP_
#define BOOST_TOKENIZER_POLICY_JRB070303_HPP_
#include <boost/assert.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/minimum_category.hpp>
#include <boost/token_functions.hpp>
#include <utility>
namespace boost
{
template <class TokenizerFunc, class Iterator, class Type>
class token_iterator
: public iterator_facade<
token_iterator<TokenizerFunc, Iterator, Type>
, Type
, typename iterators::minimum_category<
forward_traversal_tag
, typename iterator_traversal<Iterator>::type
>::type
, const Type&
>
{
friend class iterator_core_access;
TokenizerFunc f_;
Iterator begin_;
Iterator end_;
bool valid_;
Type tok_;
void increment(){
BOOST_ASSERT(valid_);
valid_ = f_(begin_,end_,tok_);
}
const Type& dereference() const {
BOOST_ASSERT(valid_);
return tok_;
}
template<class Other>
bool equal(const Other& a) const{
return (a.valid_ && valid_)
?( (a.begin_==begin_) && (a.end_ == end_) )
:(a.valid_==valid_);
}
void initialize(){
if(valid_) return;
f_.reset();
valid_ = (begin_ != end_)?
f_(begin_,end_,tok_):false;
}
public:
token_iterator():begin_(),end_(),valid_(false),tok_() { }
token_iterator(TokenizerFunc f, Iterator begin, Iterator e = Iterator())
: f_(f),begin_(begin),end_(e),valid_(false),tok_(){ initialize(); }
token_iterator(Iterator begin, Iterator e = Iterator())
: f_(),begin_(begin),end_(e),valid_(false),tok_() {initialize();}
template<class OtherIter>
token_iterator(
token_iterator<TokenizerFunc, OtherIter,Type> const& t
, typename enable_if_convertible<OtherIter, Iterator>::type* = 0)
: f_(t.tokenizer_function()),begin_(t.base())
,end_(t.end()),valid_(!t.at_end()),tok_(t.current_token()) {}
Iterator base()const{return begin_;}
Iterator end()const{return end_;}
TokenizerFunc tokenizer_function()const{return f_;}
Type current_token()const{return tok_;}
bool at_end()const{return !valid_;}
};
template <
class TokenizerFunc = char_delimiters_separator<char>,
class Iterator = std::string::const_iterator,
class Type = std::string
>
class token_iterator_generator {
private:
public:
typedef token_iterator<TokenizerFunc,Iterator,Type> type;
};
// Type has to be first because it needs to be explicitly specified
// because there is no way the function can deduce it.
template<class Type, class Iterator, class TokenizerFunc>
typename token_iterator_generator<TokenizerFunc,Iterator,Type>::type
make_token_iterator(Iterator begin, Iterator end,const TokenizerFunc& fun){
typedef typename
token_iterator_generator<TokenizerFunc,Iterator,Type>::type ret_type;
return ret_type(fun,begin,end);
}
} // namespace boost
#endif

View File

@ -1,98 +0,0 @@
// Boost tokenizer.hpp -----------------------------------------------------//
// (c) Copyright Jeremy Siek and John R. Bandela 2001.
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/tokenizer for documenation
// Revision History:
// 03 Jul 2003 John Bandela
// Converted to new iterator adapter
// 02 Feb 2002 Jeremy Siek
// Removed tabs and a little cleanup.
#ifndef BOOST_TOKENIZER_JRB070303_HPP_
#define BOOST_TOKENIZER_JRB070303_HPP_
#include <boost/token_iterator.hpp>
namespace boost {
//===========================================================================
// A container-view of a tokenized "sequence"
template <
typename TokenizerFunc = char_delimiters_separator<char>,
typename Iterator = std::string::const_iterator,
typename Type = std::string
>
class tokenizer {
private:
typedef token_iterator_generator<TokenizerFunc,Iterator,Type> TGen;
// It seems that MSVC does not like the unqualified use of iterator,
// Thus we use iter internally when it is used unqualified and
// the users of this class will always qualify iterator.
typedef typename TGen::type iter;
public:
typedef iter iterator;
typedef iter const_iterator;
typedef Type value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* pointer;
typedef const pointer const_pointer;
typedef void size_type;
typedef void difference_type;
tokenizer(Iterator first, Iterator last,
const TokenizerFunc& f = TokenizerFunc())
: first_(first), last_(last), f_(f) { }
template <typename Container>
tokenizer(const Container& c)
: first_(c.begin()), last_(c.end()), f_() { }
template <typename Container>
tokenizer(const Container& c,const TokenizerFunc& f)
: first_(c.begin()), last_(c.end()), f_(f) { }
void assign(Iterator first, Iterator last){
first_ = first;
last_ = last;
}
void assign(Iterator first, Iterator last, const TokenizerFunc& f){
assign(first,last);
f_ = f;
}
template <typename Container>
void assign(const Container& c){
assign(c.begin(),c.end());
}
template <typename Container>
void assign(const Container& c, const TokenizerFunc& f){
assign(c.begin(),c.end(),f);
}
iter begin() const { return iter(f_,first_,last_); }
iter end() const { return iter(f_,last_,last_); }
private:
Iterator first_;
Iterator last_;
TokenizerFunc f_;
};
} // namespace boost
#endif

View File

@ -1,15 +0,0 @@
// (C) Copyright Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
//
// defines is_same:
#ifndef BOOST_TT_SAME_TRAITS_HPP_INCLUDED
#define BOOST_TT_SAME_TRAITS_HPP_INCLUDED
#include <boost/type_traits/is_same.hpp>
#endif // BOOST_TT_SAME_TRAITS_HPP_INCLUDED

View File

@ -25,24 +25,17 @@ bcp --boost=$1 \
boost/bind.hpp \
boost/crc.hpp \
boost/cstdint.hpp \
boost/format.hpp \
boost/function.hpp \
boost/functional.hpp \
boost/lexical_cast.hpp \
boost/noncopyable.hpp \
boost/regex.hpp \
boost/scoped_array.hpp \
boost/scoped_ptr.hpp \
boost/shared_ptr.hpp \
boost/signal.hpp \
boost/signals/connection.hpp \
boost/signals/trackable.hpp \
boost/tokenizer.hpp \
boost/tuple/tuple.hpp \
boost/mpl/string.hpp \
boost/mpl/fold.hpp \
boost/mpl/size_t.hpp \
boost/functional/hash.hpp \
\
needed

View File

@ -1,8 +1,5 @@
include $(top_srcdir)/config/common.am
# This is prepared for compilation, but currently only used for packaging,
# because configure support for compilation is still missing.
noinst_LIBRARIES = liblyxhunspell.a
EXTRA_DIST = \
@ -20,7 +17,10 @@ EXTRA_DIST = \
1.3.3/src/hunspell/license.hunspell \
1.3.3/src/hunspell/license.myspell \
1.3.3/src/hunspell/makefile.mk \
1.3.3/src/hunspell/README
1.3.3/src/hunspell/README \
1.3.3/src/hunspell/utf_info.cxx
AM_CPPFLAGS += -DHUNSPELL_STATIC
liblyxhunspell_a_SOURCES = \
1.3.3/src/hunspell/affentry.cxx \
@ -51,7 +51,6 @@ liblyxhunspell_a_SOURCES = \
1.3.3/src/hunspell/replist.hxx \
1.3.3/src/hunspell/suggestmgr.cxx \
1.3.3/src/hunspell/suggestmgr.hxx \
1.3.3/src/hunspell/utf_info.cxx \
1.3.3/src/hunspell/w_char.hxx \
1.3.3/src/parsers/firstparser.cxx \
1.3.3/src/parsers/firstparser.hxx \

View File

@ -1,10 +1,7 @@
include $(top_srcdir)/config/common.am
# This is prepared for compilation, but currently only used for packaging,
# because configure support for compilation is still missing.
# We do not build right now
#noinst_LIBRARIES = liblyxiconv.a
noinst_LIBRARIES = liblyxiconv.a
EXTRA_DIST = \
CMakeLists.txt \
@ -33,11 +30,15 @@ EXTRA_DIST = \
1.14/libcharset/lib/ref-add.sin \
1.14/libcharset/lib/ref-del.sin
# If/when we decide to build, this will do in liblyxiconv_a_SOURCES
# But for now it confuses automake < 1.14, where we do not use subdir-objects.
# The issue here is that there are two relocatable.c files, and they would
# create the same .o file.
EXTRA_DIST += \
AM_CPPFLAGS += -I$(srcdir)/1.14/srclib -DLIBDIR=""
# The two relocatable.c files confuse automake < 1.14, where we do not use
# subdir-objects. Therefore we cannot put both in liblyxiconv_a_SOURCES
# (they would both create the same .o file). Fortunately their contents is
# identical, so it is enough to build only one.
EXTRA_DIST += 1.14/libcharset/lib/relocatable.c
liblyxiconv_a_SOURCES = \
1.14/include/export.h \
1.14/lib/aliases2.h \
1.14/lib/aliases_aix.h \
@ -263,7 +264,6 @@ EXTRA_DIST += \
1.14/lib/viscii.h \
1.14/libcharset/include/export.h \
1.14/libcharset/lib/localcharset.c \
1.14/libcharset/lib/relocatable.c \
1.14/libcharset/lib/relocatable.h \
1.14/srclib/localcharset.h \
1.14/srclib/unitypes.in.h \

511
3rdparty/zlib/1.2.8/zconf.h.in vendored Normal file
View File

@ -0,0 +1,511 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2013 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzvprintf z_gzvprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateGetDictionary z_inflateGetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

View File

@ -1,14 +1,12 @@
include $(top_srcdir)/config/common.am
# This is prepared for compilation, but currently only used for packaging,
# because configure support for compilation is still missing.
noinst_LIBRARIES = liblyxzlib.a
EXTRA_DIST = \
CMakeLists.txt \
1.2.8/README \
1.2.8/treebuild.xml \
1.2.8/zconf.h.in \
1.2.8/zconf.h.cmakein \
1.2.8/zlib.3 \
1.2.8/zlib.map \

View File

@ -107,3 +107,45 @@ Creating the Installer
- Copy the 3 dll-files from there to the DLL folder of the NSIS installation
- Check whether the file locations/paths in settings.nsh match your setup.
- Right-click on lyx.nsi and click "Compile NSIS Script".
Compiling with GCC with MinGW64 + MSYS2 Environment using autotools
===================================================================
1 Install MSYS2, MINGW64, Qt5+
https://wiki.qt.io/MSYS2
2 Install bc (Bench calculater), which autotools uses for some reason to compile LyX
pacman -S bc
3 Run the standard autotools install (Adapt paths and arguments accordingly)
./autogen.sh
./configure --without-x --enable-qt5 --disable-debug --enable-optimization --prefix=/mingw64
make
make install
Cross-Compiling on unix with MXE using autotools
=================================================
1 Install MXE: http://mxe.cc
You can either install from sources, the generic .tar binaries or debian .deb packages.
Installing the following .deb packages will drag in all needed dependencies:
mxe-x86-64-w64-mingw32.shared-file
mxe-x86-64-w64-mingw32.shared-gcc
mxe-x86-64-w64-mingw32.shared-libiconv
mxe-x86-64-w64-mingw32.shared-qtimageformats
mxe-x86-64-w64-mingw32.shared-qtsvg
mxe-x86-64-w64-mingw32.shared-qtwinextras
Of course you can also use the static and/or 32bit versions.
2 Run the standard autotools install (Adapt paths and arguments accordingly)
./autogen.sh
mkdir builddir-mingw
cd builddir-mingw
PATH="/usr/lib/mxe/usr/bin:$PATH" ../configure --host=x86-64-w64-mingw32.shared --with-qt-dir=/usr/lib/mxe/usr/x86_64-w64-mingw32.shared/qt5 --enable-qt5 --with-included-boost --with-included-hunspell --with-included-mythes --disable-debug --enable-optimization --prefix=/mingw64
PATH="/usr/lib/mxe/usr/bin:$PATH" make
PATH="/usr/lib/mxe/usr/bin:$PATH" DESTDIR=/tmp/lyxinstall make install
This uses the paths from the 64bit shared MXE version installed from .deb packages.
3 If you want to run the resulting lyx.exe from the build directory using wine,
create symlinks for all needed .dlls:
cd builddir-mingw/src
ln -s /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/bin/*.dll .
ln -s /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/qt5/bin/*.dll .
wine64 lyx.exe

View File

@ -454,6 +454,100 @@ AC_DEFUN([LYX_USE_INCLUDED_BOOST],[
])
dnl Usage: LYX_USE_INCLUDED_ICONV : select if the included iconv should
dnl be used.
AC_DEFUN([LYX_USE_INCLUDED_ICONV],[
AC_MSG_CHECKING([whether to use included iconv library])
AC_ARG_WITH(included-iconv,
[AC_HELP_STRING([--without-included-iconv], [do not use the iconv lib supplied with LyX, try to find one in the system directories - compilation will abort if nothing suitable is found])],
[lyx_cv_with_included_iconv=$withval],
[lyx_cv_with_included_iconv=no])
AM_CONDITIONAL(USE_INCLUDED_ICONV, test x$lyx_cv_with_included_iconv = xyes)
AC_MSG_RESULT([$lyx_cv_with_included_iconv])
if test x$lyx_cv_with_included_iconv = xyes ; then
dnl Some bits from libiconv configure.ac to avoid a nested configure call:
AC_EILSEQ
AC_TYPE_MBSTATE_T
AC_CHECK_FUNCS([getc_unlocked mbrtowc wcrtomb mbsinit setlocale])
dnl Ymbstate_t is used if HAVE_WCRTOMB || HAVE_MBRTOWC, see 3rdparty/libiconv/1.14/lib/loop_wchar.h.
if test $ac_cv_func_wcrtomb = yes || test $ac_cv_func_mbrtowc = yes; then
USE_MBSTATE_T=1
else
USE_MBSTATE_T=0
fi
AC_SUBST([USE_MBSTATE_T])
AC_CACHE_CHECK([whether <wchar.h> is standalone],
[gl_cv_header_wchar_h_standalone],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <wchar.h>
wchar_t w;]],
[[]])],
[gl_cv_header_wchar_h_standalone=yes],
[gl_cv_header_wchar_h_standalone=no])])
if test $gl_cv_header_wchar_h_standalone = yes; then
BROKEN_WCHAR_H=0
else
BROKEN_WCHAR_H=1
fi
AC_SUBST([BROKEN_WCHAR_H])
dnl we want const correctness
AC_DEFINE_UNQUOTED([ICONV_CONST], [const],
[Define as const if the declaration of iconv() needs const.])
ICONV_CONST=const
AC_SUBST([ICONV_CONST])
dnl we build a static lib
DLL_VARIABLE=
AC_SUBST([DLL_VARIABLE])
ICONV_INCLUDES='-I$(top_srcdir)/3rdparty/libiconv/1.14 -I$(top_builddir)/3rdparty/libiconv'
ICONV_LIBS='\$(top_builddir)/3rdparty/libiconv/liblyxiconv.a'
ICONV_ICONV_H_IN=3rdparty/libiconv/iconv.h:3rdparty/libiconv/1.14/include/iconv.h.in
else
ICONV_INCLUDES=
AM_ICONV
if test "$am_cv_func_iconv" = no; then
AC_MSG_ERROR([cannot find required library iconv.])
else
ICONV_LIBS="$LIBICONV"
fi
ICONV_ICONV_H_IN=
fi
AC_SUBST(ICONV_INCLUDES)
AC_SUBST(ICONV_LIBS)
AC_SUBST(ICONV_ICONV_H_IN)
])
dnl Usage: LYX_USE_INCLUDED_ZLIB : select if the included zlib should
dnl be used.
AC_DEFUN([LYX_USE_INCLUDED_ZLIB],[
AC_MSG_CHECKING([whether to use included zlib library])
AC_ARG_WITH(included-zlib,
[AC_HELP_STRING([--without-included-zlib], [do not use the zlib lib supplied with LyX, try to find one in the system directories - compilation will abort if nothing suitable is found])],
[lyx_cv_with_included_zlib=$withval],
[lyx_cv_with_included_zlib=no])
AM_CONDITIONAL(USE_INCLUDED_ZLIB, test x$lyx_cv_with_included_zlib = xyes)
AC_MSG_RESULT([$lyx_cv_with_included_zlib])
if test x$lyx_cv_with_included_zlib = xyes ; then
ZLIB_INCLUDES='-I$(top_srcdir)/3rdparty/zlib/1.2.8 -I$(top_builddir)/3rdparty/zlib'
ZLIB_LIBS='$(top_builddir)/3rdparty/zlib/liblyxzlib.a'
mkdir -p 3rdparty/zlib
dnl include standard config.h for HAVE_UNISTD_H
echo "#include <../../config.h>" > 3rdparty/zlib/zconf.h
dnl prevent clash with system zlib that might be dragged in by other libs
echo "#define Z_PREFIX 1" >> 3rdparty/zlib/zconf.h
cat "${srcdir}/3rdparty/zlib/1.2.8/zconf.h.in" >> 3rdparty/zlib/zconf.h
else
ZLIB_INCLUDES=
AC_CHECK_HEADERS(zlib.h,
[AC_CHECK_LIB(z, gzopen, [ZLIB_LIBS="-lz"], LYX_LIB_ERROR(libz,zlib))],
[LYX_LIB_ERROR(zlib.h,zlib)])
fi
AC_SUBST(ZLIB_INCLUDES)
AC_SUBST(ZLIB_LIBS)
])
dnl Usage: LYX_CHECK_CALLSTACK_PRINTING: define LYX_CALLSTACK_PRINTING if the
dnl necessary APIs are available to print callstacks.
AC_DEFUN([LYX_CHECK_CALLSTACK_PRINTING],
@ -600,7 +694,8 @@ AC_ARG_WITH(packaging,
[lyx_use_packaging="$withval"], [
case $host in
*-apple-darwin*) lyx_use_packaging=macosx ;;
*-pc-mingw32*) lyx_use_packaging=windows ;;
*-pc-mingw*) lyx_use_packaging=windows ;;
*-mingw32*) lyx_use_packaging=windows ;;
*haiku*) lyx_use_packaging=haiku ;;
*) lyx_use_packaging=posix ;;
esac])

View File

@ -253,8 +253,13 @@ AC_DEFUN([QT_DO_PKG_CONFIG],
AC_DEFUN([QT_DO_MANUAL_CONFIG],
[
dnl Check for X libraries
AC_PATH_X
AC_PATH_XTRA
case ${host} in
*mingw*) ;;
*) \
AC_PATH_X \
AC_PATH_XTRA \
;;
esac
case $have_x in
yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS";;

View File

@ -68,16 +68,43 @@ AC_DEFUN([CHECK_WITH_HUNSPELL],
fi
])
dnl Usage: LYX_USE_INCLUDED_HUNSPELL : select if the included hunspell should
dnl be used.
AC_DEFUN([LYX_USE_INCLUDED_HUNSPELL],[
AC_MSG_CHECKING([whether to use included hunspell library])
AC_ARG_WITH(included-hunspell,
[AC_HELP_STRING([--without-included-hunspell], [do not use the hunspell lib supplied with LyX, try to find one in the system directories - compilation will abort if nothing suitable is found])],
[lyx_cv_with_included_hunspell=$withval],
[lyx_cv_with_included_hunspell=no])
AM_CONDITIONAL(USE_INCLUDED_HUNSPELL, test x$lyx_cv_with_included_hunspell = xyes)
AC_MSG_RESULT([$lyx_cv_with_included_hunspell])
if test x$lyx_cv_with_included_hunspell = xyes ; then
HUNSPELL_CFLAGS='-I$(top_srcdir)/3rdparty/hunspell/1.3.3/src'
HUNSPELL_LIBS='$(top_builddir)/3rdparty/hunspell/liblyxhunspell.a'
AC_SUBST(HUNSPELL_CFLAGS)
AC_SUBST(HUNSPELL_LIBS)
fi
])
### Check if we want spell libraries, prefer new aspell or hunspell
AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
[
LYX_USE_INCLUDED_HUNSPELL
if test x$lyx_cv_with_included_hunspell = xyes ; then
dnl the user wanted to use the included hunspell, so do not check for the other spell checkers
lyx_use_aspell=false
lyx_use_enchant=false
lyx_use_hunspell=true
lyx_flags="$lyx_flags use-hunspell"
else
CHECK_WITH_ASPELL
AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
CHECK_WITH_ENCHANT
AM_CONDITIONAL(USE_ENCHANT, $lyx_use_enchant)
CHECK_WITH_HUNSPELL
fi
AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
AM_CONDITIONAL(USE_ENCHANT, $lyx_use_enchant)
AM_CONDITIONAL(USE_HUNSPELL, $lyx_use_hunspell)
])

View File

@ -74,6 +74,9 @@ AM_PATH_PYTHON
# Tools for creating libraries (note that we do not use libtool)
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl AM_PROG_AR requires automake 1.12
AC_PROG_RANLIB
dnl Recent debian/ubuntu (at least) have built 'ar' so that deterministic mode is the default.
dnl This means that it does not make sense to use the 'u' flag (default ARFLAGS is 'cru').
AC_SUBST([ARFLAGS], [cr])
### Check for a C++ compiler
dnl We have to do weird tricks so that autoconf does not touch CXXFLAGS even
@ -116,6 +119,7 @@ AC_SUBST(LIBSHLWAPI)
AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
AC_SUBST(LIBPSAPI)
AC_CHECK_LIB(gdi32, main)
AC_CHECK_LIB(ole32, main)
LYX_USE_INCLUDED_BOOST
LYX_USE_INCLUDED_MYTHES
@ -129,18 +133,31 @@ LYX_CHECK_CALLSTACK_PRINTING
# Needed for our char_type
AC_CHECK_SIZEOF(wchar_t)
### We need iconv for unicode support (Qt4 frontend requires it too)
AM_ICONV
if test "$am_cv_func_iconv" = no; then
AC_MSG_ERROR([cannot find required library iconv.])
# Taken from gettext, needed for libiconv
AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
[AC_TRY_COMPILE([#include <stddef.h>
wchar_t foo = (wchar_t)'\0';], ,
[gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
if test $gt_cv_c_wchar_t = yes; then
AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
HAVE_WCHAR_T=1
else
LIBS="$LIBS $LIBICONV"
HAVE_WCHAR_T=0
fi
AC_SUBST([HAVE_WCHAR_T])
# Needed for Mingw-w64
AC_TYPE_LONG_LONG_INT
if test "$ac_cv_type_long_long_int" = yes; then
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
fi
### We need iconv for unicode support (Qt4 frontend requires it too)
LYX_USE_INCLUDED_ICONV
### check for compression support
AC_CHECK_HEADERS(zlib.h,
[AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
[LYX_LIB_ERROR(zlib.h,zlib)])
LYX_USE_INCLUDED_ZLIB
### check for file magic support (currently optional)
AC_CHECK_HEADERS(magic.h,
@ -191,14 +208,6 @@ AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
# Taken from gettext
AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
[AC_TRY_COMPILE([#include <stddef.h>
wchar_t foo = (wchar_t)'\0';], ,
[gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
if test $gt_cv_c_wchar_t = yes; then
AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
fi
LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
@ -229,6 +238,12 @@ lyx_win_res=false;
case ${host} in
*mingw*|*cygwin*) lyx_win_res=true;;
esac
if test "x$lyx_win_res" = "xtrue"; then
AC_CHECK_TOOL(RC, windres,)
if test -z "$RC"; then
AC_ERROR([Could not find a resource compiler])
fi
fi
AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
LYX_SET_VERSION_INFO
@ -290,12 +305,6 @@ extern "C"
char * strerror(int n);
#endif
#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
# define USE_BOOST_FORMAT 1
#else
# define USE_BOOST_FORMAT 0
#endif
#define BOOST_USER_CONFIG <config.h>
#if !defined(ENABLE_ASSERTIONS)
@ -325,6 +334,12 @@ char * strerror(int n);
# define USE_WCHAR_T
#endif
#ifdef HAVE_LONG_LONG_INT
#if SIZEOF_LONG_LONG > SIZEOF_LONG
#define LYX_USE_LONG_LONG
#endif
#endif
#endif
])
@ -356,6 +371,7 @@ AC_CONFIG_FILES([Makefile \
3rdparty/boost/Makefile \
3rdparty/hunspell/Makefile \
3rdparty/libiconv/Makefile \
$ICONV_ICONV_H_IN \
3rdparty/zlib/Makefile \
autotests/Makefile \
config/Makefile \

View File

@ -159,7 +159,6 @@ cmake/modules/PCHSupport_26.cmake \
cmake/modules/ProjectSourceGroup.cmake \
cmake/pcheaders.h \
cmake/po/cat.py \
cmake/po/dos2unix.py \
cmake/po/unix2dos.py \
cmake/post_install/CMakeLists.txt \
cmake/scripts/LyXCreateImagesResource.cmake \

View File

@ -114,6 +114,13 @@ check_cxx_source_compiles(
"
SIZEOF_WCHAR_T_IS_4)
check_cxx_source_compiles(
"
int i[ ( sizeof(long long)>sizeof(long) ? 1 : -1 ) ];
int main(){return 0;}
"
SIZEOF_LONG_LONG_GREATER_THAN_SIZEOF_LONG)
check_cxx_source_compiles(
"
#include <execinfo.h>

View File

@ -42,6 +42,7 @@
#cmakedefine HAVE_MAGIC_H 1
#cmakedefine SIZEOF_WCHAR_T_IS_2 1
#cmakedefine SIZEOF_WCHAR_T_IS_4 1
#cmakedefine SIZEOF_LONG_LONG_GREATER_THAN_SIZEOF_LONG 1
#ifdef SIZEOF_WCHAR_T_IS_2
# define SIZEOF_WCHAR_T 2
@ -51,6 +52,12 @@
# endif
#endif
#ifdef HAVE_LONG_LONG
#ifdef SIZEOF_LONG_LONG_GREATER_THAN_SIZEOF_LONG
#define LYX_USE_LONG_LONG
#endif
#endif
#cmakedefine GETTEXT_FOUND 1
#cmakedefine HAVE_ALLOCA 1
@ -78,12 +85,6 @@
#define BOOST_ALL_NO_LIB 1
#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
# define USE_BOOST_FORMAT 1
#else
# define USE_BOOST_FORMAT 0
#endif
#ifdef _DEBUG
# define ENABLE_ASSERTIONS 1
#endif

View File

@ -124,12 +124,6 @@
#define BOOST_ALL_NO_LIB 1
#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
# define USE_BOOST_FORMAT 1
#else
# define USE_BOOST_FORMAT 0
#endif
#ifdef _DEBUG
# define ENABLE_ASSERTIONS 1
#endif
@ -152,6 +146,12 @@
# define USE_WCHAR_T
#endif
#ifdef HAVE_LONG_LONG
#ifdef SIZEOF_LONG_LONG_GREATER_THAN_SIZEOF_LONG
#define LYX_USE_LONG_LONG
#endif
#endif
#if defined(MAKE_INTL_LIB) && defined(_MSC_VER)
#define __attribute__(x)
#define inline

View File

@ -25,11 +25,17 @@ for (opt, param) in options:
out = sys.stdout
if outfile:
out = open(outfile, "w")
# always write unix line endings, even on windows
out = open(outfile, "wb")
for f in args:
fil = open(f, "r")
# accept both windows and unix line endings, since it can happen that we
# are on unix, but the file has been written on windows or vice versa.
fil = open(f, "rU")
for l in fil:
# this does always write unix line endings since the file has
# been opened in binary mode. This is needed since both gettext
# and our .pot file manipulation scripts assume unix line ends.
out.write(l)
fil.close()

View File

@ -1,17 +0,0 @@
#! /usr/bin/env python
###############
import sys
for fname in sys.argv[1:]:
infile = open( fname, "r" )
instr = infile.read()
infile.close()
outstr = instr.replace( "\r\n", "\n" ).replace( "\r", "\n" )
if outstr == instr:
continue
outfile = open( fname , "w" )
outfile.write( outstr )
outfile.close()

View File

@ -169,6 +169,9 @@
@bStefano Ghirlanda
@iE-mail: stefano.ghirlanda () unibo ! it
Improvements to lyxserver
@bShankar Giri Venkita Giri
@iE-mail: girivs () gmx ! com
Mingw-w64 build fixes
@bHartmut Goebel
@iE-mail: h.goebel () crazy-compilers ! com
Improvements to Koma-Script classes

View File

@ -233,7 +233,7 @@ filename "../examples/linguistics.lyx"
\begin_layout Plain Layout
\begin_inset CommandInset include
LatexCommand include
filename "../lib/examples/xypic.lyx"
filename "../examples/xypic.lyx"
\end_inset

View File

@ -134,11 +134,12 @@ enumitem
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\tracking_changes true
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict true
\author 986154928 "Gnter Milde"
\end_header
\begin_body
@ -8310,14 +8311,12 @@ Verbatim
\end_layout
\begin_layout Verbatim
This is Verbatim.
\end_layout
\begin_layout Verbatim
\noindent
\align block
The following 2 lines are empty:
\end_layout
@ -8330,7 +8329,6 @@ The following 2 lines are empty:
\end_layout
\begin_layout Verbatim
Almost everything is allowed in Verbatim:"%&$§#~'`
\backslash
}][{|
@ -8354,7 +8352,6 @@ Verbatim
\end_layout
\begin_layout Verbatim*
This is Verbatim*.
\end_layout
@ -16982,6 +16979,42 @@ open close
"
\family default
, generates this automatically.
\change_inserted 986154928 1464030688
\begin_inset Foot
status collapsed
\begin_layout Plain Layout
\change_inserted 986154928 1464016381
You can, of course, remove this
\begin_inset Quotes eld
\end_inset
smart quotes
\begin_inset Quotes erd
\end_inset
keybinding if you prefer.
See section
\begin_inset space ~
\end_inset
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:Editing-Shortcuts"
\end_inset
.
\end_layout
\end_inset
\change_unchanged
\end_layout
\begin_layout Standard
@ -17153,7 +17186,23 @@ this
\end_layout
\begin_layout Standard
For single quotes you have to use the shortcut
For
\change_inserted 986154928 1464016392
\begin_inset Quotes eld
\end_inset
smart
\begin_inset Quotes erd
\end_inset
\change_unchanged
single quotes
\change_deleted 986154928 1464016400
you have to
\change_unchanged
use the shortcut
\begin_inset Info
type "shortcut"
arg "quote-insert single"

File diff suppressed because it is too large Load Diff

View File

@ -771,6 +771,14 @@ contributors = [
"28 February 2005",
u"Improvements to lyxserver"),
contributor(u"Shankar Giri Venkita Giri",
"girivs () gmx ! com",
"GPL",
"Blanket permission",
"m=146162343015182",
"25 April 2016",
u"Mingw-w64 build fixes"),
contributor(u"Hartmut Goebel",
"h.goebel () crazy-compilers ! com",
"GPL",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1103,7 +1103,7 @@ pod lyxblacktext 0 0 func x amsmath
# mathtools.sty
\def\vcentcolon{\kern4mu:\kern3mu} mathtools
\def\vcentcolon{:} mathtools
\def\dblcolon{\vcentcolon\kern-8mu\vcentcolon} mathtools
\def\coloneqq{\vcentcolon\kern-7mu=} mathtools
\def\Coloneqq{\dblcolon\kern-7mu=} mathtools

View File

@ -34,7 +34,8 @@ Include "stdtoolbars.inc"
# math: the toolbar is visible only when in math
# mathmacrotemplate: the toolbar is visible only when in a macro definition
# table: the toolbar is visible only when in a table
# review: the toolbar is visible only when inside a tracked change
# review: the toolbar is visible only when tracked changes are present or
# change tracking is enabled
# ipa: the toolbar is only visible when inside an ipa inset
#
# top: the toolbar should be at the top of the window

View File

@ -1 +1,2 @@
EXTRA_DIST = iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4
EXTRA_DIST = eilseq.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 \
po.m4 progtest.m4

67
m4/eilseq.m4 Normal file
View File

@ -0,0 +1,67 @@
#serial 1
AC_PREREQ(2.50)
# The EILSEQ errno value ought to be defined in <errno.h>, according to
# ISO C 99 and POSIX. But some systems (like SunOS 4) don't define it,
# and some systems (like BSD/OS) define it in <wchar.h> not <errno.h>.
# Define EILSEQ as a C macro and as a substituted macro in such a way that
# 1. on all systems, after inclusion of <errno.h>, EILSEQ is usable,
# 2. on systems where EILSEQ is defined elsewhere, we use the same numeric
# value.
AC_DEFUN([AC_EILSEQ],
[
AC_REQUIRE([AC_PROG_CC])dnl
dnl Check for any extra headers that could define EILSEQ.
AC_CHECK_HEADERS(wchar.h)
AC_CACHE_CHECK([for EILSEQ], ac_cv_decl_EILSEQ, [
AC_EGREP_CPP(yes,[
#include <errno.h>
#ifdef EILSEQ
yes
#endif
], have_eilseq=1)
if test -n "$have_eilseq"; then
dnl EILSEQ exists in <errno.h>. Don't need to define EILSEQ ourselves.
ac_cv_decl_EILSEQ=yes
else
AC_EGREP_CPP(yes,[
#include <errno.h>
#if HAVE_WCHAR_H
#include <wchar.h>
#endif
#ifdef EILSEQ
yes
#endif
], have_eilseq=1)
if test -n "$have_eilseq"; then
dnl EILSEQ exists in some other system header.
dnl Define it to the same value.
_AC_COMPUTE_INT([EILSEQ], ac_cv_decl_EILSEQ, [
#include <errno.h>
#if HAVE_WCHAR_H
#include <wchar.h>
#endif
/* The following two lines are a workaround against an autoconf-2.52 bug. */
#include <stdio.h>
#include <stdlib.h>
])
else
dnl EILSEQ isn't defined by the system. Define EILSEQ ourselves, but
dnl don't define it as EINVAL, because iconv() callers want to
dnl distinguish EINVAL and EILSEQ.
ac_cv_decl_EILSEQ=ENOENT
fi
fi
])
if test "$ac_cv_decl_EILSEQ" != yes; then
AC_DEFINE_UNQUOTED([EILSEQ], [$ac_cv_decl_EILSEQ],
[Define as good substitute value for EILSEQ.])
EILSEQ="$ac_cv_decl_EILSEQ"
AC_SUBST(EILSEQ)
fi
])

View File

@ -90,8 +90,6 @@ ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
COMMAND ${LYX_PYTHON_EXECUTABLE}
ARGS "${TOP_CMAKE_PATH}/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat_tmp.pot"
COMMAND ${LYX_PYTHON_EXECUTABLE}
ARGS "${TOP_CMAKE_PATH}/po/dos2unix.py" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat_tmp.pot"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat_tmp.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot"
DEPENDS ${_py_sources}

View File

@ -44,7 +44,7 @@ def writeString(outfile, infile, basefile, lineno, string):
def ui_l10n(input_files, output, base):
'''Generate pot file from lib/ui/*'''
output = io.open(output, 'w', encoding='utf_8')
output = io.open(output, 'w', encoding='utf_8', newline='\n')
Submenu = re.compile(r'^[^#]*Submenu\s+"([^"]*)"', re.IGNORECASE)
Popupmenu = re.compile(r'^[^#]*PopupMenu\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE)
IconPalette = re.compile(r'^[^#]*IconPalette\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE)
@ -166,7 +166,10 @@ def layouts_l10n(input_files, output, base, layouttranslations):
if 'wa' in languages:
languages.remove('wa')
if layouttranslations:
out = io.open(output, 'w', encoding='utf_8')
else:
out = io.open(output, 'w', encoding='utf_8', newline='\n')
for src in input_files:
readingDescription = False
readingI18nPreamble = False
@ -433,7 +436,7 @@ def layouts_l10n(input_files, output, base, layouttranslations):
def qt4_l10n(input_files, output, base):
'''Generate pot file from src/frontends/qt4/ui/*.ui'''
output = io.open(output, 'w', encoding='utf_8')
output = io.open(output, 'w', encoding='utf_8', newline='\n')
pat = re.compile(r'\s*<string>(.*)</string>')
prop = re.compile(r'\s*<property.*name.*=.*shortcut')
for src in input_files:
@ -462,7 +465,7 @@ def qt4_l10n(input_files, output, base):
def languages_l10n(input_files, output, base):
'''Generate pot file from lib/languages'''
out = io.open(output, 'w', encoding='utf_8')
out = io.open(output, 'w', encoding='utf_8', newline='\n')
GuiName = re.compile(r'^[^#]*GuiName\s+(.*)', re.IGNORECASE)
for src in input_files:
@ -482,7 +485,7 @@ def languages_l10n(input_files, output, base):
def latexfonts_l10n(input_files, output, base):
'''Generate pot file from lib/latexfonts'''
out = io.open(output, 'w', encoding='utf_8')
out = io.open(output, 'w', encoding='utf_8', newline='\n')
GuiName = re.compile(r'^[^#]*GuiName\s+(.*)', re.IGNORECASE)
for src in input_files:
@ -502,7 +505,7 @@ def latexfonts_l10n(input_files, output, base):
def external_l10n(input_files, output, base):
'''Generate pot file from lib/external_templates'''
output = io.open(output, 'w', encoding='utf_8')
output = io.open(output, 'w', encoding='utf_8', newline='\n')
Template = re.compile(r'^Template\s+(.*)', re.IGNORECASE)
GuiName = re.compile(r'\s*GuiName\s+(.*)', re.IGNORECASE)
HelpTextStart = re.compile(r'\s*HelpText\s', re.IGNORECASE)
@ -551,7 +554,7 @@ def external_l10n(input_files, output, base):
def formats_l10n(input_files, output, base):
'''Generate pot file from configure.py'''
output = io.open(output, 'w', encoding='utf_8')
output = io.open(output, 'w', encoding='utf_8', newline='\n')
GuiName = re.compile(r'.*\\Format\s+\S+\s+\S+\s+"([^"]*)"\s+(\S*)\s+.*', re.IGNORECASE)
GuiName2 = re.compile(r'.*\\Format\s+\S+\s+\S+\s+([^"]\S+)\s+(\S*)\s+.*', re.IGNORECASE)
input = io.open(input_files[0], encoding='utf_8')
@ -581,7 +584,7 @@ def formats_l10n(input_files, output, base):
def encodings_l10n(input_files, output, base):
'''Generate pot file from lib/encodings'''
output = io.open(output, 'w', encoding='utf_8')
output = io.open(output, 'w', encoding='utf_8', newline='\n')
# assuming only one encodings file
# Encoding utf8 utf8 "Unicode (utf8)" UTF-8 variable inputenc
reg = re.compile('Encoding [\w-]+\s+[\w-]+\s+"([\w \-\(\)]+)"\s+[\w-]+\s+(fixed|variable|variableunsafe)\s+\w+.*')

View File

@ -13,7 +13,6 @@
#include "AppleSpellChecker.h"
#include "WordLangTuple.h"
#include "support/lassert.h"
#include "support/debug.h"
#include "support/docstring_list.h"
#include "support/AppleSpeller.h"

View File

@ -13,6 +13,7 @@
#include "Author.h"
#include "support/convert.h"
#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
@ -48,6 +49,15 @@ Author::Author(int buffer_id)
{}
docstring Author::nameAndEmail() const
{
if (email().empty())
return name();
else
return bformat(_("%1$s[[name]] (%2$s[[email]])"), name(), email());
}
bool Author::valid() const
{
//this cannot be equal if the buffer_id was produced by the hash function.

Some files were not shown because too many files have changed in this diff Show More