truncateInterpreters(n);
iterator first (boost::next(begin(),self->begin_));
data_.erase(first, boost::next(begin(),self->end_));
- updateIterators(self,first,-self->size());
+ updateIterators(self,self->begin_,-self->size());
}
// private members
}
}
-prefix_ void senf::detail::PacketImpl::updateIterators(PacketData * self, iterator pos,
+prefix_ void senf::detail::PacketImpl::updateIterators(PacketData * self, difference_type pos,
difference_type n)
{
// I hate to change the PacketData representation from here, I would have preferred to let
// c)
interpreter_list::iterator const i_end (interpreters_.end());
if (++i != i_end)
- if (std::distance(begin(), pos) < difference_type(i->begin_))
+ if (pos <= difference_type(i->begin_))
// pos is before the packet, it must then be before all futher packets ...
for (; i != i_end; ++i) {
i->begin_ += n;
prefix_ void senf::detail::PacketImpl::insert(PacketData * self, iterator pos, byte v)
{
+ difference_type ix (std::distance(begin(),pos));
data_.insert(pos,v);
- updateIterators(self,pos,1);
+ updateIterators(self,ix,1);
}
prefix_ void senf::detail::PacketImpl::insert(PacketData * self, iterator pos, size_type n,
byte v)
{
+ difference_type ix (std::distance(begin(),pos));
data_.insert(pos,n,v);
- updateIterators(self,pos,n);
+ updateIterators(self,ix,n);
}
prefix_ void senf::detail::PacketImpl::erase(PacketData * self, iterator pos)
{
+ difference_type ix (std::distance(begin(),pos));
data_.erase(pos);
- updateIterators(self,pos,-1);
+ updateIterators(self,ix,-1);
}
prefix_ void senf::detail::PacketImpl::erase(PacketData * self, iterator first, iterator last)
{
+ difference_type ix (std::distance(begin(),first));
+ difference_type delta (std::distance(first,last));
data_.erase(first,last);
- updateIterators(self,first,-std::distance(first,last));
+ updateIterators(self,ix,-delta);
}
///////////////////////////////////////////////////////////////////////////
prefix_ void senf::detail::PacketImpl::insert(PacketData * self, iterator pos, ForwardIterator f,
ForwardIterator l)
{
+ difference_type ix (std::distance(begin(),pos));
data_.insert(pos,f,l);
- updateIterators(self,pos,std::distance(f,l));
+ updateIterators(self,ix,std::distance(f,l));
}
template <class InputIterator>
interpreter_list interpreters_;
void eraseInterpreters(interpreter_list::iterator b, interpreter_list::iterator e);
- void updateIterators(PacketData * self, iterator pos, difference_type n);
+ void updateIterators(PacketData * self, difference_type pos, difference_type n);
};
}}
#include "ParseArray.ih"
// Custom includes
-#include <algorithm>
-#if defined(_STLP_ALGORITHM) || (__GNUC__<4 && __GNUC_MINOR__<4)
-#define copy_n std::copy_n
-#else
-#include <ext/algorithm>
-#define copy_n __gnu_cxx::copy_n
-#endif
#define prefix_ inline
///////////////////////////////cti.p///////////////////////////////////////
i_ += n*ElementParser::fixed_bytes;
}
-#undef copy_n
///////////////////////////////cti.e///////////////////////////////////////
#undef prefix_
except OSError: return False
def checkLocalConf(target, source, env):
- if nonemptyFile('SConfig') or nonemptyFile('Doxyfile.local'):
+ if [ True for f in env['CONFIG_FILES'] if nonemptyFile(f) ]:
print
print "You have made local modifications to 'SConfig' and/or 'Doxyfile.local'."
print "Building a debian package would remove those files."
if not logname:
logname = pwd.getpwuid(os.getuid()).pw_name
+def configFilesOpts(target, source, env, for_signature):
+ return [ '-I%s' % os.path.split(f)[1] for f in env['CONFIG_FILES'] ]
+
env.Append(
- CPPPATH = [ ],
+ CPPPATH = [ '#' ],
LIBS = [ 'iberty', '$BOOSTREGEXLIB' ],
DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
DOXY_HTML_XSL = '#/doclib/html-munge.xsl',
'LOGNAME' : logname, # needed by the debian build scripts
'CONCURRENCY_LEVEL' : env.GetOption('num_jobs') or "1"
},
+ CONFIG_FILES = [ 'Doxyfile.local', 'SConfig', 'local_config.hh' ],
+ CONFIG_FILES_OPTS = configFilesOpts,
CLEAN_PATTERNS = [ '*.pyc', 'semantic.cache', '.sconsign', '.sconsign.dblite' ],
- BUILDPACKAGE_COMMAND = "dpkg-buildpackage -us -uc -rfakeroot -I.svn -IDoxyfile.local -ISConfig",
+ BUILDPACKAGE_COMMAND = "dpkg-buildpackage -us -uc -rfakeroot -I.svn $CONFIG_FILES_OPTS",
)
Export('env')
if not env.GetOption('clean') and not os.path.exists("Doxyfile.local"):
Execute(Touch("Doxyfile.local"))
-# Create config.h
-file("config.h","w").write(
-"""#ifndef H_config_
-#define H_config_ 1
-// This looks stupid. However, we need this since the debian packaged Version
-// of SENF is installed in a 'senf' subdirectory which the source Version is not
-#define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <%s/senf_relative_include_file_path>
-#endif
-""" % env.Dir('#').abspath)
+# Create local_config.h
+if not env.GetOption('clean') and not os.path.exists("local_config.hh"):
+ Execute(Touch("local_config.hh"))
###########################################################################
# Define build targets
HTML_HEADER = '#/doclib/doxy-header-overview.html',
HTML_FOOTER = '#/doclib/doxy-footer.html')
+SENFSCons.InstallIncludeFiles(env, [ 'config.hh' ])
+
# Build combined library 'libsenf'
libsenf = env.Library(
SENFSCons.LibPath('senf'),
for path, subdirs, files in os.walk('.')
for pattern in env['CLEAN_PATTERNS']
for f in fnmatch.filter(files,pattern) ])
-
-env.Clean('all', 'config.h')
i->second.cb();
else
break;
- timerMap_.erase(i);
timerQueue_.pop();
+ timerMap_.erase(i);
}
if (events <= 0)
// senf::detail::WriteRange<Handle,ForwardReadableRange,IsContiguous>
template <class Handle, class ForwardReadableRange, bool IsContiguous>
-prefix_ typename boost::range_iterator<ForwardReadableRange>::type
+prefix_ typename boost::range_const_iterator<ForwardReadableRange>::type
senf::detail::WriteRange<Handle,ForwardReadableRange,IsContiguous>::
write(Handle & handle, ForwardReadableRange & range)
{
typename boost::range_size<ForwardReadableRange>::type nwrite (boost::size(range));
+ typename boost::range_const_iterator<ForwardReadableRange>::type i (boost::begin(range));
SENF_SCOPED_BUFFER(char, buffer, nwrite);
- std::copy(boost::begin(range), boost::end(range), buffer);
- return handle.write(std::make_pair(buffer, buffer+nwrite));
+ std::copy(i, boost::end(range), buffer);
+ std::advance(i, handle.write(std::make_pair(buffer, buffer+nwrite)) - buffer);
+ return i;
}
template <class Handle, class ForwardReadableRange, bool IsContiguous>
-prefix_ typename boost::range_iterator<ForwardReadableRange>::type
+prefix_ typename boost::range_const_iterator<ForwardReadableRange>::type
senf::detail::WriteRange<Handle,ForwardReadableRange,IsContiguous>::
writeto(Handle & handle, ForwardReadableRange & range, typename Handle::Address const & addr)
{
typename boost::range_size<ForwardReadableRange>::type nwrite (boost::size(range));
+ typename boost::range_const_iterator<ForwardReadableRange>::type i (boost::begin(range));
SENF_SCOPED_BUFFER(char, buffer, nwrite);
- std::copy(boost::begin(range), boost::end(range), buffer);
- return handle.writeto(std::make_pair(buffer, buffer+nwrite), addr);
+ std::copy(i, boost::end(range), buffer);
+ std::advance(i, handle.writeto(std::make_pair(buffer, buffer+nwrite), addr) - buffer);
+ return i;
}
///////////////////////////////////////////////////////////////////////////
senf::detail::WriteRange<Handle, ForwardReadableRange, true>::
write(Handle & handle, ForwardReadableRange & range)
{
- typename boost::range_const_iterator<ForwardReadableRange>::type const i
+ typename boost::range_const_iterator<ForwardReadableRange>::type i
(boost::const_begin(range));
char const * const ic (reinterpret_cast<char const *>(storage_iterator(i)));
- return i + (handle.write(ic,
- reinterpret_cast<char const *>(
- storage_iterator(boost::const_end(range))))
- - ic);
+ std::advance(i, handle.write(ic,
+ reinterpret_cast<char const *>(
+ storage_iterator(boost::const_end(range)))) - ic);
+ return i;
}
template <class Handle, class ForwardReadableRange>
senf::detail::WriteRange<Handle, ForwardReadableRange, true>::
writeto(Handle & handle, ForwardReadableRange & range, typename Handle::Address const & addr)
{
- typename boost::range_const_iterator<ForwardReadableRange>::type const i
+ typename boost::range_const_iterator<ForwardReadableRange>::type i
(boost::const_begin(range));
char const * const ic (reinterpret_cast<char const *>(storage_iterator(i)));
- return i + (handle.writeto(addr,
- ic,
- reinterpret_cast<char const *>(
- storage_iterator(boost::const_end(range))))
- - ic);
+ std::advance(i, handle.writeto(addr, ic,
+ reinterpret_cast<char const *>(
+ storage_iterator(boost::const_end(range)))) - ic);
+ return i;
}
///////////////////////////////////////////////////////////////////////////
template <class Handle, class ForwardReadableRange, bool IsContiguous>
struct WriteRange
{
- static typename boost::range_iterator<ForwardReadableRange>::type
+ static typename boost::range_const_iterator<ForwardReadableRange>::type
write(Handle & handle, ForwardReadableRange & range);
- static typename boost::range_iterator<ForwardReadableRange>::type
+ static typename boost::range_const_iterator<ForwardReadableRange>::type
writeto(Handle & handle, ForwardReadableRange & range,
typename Handle::Address const & addr);
};
// Custom includes
#include "ClientSocketHandle.hh"
-#include "../config.h"
+#include "../config.hh"
#include "ProtocolClientSocketHandle.mpp"
///////////////////////////////hh.p////////////////////////////////////////
// Custom includes
#include "ServerSocketHandle.hh"
+#include "../config.hh"
#include "ProtocolServerSocketHandle.mpp"
///////////////////////////////hh.p////////////////////////////////////////
#define HH_Buffer_ 1
// Custom includes
+#include "../config.hh"
//#include "Buffer.mpp"
///////////////////////////////hh.p////////////////////////////////////////
-#if !defined(SENF_BUFFER_USE_LOCALS) && !defined(SENF_BUFFER_USE_ALLOCA) && !defined(SENF_BUFFER_USE_NEW)
-#
-#
-# if defined(__GNUC__)
-# define SENF_BUFFER_USE_LOCALS 1
-#
-# // Add other compilers here ...
-#
-# // dynamic arrays are part of C99. Which is NOT part of C++
-# // but lets try nonetheless ...
-# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-# define SENF_BUFFER_USE_LOCALS 1
-#
-# endif
-#
-# if !defined(SENF_BUFFER_USE_LOCALS) && !defined(SENF_BUFFER_USE_ALLOCA)
-# define SENF_BUFFER_USE_NEW 1
-# endif
-#
-#endif
-
#if defined(SENF_BUFFER_USE_LOCALS)
# define SENF_SCOPED_BUFFER(type, sym, size) \
namespace senf {
- // It is not very nice that we need to specialize on the exact iterator names.
- // The preprocessor guard will need to be expanded by also giving the correct
- // version numbers. We need to disable it when using stlport and so on ...
- // The problem is, that typedefs are not expanded when specializing ...
+ // It is not very nice that we need to specialize on the exact iterator names. The preprocessor
+ // guard will need to be expanded by also giving the correct version numbers. The problem is,
+ // that typedefs are not expanded when specializing ...
#if defined(__GNUG__)
template <class T, class Alloc>
struct contiguous_storage_iterator<
- __gnu_cxx::__normal_iterator<T*, std::vector<T,Alloc> > >
+ ::__gnu_cxx::__normal_iterator<T*, std::vector<T,Alloc> > >
: public boost::true_type
{};
template <class CharT, class Traits, class Alloc>
struct contiguous_storage_iterator<
- __gnu_cxx::__normal_iterator<CharT*, std::basic_string<CharT, Traits, Alloc> > >
+ ::__gnu_cxx::__normal_iterator<CharT*, std::basic_string<CharT, Traits, Alloc> > >
: public boost::true_type
{};
#endif
{
BOOST_CHECK_EQUAL( senf::contiguous_storage_iterator<int*>::value, true );
BOOST_CHECK_EQUAL( senf::contiguous_storage_iterator<void>::value, false );
-#ifdef __GNUG__
+#if defined(__GNUG__) && ! defined(_GLIBCXX_DEBUG)
BOOST_CHECK_EQUAL( senf::contiguous_storage_iterator<std::vector<int>::iterator>::value, true);
BOOST_CHECK_EQUAL( senf::contiguous_storage_iterator<std::string::iterator>::value, true);
#endif
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
-#include "../../config.h"
+#include "../../config.hh"
template <typename R, typename T>
boost::function<R()> membind(R (T::* fn)(),scOBTYPE ob)
#define HH_mpl_ 1
// Custom includes
+#include "../config.hh"
//#include "mpl.mpp"
#include "mpl.ih"
/** \defgroup senfmpl Low-level template meta programming helpers
*/
-# ifndef SENF_MPL_RV_ALIGNMENT
-# define SENF_MPL_RV_ALIGNMENT 16
-# endif
-
/** \brief Return-value type used to implement overload selection
The senf::mpl::rv type is used together with \ref SENF_MPL_RV() to select template
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2007
+// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
+// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Stefan Bund <g0dil@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief config public header */
+
+#ifndef HH_config_
+#define HH_config_ 1
+
+// Custom includes
+
+//#include "config.mpp"
+///////////////////////////////hh.p////////////////////////////////////////
+
+# include "local_config.hh"
+
+# ifndef SENF_ABSOLUTE_INCLUDE_PATH
+# define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <senf_relative_include_file_path>
+# endif
+
+# ifndef SENF_copy_n
+# include <algorithm>
+# if defined(__GNUC__) && ! defined(_STLP_ALGORITHM) && (__GNUC__>=4 || (__GNUC__==3 && __GNUC_MINOR__>=4))
+# include <ext/algorithm>
+# define SENF_copy_n __gnu_cxx::copy_n
+# else
+# define SENF_copy_n std::copy_n
+# endif
+# endif
+
+# ifndef SENF_MPL_RV_ALIGNMENT
+# define SENF_MPL_RV_ALIGNMENT 16
+# endif
+
+# if !defined(SENF_BUFFER_USE_LOCALS) && !defined(SENF_BUFFER_USE_ALLOCA) && !defined(SENF_BUFFER_USE_NEW)
+#
+# if defined(__GNUC__)
+# define SENF_BUFFER_USE_LOCALS 1
+#
+# // Add other compilers here ...
+#
+# // dynamic arrays are part of C99. Which is NOT part of C++
+# // but lets try nonetheless ...
+# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+# define SENF_BUFFER_USE_LOCALS 1
+# endif
+#
+# if !defined(SENF_BUFFER_USE_LOCALS) && !defined(SENF_BUFFER_USE_ALLOCA)
+# define SENF_BUFFER_USE_NEW 1
+# endif
+#
+# endif
+
+///////////////////////////////hh.e////////////////////////////////////////
+//#include "config.cci"
+//#include "config.ct"
+//#include "config.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
+++ /dev/null
-// $Id$
-//
-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Stefan Bund <g0dil@berlios.de>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the
-// Free Software Foundation, Inc.,
-// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/** \file
- \brief config public header */
-
-#ifndef H_config_
-#define H_config_ 1
-
-// Custom includes
-
-//#include "config.mpp"
-///////////////////////////////hh.p////////////////////////////////////////
-
-#define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <senf/senf_relative_include_file_path>
-
-///////////////////////////////hh.e////////////////////////////////////////
-//#include "config.cci"
-//#include "config.ct"
-//#include "config.cti"
-#endif
-
-\f
-// Local Variables:
-// mode: c++
-// fill-column: 100
-// comment-column: 40
-// c-file-style: "senf"
-// indent-tabs-mode: nil
-// ispell-local-dictionary: "american"
-// compile-command: "scons -u test"
-// End:
debian/tmp/usr/include/Socket usr/include/senf
debian/tmp/usr/include/Utils usr/include/senf
boost usr/include/senf
-debian/config.h usr/include/senf
+debian/local_config.hh usr/include/senf
debian/Socket.hh usr/include/senf
debian/Packets.hh usr/include/senf
debian/PPI.hh usr/include/senf
--- /dev/null
+
+#define SENF_ABSOLUTE_INCLUDE_PATH(senf_relative_include_file_path) <senf/senf_relative_include_file_path>
configure-stamp:
dh_testdir
# # Add here commands to configure the package.
- rm -f Doxyfile.local SConfig
-# If needed, we could create new 'Doxyfile.local' and/or 'SConfig' files here.
-# We don't remove them in 'clean' to allow building a source package from an
+ rm -f Doxyfile.local SConfig local_config.hh
+# If needed, we could create new files 'Doxyfile.local',
+# 'SConfig' and/or 'local_config.hh' here. We don't remove them
+# in 'clean' to allow building a source package from an
# individually configured svn working copy.
touch configure-stamp
find . \
-name .svn -prune -o \
-name doc -prune -o \
+ -name debian -prune -o \
-name "*.a" -o \
-name "*.o" -o \
-name "*~" -o \
# This script will run the .test.bin test driver within gdb and will
# create a backtrace for every exception caught by the test driver.
#
-# NOTE: If your unit test (excplicitly) writes output to stderr, this
-# output will be lost
-#
# NOTE: This works by setting a breakpoint in the std::exception
# constructor. This is, where the backtrace is created from. If you do
# some funky manipulations with your exceptions, the backtrace might
# correctly (cought before the reach the unit test driver). It will
# also truncate the backtrace at the first stackframe within the unit
# test subsystem since we are only interested in the user code.
-gdb -batch -x .run-test-gdb.cmd ./.test.bin 2>/dev/null | perl -e '
+gdb -batch -x .run-test-gdb.cmd ./.test.bin 2>&1 | perl -e '
$mode=0;
+ $silent=0;
while (<STDIN>) {
if ($mode==0) {
if (/^$/) {
}
}
elsif ($mode==1) {
- if (/^Breakpoint 1, exception/) {
+ if (/^(Breakpoint 1, exception|Program received signal )/) {
$mode=2;
@l=();
} else {
if (/^(#?[0-9]| )/) {
push @l,$_ if /^#/;
$l[$#l] .= $_ if @l && /^ /;
- } elsif (/^Current language: auto;/) {
+ } elsif (/^(Current language: auto;|\[Switching to Thread)/) {
;
} else {
$mode=0;
if (/: fatal error in /) {
+ print "\n";
for (@l[1..$#l]) {
last if /^#[0-9]+ +0x[0-9a-f]+ in boost::unit_test::ut_detail::invoker/;
- print;
+ if ($silent) {
+ unless (/at \/usr\/lib\/gcc\//) {
+ print;
+ $silent=0;
+ }
+ } else {
+ print unless /in \?\?/;
+ $silent=1 if /__gnu_debug::/;
+ }
}
print;
+ print "\n";
} else {
redo;
}
CPPDEFINES = [ 'NDEBUG' ])
else:
env.Append(CXXFLAGS = [ '-O0', '-g', '-fno-inline' ],
+ # The unit-test framework is not compiled with _GLIBCXX_DEBUG so this fails.
+ # CPPDEFINES = [ '_GLIBCXX_DEBUG', 'BOOST_REGEX_NO_LIB' ],
LINKFLAGS = [ '-g' ])
env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ],