summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2014-07-15 14:45:28 (GMT)
committerSwift Review <review@swift.im>2014-10-01 12:15:02 (GMT)
commita2296b00c88df201b0eb58e867aeb17a87e6332c (patch)
tree9fdebba1b5e9202ca669786a41dd94f080ba5807
parenta24d8c0e93d70312fc90d5fdf6214ade9a475e92 (diff)
downloadswift-contrib-a2296b00c88df201b0eb58e867aeb17a87e6332c.zip
swift-contrib-a2296b00c88df201b0eb58e867aeb17a87e6332c.tar.bz2
Port many of Isode's local fixes upstream
Includes fixes to: Build with new Visual Studio and Boost Avoid error caused when Avahi is present but Qt is not Make declaration of XMPPRosterImpl::addContact consistent with implementation Includes enhancements to: Allow user-configurable mt.exe Allow splitting openssl paths Allow disabling gconf lookup Make idn support optional Allow disabling various library detections Remove use of non-Python2.4 features in sconscripts Test-Information: Builds Change-Id: Iee91ee80291a8bdf87cc169c915e4dad1cc1055b
-rw-r--r--3rdParty/CppUnit/SConscript2
-rw-r--r--3rdParty/HippoMocks/hippomocks.h608
-rw-r--r--3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py35
-rw-r--r--BuildTools/SCons/SConscript.boot83
-rw-r--r--BuildTools/SCons/SConstruct100
-rw-r--r--BuildTools/SCons/Tools/Test.py11
-rw-r--r--BuildTools/SCons/Version.py11
-rw-r--r--COPYING.thirdparty35
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript4
-rw-r--r--Documentation/SwiftenDevelopersGuide/SConscript6
-rw-r--r--QA/Checker/SConscript4
-rw-r--r--Slimber/SConscript8
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.cpp5
-rw-r--r--Swiften/Client/XMLBeautifier.h7
-rw-r--r--Swiften/EventLoop/EventLoop.h6
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h16
-rw-r--r--Swiften/Network/PlatformNetworkEnvironment.h6
-rw-r--r--Swiften/Network/SConscript8
-rw-r--r--Swiften/Network/SolarisNetworkEnvironment.cpp292
-rw-r--r--Swiften/Network/SolarisNetworkEnvironment.h29
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.cpp6
-rw-r--r--Swiften/Roster/XMPPRosterImpl.h2
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.cpp6
-rw-r--r--Swiften/Session/BasicSessionStream.cpp20
24 files changed, 892 insertions, 418 deletions
diff --git a/3rdParty/CppUnit/SConscript b/3rdParty/CppUnit/SConscript
index ad287f3..addc8ab 100644
--- a/3rdParty/CppUnit/SConscript
+++ b/3rdParty/CppUnit/SConscript
@@ -1,41 +1,43 @@
Import("env")
if env["TEST"] :
if env["PLATFORM"] == "win32" :
cppflags = ["/I" + Dir("src/include").abspath]
+ elif env["PLATFORM"] == "sunos" :
+ cppflags = [("-I" + Dir("src/include").abspath)]
else :
cppflags = [("-isystem", Dir("src/include").abspath)]
################################################################################
# Module flags
################################################################################
if env["SCONS_STAGE"] == "flags" :
env["CPPUNIT_FLAGS"] = {
"CPPPATH": [env.Dir(".")],
"CPPFLAGS": cppflags,
"LIBPATH": [env.Dir(".")],
"LIBS": ["Swiften_CppUnit"]
}
################################################################################
# Build
################################################################################
if env["SCONS_STAGE"] == "build" :
myenv = env.Clone()
myenv.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if not flag.startswith("-W")])
myenv.Append(CPPPATH = ["src/include", "."])
sources = [
"src/src/cppunit/TextTestRunner.cpp",
"src/src/cppunit/TextTestProgressListener.cpp",
"src/src/cppunit/BriefTestProgressListener.cpp",
"src/src/cppunit/TextOutputter.cpp",
"src/src/cppunit/XmlOutputter.cpp",
"src/src/cppunit/XmlElement.cpp",
"src/src/cppunit/XmlDocument.cpp",
"src/src/cppunit/StringTools.cpp",
"src/src/cppunit/DefaultProtector.cpp",
"src/src/cppunit/Protector.cpp",
"src/src/cppunit/ProtectorChain.cpp",
diff --git a/3rdParty/HippoMocks/hippomocks.h b/3rdParty/HippoMocks/hippomocks.h
index 802d719..3483dce 100644
--- a/3rdParty/HippoMocks/hippomocks.h
+++ b/3rdParty/HippoMocks/hippomocks.h
@@ -1,206 +1,207 @@
#ifndef HIPPOMOCKS_H
#define HIPPOMOCKS_H
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#pragma clang diagnostic ignored "-Wunreachable-code"
#ifndef EXCEPTION_BUFFER_SIZE
#define EXCEPTION_BUFFER_SIZE 65536
#endif
-#ifndef VIRT_FUNC_LIMIT
+#ifndef VIRT_FUNC_LIMIT
#define VIRT_FUNC_LIMIT 1024
#elif VIRT_FUNC_LIMIT > 1024
#error Adjust the code to support more than 1024 virtual functions before setting the VIRT_FUNC_LIMIT above 1024
#endif
#ifdef __EDG__
#define FUNCTION_BASE 3
#define FUNCTION_STRIDE 2
#else
#define FUNCTION_BASE 0
#define FUNCTION_STRIDE 1
#endif
#include <list>
#include <map>
#include <memory>
#include <iostream>
#include <sstream>
#include <cstring>
+#include <string>
#ifdef _MSC_VER
-// these warnings are pointless and huge, and will confuse new users.
+// these warnings are pointless and huge, and will confuse new users.
#pragma warning(push)
// If you can't generate an assignment operator the least you can do is shut up.
#pragma warning(disable: 4512)
// Alignment not right in a union?
#pragma warning(disable: 4121)
// Template parameters have the tendency not to change between executions.
#pragma warning(disable: 4127)
// No deprecated warnings on functions that really aren't deprecated at all.
#pragma warning(disable: 4996)
#endif
class MockRepository;
enum RegistrationType {
Never,
Once,
DontCare
};
// base type
class base_mock {
public:
void destroy() { unwriteVft(); delete this; }
virtual ~base_mock() {}
- void *rewriteVft(void *newVf)
+ void *rewriteVft(void *newVf)
{
void *oldVf = *(void **)this;
*(void **)this = newVf;
return oldVf;
}
- void unwriteVft()
+ void unwriteVft()
{
*(void **)this = (*(void ***)this)[-1];
}
};
-class NullType
+class NullType
{
-public:
- bool operator==(const NullType &) const
+public:
+ bool operator==(const NullType &) const
{
- return true;
+ return true;
}
};
struct NotPrintable { template <typename T> NotPrintable(T const&) {} };
inline std::ostream &operator<<(std::ostream &os, NotPrintable const&)
{
os << "???";
return os;
}
template <typename T>
-struct printArg
+struct printArg
{
static inline void print(std::ostream &os, T arg, bool withComma)
{
if (withComma) os << ",";
os << arg;
}
};
template <>
struct printArg<NullType>
{
static void print(std::ostream &, NullType , bool)
{
}
};
-class base_tuple
+class base_tuple
{
protected:
- base_tuple()
+ base_tuple()
{
- }
-public:
- virtual ~base_tuple()
+ }
+public:
+ virtual ~base_tuple()
{
}
virtual bool operator==(const base_tuple &) const = 0;
virtual void printTo(std::ostream &os) const = 0;
};
template <typename X>
struct no_cref { typedef X type; };
template <typename X>
struct no_cref<const X &> { typedef X type; };
struct NotComparable { template <typename T> NotComparable(const T&) {} };
inline bool operator==(NotComparable, NotComparable)
{
return false;
}
template <typename T>
struct comparer
{
static inline bool compare(T a, T b)
{
return a == b;
}
};
-template <typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
- typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
- typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
+template <typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
+ typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
+ typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
typename M = NullType, typename N = NullType, typename O = NullType, typename P = NullType>
class tuple : public base_tuple
{
public:
typename no_cref<A>::type a;
typename no_cref<B>::type b;
typename no_cref<C>::type c;
typename no_cref<D>::type d;
typename no_cref<E>::type e;
typename no_cref<F>::type f;
typename no_cref<G>::type g;
typename no_cref<H>::type h;
typename no_cref<I>::type i;
typename no_cref<J>::type j;
typename no_cref<K>::type k;
typename no_cref<L>::type l;
typename no_cref<M>::type m;
typename no_cref<N>::type n;
typename no_cref<O>::type o;
typename no_cref<P>::type p;
- tuple(typename no_cref<A>::type a = typename no_cref<A>::type(), typename no_cref<B>::type b = typename no_cref<B>::type(),
- typename no_cref<C>::type c = typename no_cref<C>::type(), typename no_cref<D>::type d = typename no_cref<D>::type(),
- typename no_cref<E>::type e = typename no_cref<E>::type(), typename no_cref<F>::type f = typename no_cref<F>::type(),
+ tuple(typename no_cref<A>::type a = typename no_cref<A>::type(), typename no_cref<B>::type b = typename no_cref<B>::type(),
+ typename no_cref<C>::type c = typename no_cref<C>::type(), typename no_cref<D>::type d = typename no_cref<D>::type(),
+ typename no_cref<E>::type e = typename no_cref<E>::type(), typename no_cref<F>::type f = typename no_cref<F>::type(),
typename no_cref<G>::type g = typename no_cref<G>::type(), typename no_cref<H>::type h = typename no_cref<H>::type(),
- typename no_cref<I>::type i = typename no_cref<I>::type(), typename no_cref<J>::type j = typename no_cref<J>::type(),
- typename no_cref<K>::type k = typename no_cref<K>::type(), typename no_cref<L>::type l = typename no_cref<L>::type(),
- typename no_cref<M>::type m = typename no_cref<M>::type(), typename no_cref<N>::type n = typename no_cref<N>::type(),
+ typename no_cref<I>::type i = typename no_cref<I>::type(), typename no_cref<J>::type j = typename no_cref<J>::type(),
+ typename no_cref<K>::type k = typename no_cref<K>::type(), typename no_cref<L>::type l = typename no_cref<L>::type(),
+ typename no_cref<M>::type m = typename no_cref<M>::type(), typename no_cref<N>::type n = typename no_cref<N>::type(),
typename no_cref<O>::type o = typename no_cref<O>::type(), typename no_cref<P>::type p = typename no_cref<P>::type())
: a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h), i(i), j(j), k(k), l(l), m(m), n(n), o(o), p(p)
{}
bool operator==(const base_tuple &bo) const {
const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &to = (const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &)bo;
return (comparer<A>::compare(a, to.a) &&
comparer<B>::compare(b, to.b) &&
comparer<C>::compare(c, to.c) &&
comparer<D>::compare(d, to.d) &&
comparer<E>::compare(e, to.e) &&
comparer<F>::compare(f, to.f) &&
comparer<G>::compare(g, to.g) &&
comparer<H>::compare(h, to.h) &&
comparer<I>::compare(i, to.i) &&
comparer<J>::compare(j, to.j) &&
comparer<K>::compare(k, to.k) &&
comparer<L>::compare(l, to.l) &&
comparer<M>::compare(m, to.m) &&
comparer<N>::compare(n, to.n) &&
comparer<O>::compare(o, to.o) &&
comparer<P>::compare(p, to.p));
}
virtual void printTo(std::ostream &os) const
{
os << "(";
printArg<A>::print(os, a, false);
printArg<B>::print(os, b, true);
printArg<C>::print(os, c, true);
printArg<D>::print(os, d, true);
printArg<E>::print(os, e, true);
printArg<F>::print(os, f, true);
printArg<G>::print(os, g, true);
printArg<H>::print(os, h, true);
printArg<I>::print(os, i, true);
printArg<J>::print(os, j, true);
@@ -538,319 +539,319 @@ public:
template <typename T, typename U>
T getNonvirtualMemberFunctionAddress(U u)
{
#ifdef __EDG__
// Edison Design Group C++ frontend (Comeau, Portland Group, Greenhills, etc)
union {
struct {
short delta;
short vindex;
T t;
} mfp_structure;
U u;
} conv;
#else
// Visual Studio, GCC, others
union {
struct {
T t;
} mfp_structure;
U u;
} conv;
#endif
conv.u = u;
return conv.mfp_structure.t;
}
template <typename T>
int getFunctionIndex(T func) {
func_index idx;
return ((&idx)->*reinterpret_cast<int (func_index::*)()>(func))() * FUNCTION_STRIDE + FUNCTION_BASE;
}
// mock types
template <class T>
-class mock : public base_mock
+class mock : public base_mock
{
friend class MockRepository;
unsigned char remaining[sizeof(T)];
void NotImplemented() { throw NotImplementedException(repo); }
protected:
void *oldVft;
void (*funcs[VIRT_FUNC_LIMIT])();
MockRepository *repo;
public:
int funcMap[VIRT_FUNC_LIMIT];
- mock(MockRepository *repo)
+ mock(MockRepository *repo)
: repo(repo)
{
- for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
+ for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
{
funcs[i] = getNonvirtualMemberFunctionAddress<void (*)()>(&mock<T>::NotImplemented);
funcMap[i] = -1;
}
memset(remaining, 0, sizeof(remaining));
oldVft = base_mock::rewriteVft(funcs);
}
- int translateX(int x)
+ int translateX(int x)
{
- for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
+ for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
{
if (funcMap[i] == x) return i;
}
return -1;
}
};
template <class T>
class classMock : public mock<T>
{
void *backupVft;
public:
- classMock(MockRepository *repo)
+ classMock(MockRepository *repo)
: mock<T>(repo)
{
mock<T>::oldVft = base_mock::rewriteVft((void *)mock<T>::funcs);
new(this)T();
backupVft = base_mock::rewriteVft((void *)mock<T>::funcs);
}
~classMock()
{
base_mock::rewriteVft(backupVft);
((T *)this)->~T();
}
};
//Type-safe exception wrapping
-class ExceptionHolder
-{
+class ExceptionHolder
+{
public:
virtual ~ExceptionHolder() {}
- virtual void rethrow() = 0;
+ virtual void rethrow() = 0;
};
template <class T>
class ExceptionWrapper : public ExceptionHolder {
T exception;
public:
ExceptionWrapper(T exception) : exception(exception) {}
void rethrow() { throw exception; }
};
// Do() function wrapping
class VirtualDestructable { public: virtual ~VirtualDestructable() {} };
template <typename Y>
-class TupleInvocable : public VirtualDestructable
+class TupleInvocable : public VirtualDestructable
{
public:
virtual Y operator()(const base_tuple &tupl) = 0;
};
template <typename Y,
- typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
- typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
- typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
+ typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
+ typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
+ typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
typename M = NullType, typename N = NullType, typename O = NullType, typename P = NullType>
class Invocable : public TupleInvocable<Y>
{
public:
virtual Y operator()(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) = 0;
virtual Y operator()(const base_tuple &tupl) {
const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &rTupl = reinterpret_cast<const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &>(tupl);
- return (*this)(rTupl.a, rTupl.b, rTupl.c, rTupl.d, rTupl.e, rTupl.f, rTupl.g, rTupl.h,
+ return (*this)(rTupl.a, rTupl.b, rTupl.c, rTupl.d, rTupl.e, rTupl.f, rTupl.g, rTupl.h,
rTupl.i, rTupl.j, rTupl.k, rTupl.l, rTupl.m, rTupl.n, rTupl.o, rTupl.p);
}
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
class DoWrapper : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I, typename J>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I>{
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h);
}
using Invocable<Y,A,B,C,D,E,F,G,H>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
class DoWrapper<T,Y,A,B,C,D,E,F,G,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g);
}
using Invocable<Y,A,B,C,D,E,F,G>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
class DoWrapper<T,Y,A,B,C,D,E,F,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f);
}
using Invocable<Y,A,B,C,D,E,F>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E>
class DoWrapper<T,Y,A,B,C,D,E,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e);
}
using Invocable<Y,A,B,C,D,E>::operator();
};
template <typename T, typename Y,
typename A, typename B, typename C, typename D>
class DoWrapper<T,Y,A,B,C,D,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d);
}
using Invocable<Y,A,B,C,D>::operator();
};
template <typename T, typename Y,
typename A, typename B, typename C>
class DoWrapper<T,Y,A,B,C,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c);
}
using Invocable<Y,A,B,C>::operator();
};
@@ -884,634 +885,634 @@ public:
virtual Y operator()(NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t();
}
using Invocable<Y>::operator();
};
class ReturnValueHolder {
public:
virtual ~ReturnValueHolder() {}
};
template <class T>
class ReturnValueWrapper : public ReturnValueHolder {
public:
typename no_cref<T>::type rv;
ReturnValueWrapper(T rv) : rv(rv) {}
};
//Call wrapping
class Call {
public:
virtual bool matchesArgs(const base_tuple &tuple) = 0;
ReturnValueHolder *retVal;
ExceptionHolder *eHolder;
base_mock *mock;
VirtualDestructable *functor;
int funcIndex;
std::list<Call *> previousCalls;
RegistrationType expectation;
bool satisfied;
int lineno;
const char *funcName;
const char *fileName;
protected:
- Call(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName)
- : retVal(0),
- eHolder(0),
- mock(mock),
+ Call(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName)
+ : retVal(0),
+ eHolder(0),
+ mock(mock),
functor(0),
- funcIndex(funcIndex),
+ funcIndex(funcIndex),
expectation(expectation),
satisfied(false),
lineno(X),
funcName(funcName),
fileName(fileName)
{
}
public:
virtual const base_tuple *getArgs() const = 0;
- virtual ~Call()
+ virtual ~Call()
{
delete eHolder;
delete functor;
delete retVal;
}
};
std::ostream &operator<<(std::ostream &os, const Call &call);
-template <typename Y,
- typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
- typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
- typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
+template <typename Y,
+ typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
+ typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
+ typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
typename M = NullType, typename N = NullType, typename O = NullType, typename P = NullType>
class TCall : public Call {
private:
tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> *args;
public:
const base_tuple *getArgs() const { return args; }
TCall(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {}
~TCall() { delete args; }
bool matchesArgs(const base_tuple &tupl) { return !args || *args == reinterpret_cast<const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &>(tupl); }
- TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
- args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
- return *this;
+ TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
+ args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
+ return *this;
}
- TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
+ TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
previousCalls.push_back(&call);
- return *this;
+ return *this;
}
template <typename T>
Call &Do(T &function) { functor = new DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(function); return *this; }
Call &Return(Y obj) { retVal = new ReturnValueWrapper<Y>(obj); return *this; }
template <typename Ex>
Call &Throw(Ex exception) { eHolder = new ExceptionWrapper<Ex>(exception); return *this; }
};
-template <typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+template <typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
class TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> : public Call {
private:
tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> *args;
public:
const base_tuple *getArgs() const { return args; }
TCall(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {}
~TCall() { delete args; }
bool matchesArgs(const base_tuple &tupl) { return (!args) || (*args == reinterpret_cast<const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &>(tupl)); }
- TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
- args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
- return *this;
+ TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
+ args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
+ return *this;
}
- TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
+ TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
previousCalls.push_back(&call);
- return *this;
+ return *this;
}
template <typename T>
Call &Do(T &function) { functor = new DoWrapper<T,void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(function); return *this; }
template <typename Ex>
Call &Throw(Ex exception) { eHolder = new ExceptionWrapper<Ex>(exception); return *this; }
};
class MockRepository {
private:
friend inline std::ostream &operator<<(std::ostream &os, const MockRepository &repo);
std::list<base_mock *> mocks;
std::list<Call *> neverCalls;
std::list<Call *> expectations;
std::list<Call *> optionals;
public:
bool autoExpect;
#ifdef _MSC_VER
#define OnCall(obj, func) RegisterExpect_<__COUNTER__, DontCare>(obj, &func, #func, __FILE__, __LINE__)
#define ExpectCall(obj, func) RegisterExpect_<__COUNTER__, Once>(obj, &func, #func, __FILE__, __LINE__)
#define NeverCall(obj, func) RegisterExpect_<__COUNTER__, Never>(obj, &func, #func, __FILE__, __LINE__)
#define OnCallOverload(obj, func) RegisterExpect_<__COUNTER__, DontCare>(obj, func, #func, __FILE__, __LINE__)
#define ExpectCallOverload(obj, func) RegisterExpect_<__COUNTER__, Once>(obj, func, #func, __FILE__, __LINE__)
#define NeverCallOverload(obj, func) RegisterExpect_<__COUNTER__, Never>(obj, func, #func, __FILE__, __LINE__)
#else
#define OnCall(obj, func) RegisterExpect_<__LINE__, DontCare>(obj, &func, #func, __FILE__, __LINE__)
#define ExpectCall(obj, func) RegisterExpect_<__LINE__, Once>(obj, &func, #func, __FILE__, __LINE__)
#define NeverCall(obj, func) RegisterExpect_<__LINE__, Never>(obj, &func, #func, __FILE__, __LINE__)
#define OnCallOverload(obj, func) RegisterExpect_<__LINE__, DontCare>(obj, func, #func, __FILE__, __LINE__)
#define ExpectCallOverload(obj, func) RegisterExpect_<__LINE__, Once>(obj, func, #func, __FILE__, __LINE__)
#define NeverCallOverload(obj, func) RegisterExpect_<__LINE__, Never>(obj, func, #func, __FILE__, __LINE__)
#endif
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo);
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo);
//GCC 3.x doesn't seem to understand overloading on const or non-const member function. Volatile appears to work though.
#if !defined(__GNUC__) || __GNUC__ > 3
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)() volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)() const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)() const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); }
#endif
template <typename Z>
void BasicRegisterExpect(mock<Z> *zMock, int funcIndex, void (base_mock::*func)(), int X);
template <typename Z>
Z DoExpectation(base_mock *mock, int funcno, const base_tuple &tuple);
- void DoVoidExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
+ void DoVoidExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple) &&
!call->satisfied)
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
-
+
if (call->eHolder)
call->eHolder->rethrow();
if (call->functor != NULL)
(*(TupleInvocable<void> *)(call->functor))(tuple);
return;
}
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
throw ExpectationException(this, call->getArgs(), call->funcName);
}
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
if (call->eHolder)
call->eHolder->rethrow();
if (call->functor != NULL)
(*(TupleInvocable<void> *)(call->functor))(tuple);
return;
}
}
const char *funcName = NULL;
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
throw ExpectationException(this, &tuple, funcName);
}
- MockRepository()
+ MockRepository()
: autoExpect(true)
{
}
- ~MockRepository()
+ ~MockRepository()
{
if (!std::uncaught_exception())
VerifyAll();
reset();
- for (std::list<base_mock *>::iterator i = mocks.begin(); i != mocks.end(); i++)
+ for (std::list<base_mock *>::iterator i = mocks.begin(); i != mocks.end(); i++)
{
(*i)->destroy();
}
mocks.clear();
}
- void reset()
+ void reset()
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
{
delete *i;
}
expectations.clear();
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); i++)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); i++)
{
delete *i;
}
neverCalls.clear();
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); i++)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); i++)
{
delete *i;
}
optionals.clear();
}
- void VerifyAll()
+ void VerifyAll()
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
{
if (!(*i)->satisfied)
throw CallMissingException(this);
}
}
template <typename base>
base *InterfaceMock();
template <typename base>
base *ClassMock();
};
// mock function providers
template <typename Z, typename Y>
class mockFuncs : public mock<Z> {
-private:
+private:
mockFuncs();
public:
template <int X>
Y expectation0()
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<>());
}
template <int X, typename A>
Y expectation1(A a)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A>(a));
}
template <int X, typename A, typename B>
Y expectation2(A a, B b)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B>(a,b));
}
template <int X, typename A, typename B, typename C>
Y expectation3(A a, B b, C c)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C>(a,b,c));
}
template <int X, typename A, typename B, typename C, typename D>
Y expectation4(A a, B b, C c, D d)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D>(a,b,c,d));
}
template <int X, typename A, typename B, typename C, typename D, typename E>
Y expectation5(A a, B b, C c, D d, E e)
{
@@ -1556,71 +1557,71 @@ public:
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L>
Y expectation12(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L>(a,b,c,d,e,f,g,h,i,j,k,l));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M>
Y expectation13(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M>(a,b,c,d,e,f,g,h,i,j,k,l,m));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M, typename N>
Y expectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N>(a,b,c,d,e,f,g,h,i,j,k,l,m,n));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M, typename N, typename O>
Y expectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M, typename N, typename O, typename P>
Y expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p));
}
};
template <typename Z>
class mockFuncs<Z, void> : public mock<Z> {
-private:
+private:
mockFuncs();
public:
template <int X>
void expectation0()
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<>());
}
template <int X, typename A>
void expectation1(A a)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A>(a));
}
template <int X, typename A, typename B>
void expectation2(A a, B b)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B>(a,b));
}
template <int X, typename A, typename B, typename C>
void expectation3(A a, B b, C c)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B,C>(a,b,c));
}
template <int X, typename A, typename B, typename C, typename D>
void expectation4(A a, B b, C c, D d)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B,C,D>(a,b,c,d));
}
template <int X, typename A, typename B, typename C, typename D, typename E>
void expectation5(A a, B b, C c, D d, E e)
{
@@ -1675,625 +1676,625 @@ public:
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M>(a,b,c,d,e,f,g,h,i,j,k,l,m));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M, typename N>
void expectation14(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N>(a,b,c,d,e,f,g,h,i,j,k,l,m,n));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M, typename N, typename O>
void expectation15(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o));
}
template <int X, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K, typename L, typename M, typename N, typename O, typename P>
void expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p)
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p));
}
};
template <typename Z>
void MockRepository::BasicRegisterExpect(mock<Z> *zMock, int funcIndex, void (base_mock::*func)(), int X)
{
if (zMock->funcMap[funcIndex] == -1)
{
zMock->funcs[funcIndex] = getNonvirtualMemberFunctionAddress<void (*)()>(func);
zMock->funcMap[funcIndex] = X;
}
}
// Mock repository implementation
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
-TCall<Y> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)();
mfp = &mockFuncs<Z2, Y>::template expectation0<X>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
- funcIndex,
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y> *call = new TCall<Y>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
-TCall<Y,A> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A);
mfp = &mockFuncs<Z2, Y>::template expectation1<X,A>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A> *call = new TCall<Y,A>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
-TCall<Y,A,B> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B);
mfp = &mockFuncs<Z2, Y>::template expectation2<X,A,B>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B> *call = new TCall<Y,A,B>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
-TCall<Y,A,B,C> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C);
mfp = &mockFuncs<Z2, Y>::template expectation3<X,A,B,C>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C> *call = new TCall<Y,A,B,C>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
-TCall<Y,A,B,C,D> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D);
mfp = &mockFuncs<Z2, Y>::template expectation4<X,A,B,C,D>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D> *call = new TCall<Y,A,B,C,D>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
-TCall<Y,A,B,C,D,E> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E);
mfp = &mockFuncs<Z2, Y>::template expectation5<X,A,B,C,D,E>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E> *call = new TCall<Y,A,B,C,D,E>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
-TCall<Y,A,B,C,D,E,F> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F);
mfp = &mockFuncs<Z2, Y>::template expectation6<X,A,B,C,D,E,F>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F> *call = new TCall<Y,A,B,C,D,E,F>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
-TCall<Y,A,B,C,D,E,F,G> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G);
mfp = &mockFuncs<Z2, Y>::template expectation7<X,A,B,C,D,E,F,G>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G> *call = new TCall<Y,A,B,C,D,E,F,G>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
-TCall<Y,A,B,C,D,E,F,G,H> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H);
mfp = &mockFuncs<Z2, Y>::template expectation8<X,A,B,C,D,E,F,G,H>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H> *call = new TCall<Y,A,B,C,D,E,F,G,H>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
-TCall<Y,A,B,C,D,E,F,G,H,I> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I);
mfp = &mockFuncs<Z2, Y>::template expectation9<X,A,B,C,D,E,F,G,H,I>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I> *call = new TCall<Y,A,B,C,D,E,F,G,H,I>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
-TCall<Y,A,B,C,D,E,F,G,H,I,J> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J);
mfp = &mockFuncs<Z2, Y>::template expectation10<X,A,B,C,D,E,F,G,H,I,J>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K);
mfp = &mockFuncs<Z2, Y>::template expectation11<X,A,B,C,D,E,F,G,H,I,J,K>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L);
mfp = &mockFuncs<Z2, Y>::template expectation12<X,A,B,C,D,E,F,G,H,I,J,K,L>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M);
mfp = &mockFuncs<Z2, Y>::template expectation13<X,A,B,C,D,E,F,G,H,I,J,K,L,M>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N);
mfp = &mockFuncs<Z2, Y>::template expectation14<X,A,B,C,D,E,F,G,H,I,J,K,L,M,N>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
- funcIndex,
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O);
mfp = &mockFuncs<Z2, Y>::template expectation15<X,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
- funcIndex,
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P);
mfp = &mockFuncs<Z2, Y>::template expectation16<X,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
template <typename Z>
-Z MockRepository::DoExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
+Z MockRepository::DoExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple) &&
!call->satisfied)
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
if (call->eHolder)
call->eHolder->rethrow();
if (call->retVal)
return ((ReturnValueWrapper<Z> *)call->retVal)->rv;
if (call->functor != NULL)
return (*(TupleInvocable<Z> *)(call->functor))(tuple);
throw NoResultSetUpException(call->getArgs(), call->funcName);
}
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
throw ExpectationException(this, call->getArgs(), call->funcName);
}
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
-
+
if (call->eHolder)
call->eHolder->rethrow();
if (call->retVal)
return ((ReturnValueWrapper<Z> *)call->retVal)->rv;
-
+
if (call->functor != NULL)
return (*(TupleInvocable<Z> *)(call->functor))(tuple);
-
+
throw NoResultSetUpException(call->getArgs(), call->funcName);
}
}
const char *funcName = NULL;
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
throw ExpectationException(this, &tuple, funcName);
}
template <typename base>
base *MockRepository::InterfaceMock() {
mock<base> *m = new mock<base>(this);
mocks.push_back(m);
return reinterpret_cast<base *>(m);
}
template <typename base>
base *MockRepository::ClassMock() {
classMock<base> *m = new classMock<base>(this);
mocks.push_back(m);
return reinterpret_cast<base *>(m);
}
inline std::ostream &operator<<(std::ostream &os, const Call &call)
{
os << call.fileName << "(" << call.lineno << ") ";
if (call.expectation == Once)
os << "Expectation for ";
else
os << "Result set for ";
os << call.funcName;
if (call.getArgs())
call.getArgs()->printTo(os);
else
os << "(...)";
@@ -2308,51 +2309,50 @@ inline std::ostream &operator<<(std::ostream &os, const Call &call)
else
os << "used." << std::endl;
return os;
}
inline std::ostream &operator<<(std::ostream &os, const MockRepository &repo)
{
if (repo.expectations.size())
{
os << "Expections set:" << std::endl;
for (std::list<Call *>::const_iterator exp = repo.expectations.begin(); exp != repo.expectations.end(); ++exp)
os << **exp;
os << std::endl;
}
if (repo.neverCalls.size())
{
os << "Functions explicitly expected to not be called:" << std::endl;
for (std::list<Call *>::const_iterator exp = repo.neverCalls.begin(); exp != repo.neverCalls.end(); ++exp)
os << **exp;
os << std::endl;
}
if (repo.optionals.size())
{
os << "Optional results set up:" << std::endl;
for (std::list<Call *>::const_iterator exp = repo.optionals.begin(); exp != repo.optionals.end(); ++exp)
os << **exp;
os << std::endl;
}
return os;
}
-inline void BaseException::setException(const char *description, MockRepository *repo)
+inline void BaseException::setException(const char *description, MockRepository *repo)
{
std::stringstream text;
text << description;
text << *repo;
std::string result = text.str();
strncpy(buffer, result.c_str(), sizeof(buffer)-1);
buffer[sizeof(buffer)-1] = '\0';
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
-
diff --git a/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py b/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py
index bbdac1d..56af18a 100644
--- a/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py
+++ b/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py
@@ -72,115 +72,119 @@ class BatchFileExecutionError(VisualCException):
# Dict to 'canonalize' the arch
_ARCH_TO_CANONICAL = {
"amd64" : "amd64",
"emt64" : "amd64",
"i386" : "x86",
"i486" : "x86",
"i586" : "x86",
"i686" : "x86",
"ia64" : "ia64",
"itanium" : "ia64",
"x86" : "x86",
"x86_64" : "amd64",
}
# Given a (host, target) tuple, return the argument for the bat file. Both host
# and targets should be canonalized.
_HOST_TARGET_ARCH_TO_BAT_ARCH = {
("x86", "x86"): "x86",
("x86", "amd64"): "x86_amd64",
("amd64", "amd64"): "amd64",
("amd64", "x86"): "x86",
("x86", "ia64"): "x86_ia64"
}
def get_host_target(env):
debug('vc.py:get_host_target()')
host_platform = env.get('HOST_ARCH')
if not host_platform:
host_platform = platform.machine()
# TODO(2.5): the native Python platform.machine() function returns
# '' on all Python versions before 2.6, after which it also uses
# PROCESSOR_ARCHITECTURE.
if not host_platform:
host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '')
-
+
# Retain user requested TARGET_ARCH
req_target_platform = env.get('TARGET_ARCH')
debug('vc.py:get_host_target() req_target_platform:%s'%req_target_platform)
if req_target_platform:
# If user requested a specific platform then only try that one.
target_platform = req_target_platform
else:
target_platform = host_platform
-
+
try:
host = _ARCH_TO_CANONICAL[host_platform.lower()]
except KeyError, e:
msg = "Unrecognized host architecture %s"
raise ValueError(msg % repr(host_platform))
try:
target = _ARCH_TO_CANONICAL[target_platform.lower()]
except KeyError, e:
raise ValueError("Unrecognized target architecture %s" % target_platform)
return (host, target,req_target_platform)
-_VCVER = ["10.0", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"]
+_VCVER = ["12.0", "11.0", "10.0", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"]
_VCVER_TO_PRODUCT_DIR = {
+ '12.0': [
+ r'Microsoft\VisualStudio\12.0\Setup\VC\ProductDir'],
+ '11.0': [
+ r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'],
'10.0': [
r'Microsoft\VisualStudio\10.0\Setup\VC\ProductDir'],
'9.0': [
r'Microsoft\VisualStudio\9.0\Setup\VC\ProductDir'],
'9.0Exp' : [
r'Microsoft\VCExpress\9.0\Setup\VC\ProductDir'],
'8.0': [
r'Microsoft\VisualStudio\8.0\Setup\VC\ProductDir'],
'8.0Exp': [
r'Microsoft\VCExpress\8.0\Setup\VC\ProductDir'],
'7.1': [
r'Microsoft\VisualStudio\7.1\Setup\VC\ProductDir'],
'7.0': [
r'Microsoft\VisualStudio\7.0\Setup\VC\ProductDir'],
'6.0': [
r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir']
}
-
+
def msvc_version_to_maj_min(msvc_version):
msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.'])
t = msvc_version_numeric.split(".")
if not len(t) == 2:
raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric))
try:
maj = int(t[0])
min = int(t[1])
return maj, min
except ValueError, e:
raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric))
def is_host_target_supported(host_target, msvc_version):
"""Return True if the given (host, target) tuple is supported given the
msvc version.
Parameters
----------
host_target: tuple
tuple of (canonalized) host-target, e.g. ("x86", "amd64") for cross
compilation from 32 bits windows to 64 bits.
msvc_version: str
msvc version (major.minor, e.g. 10.0)
Note
----
This only check whether a given version *may* support the given (host,
target), not that the toolchain is actually present on the machine.
"""
# We assume that any Visual Studio version supports x86 as a target
if host_target[1] != "x86":
maj, min = msvc_version_to_maj_min(msvc_version)
if maj < 8:
return False
@@ -196,261 +200,260 @@ def find_vc_pdir(msvc_version):
If for some reason the requested version could not be found, an
exception which inherits from VisualCException will be raised."""
root = 'Software\\'
if common.is_win64():
root = root + 'Wow6432Node\\'
try:
hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version]
except KeyError:
debug("Unknown version of MSVC: %s" % msvc_version)
raise UnsupportedVersion("Unknown version %s" % msvc_version)
for key in hkeys:
key = root + key
try:
comps = common.read_reg(key)
except WindowsError, e:
debug('find_vc_dir(): no VC registry key %s' % repr(key))
else:
debug('find_vc_dir(): found VC in registry: %s' % comps)
if os.path.exists(comps):
return comps
else:
debug('find_vc_dir(): reg says dir is %s, but it does not exist. (ignoring)'\
% comps)
raise MissingConfiguration("registry dir %s not found on the filesystem" % comps)
return None
def find_batch_file(env,msvc_version,host_arch,target_arch):
"""
Find the location of the batch script which should set up the compiler
for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
"""
pdir = find_vc_pdir(msvc_version)
if pdir is None:
raise NoVersionFound("No version of Visual Studio found")
-
+
debug('vc.py: find_batch_file() pdir:%s'%pdir)
# filter out e.g. "Exp" from the version name
msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."])
vernum = float(msvc_ver_numeric)
if 7 <= vernum < 8:
pdir = os.path.join(pdir, os.pardir, "Common7", "Tools")
batfilename = os.path.join(pdir, "vsvars32.bat")
elif vernum < 7:
pdir = os.path.join(pdir, "Bin")
batfilename = os.path.join(pdir, "vcvars32.bat")
else: # >= 8
batfilename = os.path.join(pdir, "vcvarsall.bat")
if not os.path.exists(batfilename):
debug("Not found: %s" % batfilename)
batfilename = None
-
+
installed_sdks=get_installed_sdks()
for _sdk in installed_sdks:
sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch)
sdk_bat_file_path=os.path.join(pdir,sdk_bat_file)
debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path)
if os.path.exists(sdk_bat_file_path):
return (batfilename,sdk_bat_file_path)
else:
debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path)
else:
return (batfilename,None)
__INSTALLED_VCS_RUN = None
def cached_get_installed_vcs():
global __INSTALLED_VCS_RUN
if __INSTALLED_VCS_RUN is None:
ret = get_installed_vcs()
__INSTALLED_VCS_RUN = ret
return __INSTALLED_VCS_RUN
def get_installed_vcs():
installed_versions = []
for ver in _VCVER:
debug('trying to find VC %s' % ver)
try:
if find_vc_pdir(ver):
debug('found VC %s' % ver)
installed_versions.append(ver)
else:
debug('find_vc_pdir return None for ver %s' % ver)
except VisualCException, e:
debug('did not find VC %s: caught exception %s' % (ver, str(e)))
return installed_versions
def reset_installed_vcs():
"""Make it try again to find VC. This is just for the tests."""
__INSTALLED_VCS_RUN = None
def script_env(script, args=None):
stdout = common.get_output(script, args)
# Stupid batch files do not set return code: we take a look at the
# beginning of the output for an error message instead
olines = stdout.splitlines()
if olines[0].startswith("The specified configuration type is missing"):
raise BatchFileExecutionError("\n".join(olines[:2]))
return common.parse_output(stdout)
def get_default_version(env):
debug('get_default_version()')
msvc_version = env.get('MSVC_VERSION')
msvs_version = env.get('MSVS_VERSION')
-
+
debug('get_default_version(): msvc_version:%s msvs_version:%s'%(msvc_version,msvs_version))
if msvs_version and not msvc_version:
SCons.Warnings.warn(
SCons.Warnings.DeprecatedWarning,
"MSVS_VERSION is deprecated: please use MSVC_VERSION instead ")
return msvs_version
elif msvc_version and msvs_version:
if not msvc_version == msvs_version:
SCons.Warnings.warn(
SCons.Warnings.VisualVersionMismatch,
"Requested msvc version (%s) and msvs version (%s) do " \
"not match: please use MSVC_VERSION only to request a " \
"visual studio version, MSVS_VERSION is deprecated" \
% (msvc_version, msvs_version))
return msvs_version
if not msvc_version:
installed_vcs = cached_get_installed_vcs()
debug('installed_vcs:%s' % installed_vcs)
if not installed_vcs:
msg = 'No installed VCs'
debug('msv %s\n' % repr(msg))
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, msg)
return None
msvc_version = installed_vcs[0]
debug('msvc_setup_env: using default installed MSVC version %s\n' % repr(msvc_version))
return msvc_version
def msvc_setup_env_once(env):
try:
has_run = env["MSVC_SETUP_RUN"]
except KeyError:
has_run = False
if not has_run:
msvc_setup_env(env)
env["MSVC_SETUP_RUN"] = True
def msvc_find_valid_batch_script(env,version):
debug('vc.py:msvc_find_valid_batch_script()')
# Find the host platform, target platform, and if present the requested
# target platform
(host_platform, target_platform,req_target_platform) = get_host_target(env)
# If the user hasn't specifically requested a TARGET_ARCH, and
# The TARGET_ARCH is amd64 then also try 32 bits if there are no viable
# 64 bit tools installed
try_target_archs = [target_platform]
if target_platform=='amd64':
try_target_archs.append('x86')
d = None
for tp in try_target_archs:
# Set to current arch.
env['TARGET_ARCH']=tp
-
+
debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp)
host_target = (host_platform, tp)
if not is_host_target_supported(host_target, version):
warn_msg = "host, target = %s not supported for MSVC version %s" % \
(host_target, version)
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target]
-
+
# Try to locate a batch file for this host/target platform combo
try:
(vc_script,sdk_script) = find_batch_file(env,version,host_platform,tp)
debug('vc.py:msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
except VisualCException, e:
msg = str(e)
debug('Caught exception while looking for batch file (%s)' % msg)
warn_msg = "VC version %s not installed. " + \
"C/C++ compilers are most likely not set correctly.\n" + \
" Installed versions are: %s"
warn_msg = warn_msg % (version, cached_get_installed_vcs())
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
continue
-
+
# Try to use the located batch file for this host/target platform combo
debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg))
if vc_script:
try:
d = script_env(vc_script, args=arg)
except BatchFileExecutionError, e:
debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
vc_script=None
if not vc_script and sdk_script:
debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script))
try:
d = script_env(sdk_script,args=[])
except BatchFileExecutionError,e:
debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e))
continue
elif not vc_script and not sdk_script:
debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found')
continue
-
+
# If we cannot find a viable installed compiler, reset the TARGET_ARCH
# To it's initial value
if not d:
env['TARGET_ARCH']=req_target_platform
-
+
return d
-
+
def msvc_setup_env(env):
debug('msvc_setup_env()')
version = get_default_version(env)
if version is None:
warn_msg = "No version of Visual Studio compiler found - C/C++ " \
"compilers most likely not set correctly"
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
return None
debug('msvc_setup_env: using specified MSVC version %s\n' % repr(version))
# XXX: we set-up both MSVS version for backward
# compatibility with the msvs tool
env['MSVC_VERSION'] = version
env['MSVS_VERSION'] = version
env['MSVS'] = {}
-
+
use_script = env.get('MSVC_USE_SCRIPT', True)
if SCons.Util.is_String(use_script):
debug('vc.py:msvc_setup_env() use_script 1 %s\n' % repr(use_script))
d = script_env(use_script)
- elif use_script:
+ elif use_script:
d = msvc_find_valid_batch_script(env,version)
debug('vc.py:msvc_setup_env() use_script 2 %s\n' % d)
if not d:
return d
else:
debug('MSVC_USE_SCRIPT set to False')
warn_msg = "MSVC_USE_SCRIPT set to False, assuming environment " \
"set correctly."
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
return None
for k, v in d.items():
debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v))
env.PrependENVPath(k, v, delete_existing=True)
def msvc_exists(version=None):
vcs = cached_get_installed_vcs()
if version is None:
return len(vcs) > 0
return version in vcs
-
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 767c326..51be9ab 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -1,405 +1,444 @@
import sys, os, re, platform, hashlib
sys.path.append(Dir("#/BuildTools/SCons").abspath)
################################################################################
# Build variables
################################################################################
vars = Variables(os.path.join(Dir("#").abspath, "config.py"))
vars.Add('cc', "C compiler")
vars.Add('cxx', "C++ compiler")
vars.Add('ccflags', "Extra C/C++/ObjC compiler flags")
vars.Add('cxxflags', "Extra C++ compiler flags")
vars.Add('link', "Linker")
vars.Add('linkflags', "Extra linker flags")
+vars.Add('ar', "Archiver (ar or lib)")
+if os.name == "nt":
+ vars.Add('mt', "manifest tool")
vars.Add(BoolVariable("ccache", "Use CCache", "no"))
vars.Add(EnumVariable("test", "Compile and run tests", "none", ["none", "all", "unit", "system"]))
vars.Add(BoolVariable("optimize", "Compile with optimizations turned on", "no"))
vars.Add(BoolVariable("debug", "Compile with debug information", "yes"))
vars.Add(BoolVariable("allow_warnings", "Allow compilation warnings during compilation", "yes"))
vars.Add(BoolVariable("assertions", "Compile with assertions", "yes"))
vars.Add(BoolVariable("max_jobs", "Build with maximum number of parallel jobs", "no"))
vars.Add(EnumVariable("target", "Choose a target platform for compilation", "native", ["native", "iphone-simulator", "iphone-device", "xcode", "android"]))
vars.Add('android_toolchain', "Path to Android toolchain")
vars.Add('android_sdk_bin', "Path to Android SDK's tools directory")
vars.Add(BoolVariable("swift_mobile", "Build mobile Swift", "no"))
vars.Add(BoolVariable("swiften_dll", "Build Swiften as dynamically linked library", "no"))
if os.name != "nt" :
vars.Add(BoolVariable("coverage", "Compile with coverage information", "no"))
if os.name == "posix" :
vars.Add(BoolVariable("valgrind", "Run tests with valgrind", "no"))
if os.name == "mac" or (os.name == "posix" and os.uname()[0] == "Darwin"):
vars.Add(BoolVariable("universal", "Create universal binaries", "no"))
vars.Add(BoolVariable("mac105", "Link against the 10.5 frameworks", "no"))
vars.Add(BoolVariable("mac106", "Link against the 10.6 frameworks", "no"))
if os.name == "nt" :
vars.Add(PathVariable("vcredist", "MSVC redistributable dir", None, PathVariable.PathAccept))
if os.name == "nt" :
vars.Add(PathVariable("wix_bindir", "Path to WiX binaries", "", PathVariable.PathAccept))
if os.name == "nt" :
vars.Add(PackageVariable("bonjour", "Bonjour SDK location", "yes"))
vars.Add(PackageVariable("openssl", "OpenSSL location", "yes"))
+vars.Add("openssl_libnames", "Comma-separated openssl library names to override defaults", None)
vars.Add(BoolVariable("openssl_force_bundled", "Force use of the bundled OpenSSL", "no"))
+vars.Add("openssl_include", "Location of OpenSSL include files (if not under (openssl)/include)", None)
+vars.Add("openssl_libdir", "Location of OpenSSL library files (if not under (openssl)/lib)", None)
vars.Add(PackageVariable("hunspell", "Hunspell location", False))
vars.Add(PathVariable("boost_includedir", "Boost headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("boost_libdir", "Boost library location", None, PathVariable.PathAccept))
+vars.Add(BoolVariable("boost_bundled_enable", "Allow use of bundled Boost as last resort", "true"))
+vars.Add(PathVariable("zlib_includedir", "Zlib headers location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("zlib_libdir", "Zlib library location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("zlib_libfile", "Zlib library file (full path to file)", None, PathVariable.PathAccept))
+vars.Add(BoolVariable("zlib_bundled_enable", "Allow use of bundled Zlib as last resort", "true"))
+vars.Add(BoolVariable("try_gconf", "Try configuring for GConf?", "true"))
+vars.Add(BoolVariable("try_libxml", "Try configuring for libXML?", "true"))
+vars.Add(BoolVariable("try_expat", "Try configuring for expat?", "true"))
vars.Add(PathVariable("expat_includedir", "Expat headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("expat_libdir", "Expat library location", None, PathVariable.PathAccept))
-vars.Add("expat_libname", "Expat library name", "libexpat" if os.name == "nt" else "expat")
+vars.Add("expat_libname", "Expat library name", os.name == "nt" and "libexpat" or "expat")
vars.Add(PackageVariable("icu", "ICU library location", "no"))
+vars.Add(BoolVariable("libidn_bundled_enable", "Allow use of bunded Expat", "true"))
+vars.Add(BoolVariable("try_libidn", "Try configuring for LibIDN?", "true"))
vars.Add(PathVariable("libidn_includedir", "LibIDN headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libidn_libdir", "LibIDN library location", None, PathVariable.PathAccept))
-vars.Add("libidn_libname", "LibIDN library name", "libidn" if os.name == "nt" else "idn")
+vars.Add("libidn_libname", "LibIDN library name", os.name == "nt" and "libidn" or "idn")
vars.Add(PathVariable("libminiupnpc_includedir", "LibMiniUPNPC headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libminiupnpc_libdir", "LibMiniUPNPC library location", None, PathVariable.PathAccept))
vars.Add("libminiupnpc_libname", "LibMiniUPNPC library name", "libminiupnpc" if os.name == "nt" else "miniupnpc")
vars.Add(PathVariable("libnatpmp_includedir", "LibNATPMP headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libnatpmp_libdir", "LibNATPMP library location", None, PathVariable.PathAccept))
vars.Add("libnatpmp_libname", "LibNATPMP library name", "libnatpmp" if os.name == "nt" else "natpmp")
vars.Add(PathVariable("sqlite_includedir", "SQLite headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("sqlite_libdir", "SQLite library location", None, PathVariable.PathAccept))
-vars.Add("sqlite_libname", "SQLite library name", "libsqlite3" if os.name == "nt" else "sqlite3")
+vars.Add("sqlite_libname", "SQLite library name", os.name == "nt" and "libsqlite3" or "sqlite3")
vars.Add("sqlite_force_bundled", "Force use of the bundled SQLite", None)
vars.Add(PathVariable("lua_includedir", "Lua headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("lua_libdir", "Lua library location", None, PathVariable.PathAccept))
vars.Add("lua_libname", "Lua library name", "liblua" if os.name == "nt" else "lua")
vars.Add("lua_force_bundled", "Force use of the bundled Lua", None)
vars.Add(PathVariable("editline_includedir", "Readline headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("editline_libdir", "Readline library location", None, PathVariable.PathAccept))
vars.Add("editline_libname", "Readline library name", "libedit" if os.name == "nt" else "edit")
+vars.Add(BoolVariable("try_avahi", "Try configuring for avahi?", "true"))
vars.Add(PathVariable("avahi_includedir", "Avahi headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("avahi_libdir", "Avahi library location", None, PathVariable.PathAccept))
vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept))
vars.Add(BoolVariable("qt5", "Compile in Qt5 mode", "no")) # TODO: auto-detect this
vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccept))
vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))
vars.Add(BoolVariable("build_examples", "Build example programs", "yes"))
vars.Add(BoolVariable("enable_variants", "Build in a separate dir under build/, depending on compile flags", "no"))
vars.Add(BoolVariable("experimental_ft", "Build experimental file transfer", "yes"))
vars.Add(BoolVariable("experimental", "Build experimental features", "no"))
vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0", "yes"))
vars.Add(BoolVariable("unbound", "Build bundled ldns and unbound. Use them for DNS lookup.", "no"))
+vars.Add(BoolVariable("install_git_hooks", "Install git hooks", "true"))
+
################################################################################
# Set up default build & configure environment
################################################################################
-
env_ENV = {
- 'PATH' : os.environ['PATH'],
+ 'PATH' : os.environ['PATH'],
'LD_LIBRARY_PATH' : os.environ.get("LD_LIBRARY_PATH", ""),
'TERM' : os.environ.get("TERM", ""),
}
+
if "MSVC_VERSION" in ARGUMENTS :
- env = Environment(ENV = env_ENV, variables = vars, MSVC_VERSION = ARGUMENTS["MSVC_VERSION"])
+ env = Environment(ENV = env_ENV, variables = vars, MSVC_VERSION = ARGUMENTS["MSVC_VERSION"], platform = ARGUMENTS.get("PLATFORM", None))
else :
- env = Environment(ENV = env_ENV, variables = vars)
+ env = Environment(ENV = env_ENV, variables = vars, platform = ARGUMENTS.get("PLATFORM", None))
Help(vars.GenerateHelpText(env))
# Workaround for missing Visual Studio 2012 support in SCons
# Requires scons to be run from a VS2012 console
if env.get("MSVC_VERSION", "").startswith("11.0") :
env["ENV"]["LIB"] = os.environ["LIB"]
env["ENV"]["INCLUDE"] = os.environ["INCLUDE"]
# Default environment variables
env["PLATFORM_FLAGS"] = {
"LIBPATH": [],
"LIBS": [],
"FRAMEWORKS": [],
}
# Default custom tools
env.Tool("Test", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("WriteVal", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("BuildVersion", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("Flags", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "darwin" :
env.Tool("Nib", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("AppBundle", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "win32" :
env.Tool("WindowsBundle", toolpath = ["#/BuildTools/SCons/Tools"])
#So we don't need to escalate with UAC
if "TMP" in os.environ.keys() :
- env['ENV']['TMP'] = os.environ['TMP']
+ env['ENV']['TMP'] = os.environ['TMP']
env.Tool("SLOCCount", toolpath = ["#/BuildTools/SCons/Tools"])
# Max out the number of jobs
if env["max_jobs"] :
try :
import multiprocessing
SetOption("num_jobs", multiprocessing.cpu_count())
except NotImplementedError :
pass
except ImportError :
pass
# Set speed options
env.Decider("MD5-timestamp")
env.SetOption("max_drift", 1)
env.SetOption("implicit_cache", True)
# Set the default compiler to CLang on OS X, and set the necessary flags
if env["PLATFORM"] == "darwin" and env["target"] == "native" :
if "cc" not in env :
env["CC"] = "clang"
if platform.machine() == "x86_64" :
env["CCFLAGS"] = ["-arch", "x86_64"]
if "cxx" not in env :
env["CXX"] = "clang++"
# Compiling Qt5 in C++0x mode includes headers that we don't have
if not env["qt5"] :
env["CXXFLAGS"] = ["-std=c++11"]
if "link" not in env :
env["LINK"] = "clang"
if platform.machine() == "x86_64" :
env.Append(LINKFLAGS = ["-arch", "x86_64"])
# Check whether we are running inside scan-build, and override compiler if so
if "CCC_ANALYZER_HTML" in os.environ :
for key, value in os.environ.items() :
if key.startswith("CCC_") or key.startswith("CLANG") :
env["ENV"][key] = value
env["CC"] = os.environ["CC"]
env["CXX"] = os.environ["CXX"]
# Override the compiler with custom variables set at config time
if "cc" in env :
env["CC"] = env["cc"]
if "cxx" in env :
env["CXX"] = env["cxx"]
+if "ar" in env :
+ env["AR"] = env["ar"]
+
if "link" in env :
env["SHLINK"] = env["link"]
env["LINK"] = env["link"]
for flags_type in ["ccflags", "cxxflags", "linkflags"] :
if flags_type in env :
if isinstance(env[flags_type], str) :
# FIXME: Make the splitting more robust
env[flags_type.upper()] = env[flags_type].split(" ")
else :
env[flags_type.upper()] = env[flags_type]
# This isn't a real flag (yet) AFAIK. Be sure to append it to the CXXFLAGS
# where you need it
env["OBJCCFLAGS"] = []
if env["optimize"] :
if env["PLATFORM"] == "win32" :
env.Append(CCFLAGS = ["/O2"])
else :
env.Append(CCFLAGS = ["-O2"])
if env["target"] == "xcode" and os.environ["CONFIGURATION"] == "Release" :
env.Append(CCFLAGS = ["-Os"])
if env["debug"] :
if env["PLATFORM"] == "win32" :
env.Append(CCFLAGS = ["/Zi"])
env.Append(LINKFLAGS = ["/DEBUG"])
if env["set_iterator_debug_level"] :
env.Append(CPPDEFINES = ["_ITERATOR_DEBUG_LEVEL=0"])
if env["optimize"] :
env.Append(LINKFLAGS = ["/OPT:NOREF"])
env.Append(CCFLAGS = ["/MD"])
else :
env.Append(CCFLAGS = ["/MDd"])
else :
env.Append(CCFLAGS = ["-g"])
elif env["PLATFORM"] == "win32" :
env.Append(CCFLAGS = ["/MD"])
if env.get("universal", 0) :
assert(env["PLATFORM"] == "darwin")
env.Append(CCFLAGS = [
- "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
- "-arch", "i386",
+ "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
+ "-arch", "i386",
"-arch", "ppc"])
env.Append(LINKFLAGS = [
- "-mmacosx-version-min=10.4",
- "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
- "-arch", "i386",
+ "-mmacosx-version-min=10.4",
+ "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
+ "-arch", "i386",
"-arch", "ppc"])
# Link against other versions of the OS X SDKs.
# FIXME: This method does not work anymore, we need to set deployment targets.
if env.get("mac105", 0) :
assert(env["PLATFORM"] == "darwin")
env.Append(CCFLAGS = [
- "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
+ "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
"-arch", "i386"])
env.Append(LINKFLAGS = [
- "-mmacosx-version-min=10.5",
- "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
+ "-mmacosx-version-min=10.5",
+ "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
"-arch", "i386"])
if env.get("mac106", 0) :
assert(env["PLATFORM"] == "darwin")
env.Append(CCFLAGS = [
- "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
+ "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
"-arch", "i386"])
env.Append(LINKFLAGS = [
- "-mmacosx-version-min=10.6",
- "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
+ "-mmacosx-version-min=10.6",
+ "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
"-arch", "i386"])
if not env["assertions"] :
env.Append(CPPDEFINES = ["NDEBUG"])
if env["experimental_ft"] :
env.Append(CPPDEFINES = ["SWIFT_EXPERIMENTAL_FT"])
if env["experimental"] :
env.Append(CPPDEFINES = ["SWIFT_EXPERIMENTAL_HISTORY", "SWIFT_EXPERIMENTAL_WB"])
# If we build shared libs on AMD64, we need -fPIC.
# This should have no performance impact om AMD64
if env["PLATFORM"] == "posix" and platform.machine() == "x86_64" :
env.Append(CCFLAGS = ["-fPIC"])
# Warnings
if env["PLATFORM"] == "win32" :
env.Append(CXXFLAGS = ["/wd4068"])
+elif env["PLATFORM"] == "hpux" :
+ # HP-UX gives a flood of minor warnings if this is enabled
+ #env.Append(CXXFLAGS = ["+w"])
+ pass
+elif env["PLATFORM"] == "sunos" :
+ #env.Append(CXXFLAGS = ["-z verbose"])
+ pass
else :
if "clang" in env["CXX"] :
env.Append(CXXFLAGS = [
"-Weverything",
"-Wno-unknown-warning-option", # To stay compatible between CLang versions
"-Wno-unknown-pragmas", # To stay compatible between CLang versions
"-Wno-weak-vtables", # Virtually none of our elements have outlined methods. This also seems to affect classes in .cpp files, which in turn affects all our tests, which may need fixing in CLang
"-Wno-shadow", # Also warns for shadowing on constructor arguments, which we do a lot
"-Wno-documentation", # We don't care about documentation warnings
"-Wno-exit-time-destructors", # Used a lot in e.g. CPPUnit
"-Wno-c++98-compat-pedantic", # We do different things that violate this, but they could be fixed
"-Wno-global-constructors", # We depend on this for e.g. string constants
"-Wno-disabled-macro-expansion", # Caused due to system headers
"-Wno-c++11-extensions", # We use C++11; turn this off when we use -std=c++11
"-Wno-long-long", # We use long long
"-Wno-padded",
"-Wno-missing-variable-declarations", # Getting rid of CPPUnit warnings
"-Wno-direct-ivar-access", # Obj-C code warning
])
else :
env.Append(CXXFLAGS = ["-Wextra", "-Wall", "-Wnon-virtual-dtor", "-Wundef", "-Wold-style-cast", "-Wno-long-long", "-Woverloaded-virtual", "-Wfloat-equal", "-Wredundant-decls", "-Wno-unknown-pragmas"])
gccVersion = env.get("CCVERSION", "0.0.0").split(".")
if gccVersion >= ["4", "5", "0"] and not "clang" in env["CC"] :
env.Append(CXXFLAGS = ["-Wlogical-op"])
if not env.get("allow_warnings", False) :
env.Append(CXXFLAGS = ["-Werror"])
if env.get("coverage", 0) :
assert(env["PLATFORM"] != "win32")
env.Append(CCFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
env.Append(LINKFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
if env["PLATFORM"] == "win32" :
env.Append(LIBS = ["user32", "crypt32", "dnsapi", "iphlpapi", "ws2_32", "wsock32", "Advapi32"])
env.Append(CCFLAGS = ["/EHsc", "/nologo", "/Zm256"])
env.Append(LINKFLAGS = ["/INCREMENTAL:no", "/NOLOGO"])
if int(env["MSVS_VERSION"].split(".")[0]) < 10 :
- env["LINKCOM"] = [env["LINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']
- env["SHLINKCOM"] = [env["SHLINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2']
+ mt = env.get('mt')
+ if not mt:
+ mt = 'mt.exe'
+ env["LINKCOM"] = [env["LINKCOM"], '%s -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1' % mt]
+ env["SHLINKCOM"] = [env["SHLINKCOM"], '%s -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2' % mt]
if env["PLATFORM"] == "darwin" and not env["target"] in ["iphone-device", "iphone-simulator", "xcode", "android"] :
env["PLATFORM_FLAGS"]["FRAMEWORKS"] += ["IOKit", "AppKit", "SystemConfiguration", "Security", "SecurityInterface"]
+# Required by boost headers on HP-UX
+if env["PLATFORM"] == "hpux" :
+ env.Append(CXXFLAGS = ["+hpxstd98", "-mt", "-AA"])
+ # FIXME: Need -AA for linking C++ but not C
+ #env.Append(LINKFLAGS = ["-AA"])
+
+
# Testing
env["TEST_TYPE"] = env["test"]
if "check" in ARGUMENTS :
env["TEST_TYPE"] = "unit"
env["checker_report"] = ARGUMENTS.get("checker_report", False)
env["TEST"] = (env["TEST_TYPE"] != "none") or env.GetOption("clean")
if env.get("valgrind", 0) :
env["TEST_RUNNER"] = "valgrind --suppressions=QA/valgrind.supp -q --leak-check=full --track-origins=yes "
env["TEST_IGNORE_RESULT"] = "ignore_test_result" in ARGUMENTS
env["TEST_CREATE_LIBRARIES"] = "create_test_libraries" in ARGUMENTS
# Packaging
env["DIST"] = "dist" in ARGUMENTS or env.GetOption("clean")
for path in ["SWIFT_INSTALLDIR", "SWIFTEN_INSTALLDIR", "SLUIFT_INSTALLDIR"] :
if ARGUMENTS.get(path, "") :
if os.path.isabs(ARGUMENTS[path]) :
env[path] = Dir(ARGUMENTS[path]).abspath
else :
env[path] = Dir("#/" + ARGUMENTS[path]).abspath
################################################################################
# XCode / iPhone / ...
################################################################################
target = env["target"]
if target in ["iphone-device", "iphone-simulator", "xcode"] :
# Extract/initialize all the information we need
if target == "xcode" :
# Get the information from the XCode environment
env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = os.environ["PLATFORM_DEVELOPER_BIN_DIR"]
env["XCODE_SDKROOT"] = os.environ["SDKROOT"]
env["XCODE_ARCH_FLAGS"] = sum([["-arch", arch] for arch in os.environ["ARCHS"].split(" ")], [])
env["IPHONEOS_DEPLOYMENT_TARGET"] = os.environ["IPHONEOS_DEPLOYMENT_TARGET"]
# Use absolute path sources so Xcode can highlight compilation errors in swiften
env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM ${SOURCES.abspath}'
else :
# Hard code values
env["XCODE_PLATFORM_DEVELOPER_BIN_DIR"] = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin"
if target == "iphone-device":
env["XCODE_ARCH_FLAGS"] = ["-arch", "armv6", "-arch", "armv7"]
sdkPart = "iPhoneOS"
else :
env["XCODE_ARCH_FLAGS"] = ["-arch", "i386"]
sdkPart = "iPhoneSimulator"
sdkVer = "6.0"
env["XCODE_SDKROOT"] = "/Applications/Xcode.app/Contents/Developer/Platforms/" + sdkPart + ".platform/Developer/SDKs/" + sdkPart + sdkVer + ".sdk"
env["IPHONEOS_DEPLOYMENT_TARGET"] = "4.1"
# Set the build flags
env["CC"] = "$XCODE_PLATFORM_DEVELOPER_BIN_DIR/gcc"
env["CXX"] = "$XCODE_PLATFORM_DEVELOPER_BIN_DIR/g++"
env["OBJCCFLAGS"] = ["-fobjc-abi-version=2", "-fobjc-legacy-dispatch"]
env["LD"] = env["CC"]
env.Append(CCFLAGS = env["XCODE_ARCH_FLAGS"] + ["-fvisibility=hidden", "-miphoneos-version-min=" + env["IPHONEOS_DEPLOYMENT_TARGET"]])
env.Append(LINKFLAGS = "-miphoneos-version-min=" + env["IPHONEOS_DEPLOYMENT_TARGET"])
if os.environ.get("GCC_THUMB_SUPPORT", False) :
env.Append(CCFLAGS = ["-mthumb"])
env.Append(LINKFLAGS = env["XCODE_ARCH_FLAGS"])
env.Append(CPPFLAGS = ["-isysroot", "$XCODE_SDKROOT"])
env.Append(FRAMEWORKS = ["CoreFoundation", "Foundation", "UIKit", "CoreGraphics"])
env.Append(LINKFLAGS = env["XCODE_ARCH_FLAGS"] + ["-isysroot", "$XCODE_SDKROOT", "-L\"$XCODE_SDKROOT/usr/lib\"", "-F\"$XCODE_SDKROOT/System/Library/Frameworks\"", "-F\"$XCODE_SDKROOT/System/Library/PrivateFrameworks\""])
# Bit of a hack, because BOOST doesn't know the endianness for ARM
- env.Append(CPPDEFINES = ["_LITTLE_ENDIAN"])
+ env.Append(CPPDEFINES = ["_LITTLE_ENDIAN"])
################################################################################
# Android
################################################################################
if target in ["android"] :
env["ENV"]["PATH"] = env["android_toolchain"] + "/bin:" + env["ENV"]["PATH"]
env["CC"] = "arm-linux-androideabi-gcc"
env["CXX"] = "arm-linux-androideabi-g++"
env["RANLIB"] = "arm-linux-androideabi-ranlib"
env.Append(CPPDEFINES = ["ANDROID"])
env.Append(CPPDEFINES = ["_REENTRANT", "_GLIBCXX__PTHREADS"])
# CCache
if env.get("ccache", False) :
env["ENV"]["HOME"] = os.environ["HOME"]
for var in os.environ :
if var.startswith("CCACHE_") :
env["ENV"][var] = os.environ[var]
if env.get("CC", "") != "" :
env["CC"] = "ccache " + env["CC"]
else :
env["CC"] = "ccache gcc"
if env.get("CXX", "") != "" :
env["CXX"] = "ccache " + env["CXX"]
else :
env["CC"] = "ccache g++"
conf_env = env.Clone()
Export("env")
Export("conf_env")
variant = ""
if env["enable_variants"] :
fingerprint = ",".join([flag for flag in env["CXXFLAGS"] + env["CCFLAGS"] if not flag.startswith("-W") and not flag.startswith("-fvisibility")])
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 25a1ad3..7bda9c1 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -1,49 +1,49 @@
import sys, os, re, platform
import SCons.SConf
Import("env", "conf_env")
root = Dir("../..").abspath
# Override SConscript to handle tests
oldSConscript = SConscript
def SConscript(*arguments, **keywords) :
if not keywords.get("test_only", False) or env["TEST"] :
return apply(oldSConscript, arguments, keywords)
env.SConscript = SConscript
-
+
################################################################################
# Extend the default build environment (not affecting the configure env)
#
# Keeping both environments separated mostly because of SCons Issue 2391,
# although it doesn't hurt to separate them (e.g. not have pretty printed
# strings in config.log)
################################################################################
#if env["PLATFORM"] == "win32" :
# env["MSVC_BATCH"] = 1
# Pretty output
def colorize(command, target, color) :
colors = { "red": "31", "green": "32", "yellow": "33", "blue": "34" }
prefix = ""
suffix = ""
if sys.stdout.isatty() and env["PLATFORM"] != "win32":
prefix = "\033[0;" + colors[color] + ";140m"
suffix = "\033[0m"
return " " + prefix + command + suffix + " " + target
if int(ARGUMENTS.get("V", 0)) == 0 and not ARGUMENTS.get("dump_trace", False) :
env["CCCOMSTR"] = colorize("CC", "$TARGET", "green")
env["SHCCCOMSTR"] = colorize("CC", "$TARGET", "green")
env["CXXCOMSTR"] = colorize("CXX", "$TARGET", "green")
env["SHCXXCOMSTR"] = colorize("CXX", "$TARGET", "green")
env["LINKCOMSTR"] = colorize("LINK", "$TARGET", "red")
env["SHLINKCOMSTR"] = colorize("LINK", "$TARGET", "red")
env["ARCOMSTR"] = colorize("AR", "$TARGET", "red")
env["RANLIBCOMSTR"] = colorize("RANLIB", "$TARGET", "red")
env["PCHCOMSTR"] = colorize("PCH", "$TARGET", "blue")
env["QT4_RCCCOMSTR"] = colorize("RCC", "$TARGET", "blue")
env["QT4_UICCOMSTR"] = colorize("UIC", "$TARGET", "blue")
env["QT4_MOCFROMHCOMSTR"] = colorize("MOC", "$TARGET", "blue")
env["QT4_MOCFROMCXXCOMSTR"] = colorize("MOC", "$TARGET", "blue")
@@ -79,300 +79,329 @@ def CheckPKG(context, name):
context.Message( 'Checking for package %s... ' % name )
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
context.Result( ret )
return ret
def CheckVersion(context, library, version, define, header, value) :
context.Message("Checking " + library + " version (>= " + version + ") ...")
version = GetVersion(context, define, header)
ok = version >= value
context.Result(ok)
return ok
def GetVersion(context, define, header, extension = ".c") :
ret = context.TryRun("""
#include <%(header)s>
#include <stdio.h>
int main(int argc, char* argv[]) {
printf("%%d\\n", %(define)s);
return 0;
}
""" % { "header" : header, "define": define }, extension)
if ret[0] :
return int(ret[1])
else :
return -1
conf = Configure(conf_env)
if not conf.CheckCXX() or not conf.CheckCC() :
print "Error: You need a working compiler"
Exit(1)
env["HAVE_ZLIB"] = True
-if conf.CheckLib("z") :
- env["ZLIB_FLAGS"] = {"LIBS": ["z"]}
+zlib_flags = {}
+zlib_okay = False
+if env.get("zlib_libdir", None) :
+ zlib_flags["LIBPATH"] = [env["zlib_libdir"]]
+ zlib_okay = True
+if env.get("zlib_includedir", None) :
+ zlib_flags["CPPPATH"] = [env["zlib_includedir"]]
+ zlib_okay = True
+if env.get("zlib_libfile", None) :
+ zlib_flags["LIBS"] = [File(env["zlib_libfile"])]
+ zlib_okay = True
+elif zlib_okay :
+ zlib_flags["LIBS"] = ["z"]
+if (not zlib_okay) and conf.CheckLib("z") :
+ zlib_flags["LIBS"] = ["z"]
+ zlib_okay = True
+if zlib_okay :
+ env["ZLIB_FLAGS"] = zlib_flags
+elif not env.get("zlib_bundled_enable", True) :
+ print "Error: Zlib not found and zlib_bundled_enable is false"
+ Exit(1)
else :
env["ZLIB_BUNDLED"] = True
if conf.CheckLib("resolv") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["resolv"]
if env["PLATFORM"] != "win32" :
if conf.CheckLib("pthread") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["pthread"]
if conf.CheckLib("dl") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["dl"]
if conf.CheckLib("m") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["m"]
if conf.CheckLib("c") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["c"]
-if conf.CheckLib("stdc++") :
- env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["stdc++"]
-
+# Even if you find stdc++ on HP-UX, it is the wrong one for aCC
+if env["PLATFORM"] != "hpux" :
+ if conf.CheckLib("stdc++", language='CXX') :
+ env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["stdc++"]
conf.Finish()
# Boost
boost_conf_env = conf_env.Clone()
boost_flags = {}
if env.get("boost_libdir", None) :
boost_flags["LIBPATH"] = [env["boost_libdir"]]
if env.get("boost_includedir", None) :
- if env["PLATFORM"] == "win32" :
+ if env["PLATFORM"] == "win32" or env["PLATFORM"] == "hpux" or env["PLATFORM"] == "sunos" :
boost_flags["CPPPATH"] = [env["boost_includedir"]]
else :
# Using isystem to avoid getting warnings from a system boost
# Unfortunately, this also disables dependency tracking
boost_flags["CPPFLAGS"] = [("-isystem", env["boost_includedir"])]
boost_conf_env.MergeFlags(boost_flags)
conf = Configure(boost_conf_env)
-boostLibs = [("signals", None), ("thread", None), ("regex", None), ("program_options", None), ("filesystem", None), ("serialization", "archive/text_oarchive.hpp"), ("system", "system/system_error.hpp"), ("date_time", "date_time/date.hpp")]
+boostLibs = [("signals", None), ("system", "system/system_error.hpp"), ("thread", None), ("regex", None), ("program_options", None), ("filesystem", None), ("serialization", "archive/text_oarchive.hpp"), ("date_time", "date_time/date.hpp")]
allLibsPresent = True
libNames = []
for (lib, header) in boostLibs :
if header :
header = "boost/" + header
else :
header = "boost/" + lib + ".hpp"
if not conf.CheckCXXHeader(header) :
allLibsPresent = False
break
if env["PLATFORM"] != "win32" :
libName = "boost_" + lib
- if not conf.CheckLib(libName) :
+ if not conf.CheckLib(libName, language='CXX') :
libName += "-mt"
- if not conf.CheckLib(libName) :
+ if not conf.CheckLib(libName, language='CXX') :
allLibsPresent = False
break
libNames.append(libName)
if allLibsPresent :
env["BOOST_FLAGS"] = boost_flags
if env["PLATFORM"] != "win32" :
env["BOOST_FLAGS"].update({"LIBS": libNames})
if not conf.CheckCXXHeader("boost/uuid/uuid.hpp") :
# FIXME: Remove this workaround when UUID is available in most distros
env["BOOST_BUNDLED_UUID_ONLY"] = True
- env["BOOST_FLAGS"]["CPPDEFINES"] = ["BOOST_SIGNALS_NO_DEPRECATION_WARNING"]
+ env["BOOST_FLAGS"]["CPPDEFINES"] = ["BOOST_SIGNALS_NO_DEPRECATION_WARNING"]
+elif not env.get("boost_bundled_enable", True) :
+ print "Error: Boost not found and boost_bundled_enable is false"
+ Exit(1)
else :
env["BOOST_BUNDLED"] = True
conf.Finish()
# Xss
env["HAVE_XSS"] = 0
if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
xss_flags = {
"LIBPATH": ["/usr/X11R6/lib"],
"LIBS": ["Xss"]
}
xss_env = conf_env.Clone()
xss_env.MergeFlags(xss_flags)
conf = Configure(xss_env)
if conf.CheckFunc("XScreenSaverQueryExtension") :
env["HAVE_XSS"] = 1
env["XSS_FLAGS"] = xss_flags
conf.Finish()
# GConf
env["HAVE_GCONF"] = 0
-if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
+if env.get("try_gconf", True) and env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
gconf_env = conf_env.Clone()
conf = Configure(gconf_env, custom_tests = {"CheckPKG": CheckPKG})
if conf.CheckPKG("gconf-2.0") :
gconf_bare_env = Environment()
gconf_bare_env.ParseConfig('pkg-config --cflags gconf-2.0 gobject-2.0 --libs gconf-2.0 gobject-2.0')
gconf_flags = {
"LIBS": gconf_bare_env["LIBS"],
"CCFLAGS": gconf_bare_env["CCFLAGS"],
"CPPPATH": gconf_bare_env["CPPPATH"],
"CPPDEFINES": gconf_bare_env.get("CPPDEFINES", []),
}
gconf_env.MergeFlags(gconf_flags)
if conf.CheckCHeader("gconf/gconf-client.h") and conf.CheckLib("gconf-2") :
env["HAVE_GCONF"] = 1
env["GCONF_FLAGS"] = {
"LIBS": gconf_env["LIBS"],
"CCFLAGS": gconf_env["CCFLAGS"],
"CPPPATH": gconf_env["CPPPATH"],
"CPPDEFINES": gconf_env.get("CPPDEFINES", []),
}
conf.Finish()
# Sparkle
env["HAVE_SPARKLE"] = 0
if env["PLATFORM"] == "darwin" :
sparkle_flags = {
"FRAMEWORKPATH": ["/Library/Frameworks"],
"FRAMEWORKS": ["Sparkle"]
}
sparkle_env = conf_env.Clone()
sparkle_env.MergeFlags(sparkle_flags)
conf = Configure(sparkle_env, custom_tests = { "CheckObjCHeader" : checkObjCHeader })
if conf.CheckObjCHeader("Sparkle/Sparkle.h") :
env["HAVE_SPARKLE"] = 1
env["SPARKLE_FLAGS"] = sparkle_flags
env["SPARKLE_FRAMEWORK"] = "/Library/Frameworks/Sparkle.framework"
conf.Finish()
# Growl
env["HAVE_GROWL"] = 0
if env["PLATFORM"] == "darwin" :
growl_flags = {
"FRAMEWORKPATH": ["/Library/Frameworks"],
"FRAMEWORKS": ["Growl"]
}
growl_env = conf_env.Clone()
growl_env.MergeFlags(growl_flags)
conf = Configure(growl_env, custom_tests = { "CheckObjCHeader" : checkObjCHeader })
if conf.CheckObjCHeader("Growl/Growl.h") :
env["HAVE_GROWL"] = 1
env["GROWL_FLAGS"] = growl_flags
env["GROWL_FRAMEWORK"] = "/Library/Frameworks/Growl.framework"
conf.Finish()
# Snarl
if env["PLATFORM"] == "win32" :
env["HAVE_SNARL"] = True
# LibXML
conf = Configure(conf_env, custom_tests = {"CheckVersion": CheckVersion})
-if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
+if env.get("try_libxml", True) and conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
#and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623) :
env["HAVE_LIBXML"] = 1
env["LIBXML_FLAGS"] = { "LIBS": ["xml2"] }
conf.Finish()
-if not env.get("HAVE_LIBXML", 0) :
+if env.get("try_libxml", True) and not env.get("HAVE_LIBXML", 0) :
libxml_env = conf_env.Clone()
libxml_env.Append(CPPPATH = ["/usr/include/libxml2"])
conf = Configure(libxml_env, custom_tests = {"CheckVersion": CheckVersion})
if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
# and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623):
env["HAVE_LIBXML"] = 1
env["LIBXML_FLAGS"] = { "CPPPATH": ["/usr/include/libxml2"], "LIBS": ["xml2"] }
conf.Finish()
# Expat
-if not env.get("HAVE_LIBXML",0) :
+if env.get("try_expat", True) and not env.get("HAVE_LIBXML",0) :
expat_conf_env = conf_env.Clone()
expat_flags = {}
if env.get("expat_libdir", None) :
expat_flags["LIBPATH"] = [env["expat_libdir"]]
if env.get("expat_includedir", None) :
expat_flags["CPPPATH"] = [env["expat_includedir"]]
expat_conf_env.MergeFlags(expat_flags)
conf = Configure(expat_conf_env)
if conf.CheckCHeader("expat.h") and conf.CheckLib(env["expat_libname"]) :
env["HAVE_EXPAT"] = 1
env["EXPAT_FLAGS"] = { "LIBS": [env["expat_libname"]] }
env["EXPAT_FLAGS"].update(expat_flags)
conf.Finish()
# Bundled expat
bundledExpat = False
if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) :
print "Expat or LibXML not found. Using bundled Expat"
SConscript("#/3rdParty/Expat/SConscript")
env["HAVE_EXPAT"] = 1
env["EXPAT_BUNDLED"] = True
################################################################################
# IDN library
################################################################################
# ICU
icu_env = conf_env.Clone()
use_icu = bool(env["icu"])
-icu_prefix = env["icu"] if isinstance(env["icu"], str) else ""
+icu_prefix = ""
+if isinstance(env["icu"], str) :
+ icu_prefix = env["icu"]
icu_flags = {}
if icu_prefix :
icu_flags = { "CPPPATH": [os.path.join(icu_prefix, "include")] }
icu_flags["LIBPATH"] = [os.path.join(icu_prefix, "lib")]
icu_env.MergeFlags(icu_flags)
icu_conf = Configure(icu_env)
if use_icu and icu_conf.CheckCHeader("unicode/usprep.h") :
env["HAVE_ICU"] = 1
env["ICU_FLAGS"] = icu_flags
env["ICU_FLAGS"]["LIBS"] = ["icuuc"]
icu_conf.Finish()
# LibIDN
libidn_conf_env = conf_env.Clone()
libidn_flags = {}
if env.get("libidn_libdir", None) :
libidn_flags["LIBPATH"] = [env["libidn_libdir"]]
if env.get("libidn_includedir", None) :
libidn_flags["CPPPATH"] = [env["libidn_includedir"]]
libidn_conf_env.MergeFlags(libidn_flags)
conf = Configure(libidn_conf_env)
-if not env.get("HAVE_ICU") and conf.CheckCHeader("idna.h") and conf.CheckLib(env["libidn_libname"]) :
+if env.get("try_libidn", True) and not env.get("HAVE_ICU") and conf.CheckCHeader("idna.h") and conf.CheckLib(env["libidn_libname"]) :
env["HAVE_LIBIDN"] = 1
env["LIBIDN_FLAGS"] = { "LIBS": [env["libidn_libname"]] }
env["LIBIDN_FLAGS"].update(libidn_flags)
conf.Finish()
# Fallback to bundled LibIDN
if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) :
- env["HAVE_LIBIDN"] = 1
- env["LIBIDN_BUNDLED"] = 1
+ if env.get("libidn_bundled_enable", True) :
+ env["HAVE_LIBIDN"] = 1
+ env["LIBIDN_BUNDLED"] = 1
+ else :
+ print "Error: ICU and LIBIDN not found, and libidn_bundled_enable is false"
+ Exit(1)
# Unbound
if env["unbound"] :
env["LDNS_BUNDLED"] = 1
env["UNBOUND_BUNDLED"] = 1
else :
env["LDNS_FLAGS"] = {}
env["UNBOUND_FLAGS"] = {}
# LibMiniUPnPc
if env["experimental_ft"] :
libminiupnpc_flags = {"CPPPATH": ["/usr/include/miniupnpc/"]}
libminiupnpc_conf_env = conf_env.Clone()
if env.get("libminiupnpc_libdir", None) :
libminiupnpc_flags["LIBPATH"] = [env["libminiupnpc_libdir"]]
if env.get("libminiupnpc_includedir", None) :
libminiupnpc_flags["CPPPATH"] = [env["libminiupnpc_includedir"]]
libminiupnpc_conf_env.MergeFlags(libminiupnpc_flags)
conf = Configure(libminiupnpc_conf_env)
if conf.CheckCHeader("miniupnpc.h") and conf.CheckLib(env["libminiupnpc_libname"]) and False :
# ^ False because APIs aren't stable
env["HAVE_LIBMINIUPNPC"] = 1
env["LIBMINIUPNPC_FLAGS"] = { "LIBS": ["miniupnpc"] }
env["LIBMINIUPNPC_FLAGS"].update(libminiupnpc_flags)
else :
env["LIBMINIUPNPC_BUNDLED"] = 1
conf.Finish()
else :
env["LIBMINIUPNPC_FLAGS"] = {}
# LibNATPMP
if env["experimental_ft"] :
libnatpmp_flags = {}
libnatpmp_conf_env = conf_env.Clone()
if env.get("libnatpmp_libdir", None) :
@@ -427,184 +456,197 @@ if not env.get("lua_force_bundled", False) and conf.CheckLibWithHeader(env["lua_
env["LUA_FLAGS"] = { "LIBS": [env["lua_libname"]] }
lua_version = GetVersion(conf, "LUA_VERSION_NUM", "lua.h")
if lua_version > 0 :
env["LUA_FLAGS"]["LUA_VERSION"] = str(lua_version // 100) + "." + str(lua_version % 100)
else :
print "Warning: Unable to determine Lua version. Not installing Lua libraries."
env["LUA_FLAGS"].update(lua_flags)
else :
env["LUA_BUNDLED"] = 1
conf.Finish()
# Readline
editline_conf_env = conf_env.Clone()
editline_flags = {}
if env.get("editline_libdir", None) :
editline_flags["LIBPATH"] = [env["editline_libdir"]]
if env.get("editline_includedir", None) :
editline_flags["CPPPATH"] = [env["editline_includedir"]]
editline_conf_env.MergeFlags(editline_flags)
conf = Configure(editline_conf_env)
if conf.CheckLibWithHeader(env["editline_libname"], ["stdio.h", "editline/readline.h"], "c") :
env["HAVE_EDITLINE"] = 1
env["EDITLINE_FLAGS"] = { "LIBS": [env["editline_libname"]] }
env["EDITLINE_FLAGS"].update(editline_flags)
conf.Finish()
# Avahi
avahi_conf_env = conf_env.Clone()
avahi_flags = {}
if env.get("avahi_libdir", None) :
avahi_flags["LIBPATH"] = [env["avahi_libdir"]]
if env.get("avahi_includedir", None) :
avahi_flags["CPPPATH"] = [env["avahi_includedir"]]
avahi_conf_env.MergeFlags(avahi_flags)
conf = Configure(avahi_conf_env)
-if conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
+if env.get("try_avahi", True) and conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
env["HAVE_AVAHI"] = True
env["AVAHI_FLAGS"] = { "LIBS": ["avahi-client", "avahi-common"] }
env["AVAHI_FLAGS"].update(avahi_flags)
conf.Finish()
# Qt
if env["qt"] :
env["QTDIR"] = env["qt"]
# OpenSSL
openssl_env = conf_env.Clone()
if env.get("openssl_force_bundled", False) or env["target"] in ("iphone-device", "iphone-simulator", "xcode", "android") :
env["OPENSSL_BUNDLED"] = True
env["HAVE_OPENSSL"] = True
else :
use_openssl = bool(env["openssl"])
- openssl_prefix = env["openssl"] if isinstance(env["openssl"], str) else ""
+ openssl_prefix = ""
+ if isinstance(env["openssl"], str) :
+ openssl_prefix = env["openssl"]
openssl_flags = {}
if openssl_prefix :
- openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
- if env["PLATFORM"] == "win32" :
+ openssl_include = env.get("openssl_include", None)
+ openssl_libdir = env.get("openssl_libdir", None)
+ if openssl_include:
+ openssl_flags = {"CPPPATH":[openssl_include]}
+ else:
+ openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
+ if openssl_libdir:
+ openssl_flags["LIBPATH"] = [openssl_libdir]
+ env["OPENSSL_DIR"] = openssl_prefix
+ elif env["PLATFORM"] == "win32" :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib", "VC")]
env["OPENSSL_DIR"] = openssl_prefix
else :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib")]
openssl_env.MergeFlags(openssl_flags)
openssl_conf = Configure(openssl_env)
if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") :
env["HAVE_OPENSSL"] = 1
env["OPENSSL_FLAGS"] = openssl_flags
- if env["PLATFORM"] == "win32" :
+ openssl_libnames = env.get("openssl_libnames", None)
+ if openssl_libnames:
+ env["OPENSSL_FLAGS"]["LIBS"] = openssl_libnames.split(',')
+ elif env["PLATFORM"] == "win32" :
env["OPENSSL_FLAGS"]["LIBS"] = ["libeay32MD", "ssleay32MD"]
else:
env["OPENSSL_FLAGS"]["LIBS"] = ["ssl", "crypto"]
if env["PLATFORM"] == "darwin" :
if platform.mac_ver()[0].startswith("10.5") :
env["OPENSSL_FLAGS"]["FRAMEWORKS"] = ["Security"]
else :
env["OPENSSL_FLAGS"] = {}
- if env["PLATFORM"] == "win32" :
+ if env["PLATFORM"] == "win32" :
env["HAVE_SCHANNEL"] = True
# If we're compiling for Windows and OpenSSL isn't being used, use Schannel
env.Append(LIBS = ["secur32"])
openssl_conf.Finish()
#Hunspell
hunspell_env = conf_env.Clone()
hunspell_prefix = env["hunspell"] if isinstance(env.get("hunspell", False), str) else ""
hunspell_flags = {}
if hunspell_prefix :
hunspell_flags = {"CPPPATH":[os.path.join(hunspell_prefix, "include")], "LIBPATH":[os.path.join(hunspell_prefix, "lib")]}
hunspell_env.MergeFlags(hunspell_flags)
env["HAVE_HUNSPELL"] = 0;
hunspell_conf = Configure(hunspell_env)
if hunspell_conf.CheckCXXHeader("hunspell/hunspell.hxx") and hunspell_conf.CheckLib("hunspell") :
env["HAVE_HUNSPELL"] = 1
hunspell_flags["LIBS"] = ["hunspell"]
env["HUNSPELL_FLAGS"] = hunspell_flags
hunspell_conf.Finish()
# Bonjour
if env["PLATFORM"] == "darwin" and env["target"] == "native" :
env["HAVE_BONJOUR"] = 1
elif env.get("bonjour", False) :
bonjour_env = conf_env.Clone()
bonjour_conf = Configure(bonjour_env)
bonjour_flags = {}
- if env.get("bonjour") != True :
+ if env.get("bonjour") != True :
bonjour_prefix = env["bonjour"]
bonjour_flags["CPPPATH"] = [os.path.join(bonjour_prefix, "include")]
bonjour_flags["LIBPATH"] = [os.path.join(bonjour_prefix, "lib", "win32")]
bonjour_env.MergeFlags(bonjour_flags)
if bonjour_conf.CheckCHeader("dns_sd.h") and bonjour_conf.CheckLib("dnssd") :
env["HAVE_BONJOUR"] = 1
env["BONJOUR_FLAGS"] = bonjour_flags
env["BONJOUR_FLAGS"]["LIBS"] = ["dnssd"]
bonjour_conf.Finish()
# Cocoa & IOKit
if env["PLATFORM"] == "darwin" :
cocoa_conf = Configure(conf_env)
if cocoa_conf.CheckCHeader("IOKit/IOKitLib.h") :
env["HAVE_IOKIT"] = True
cocoa_conf.Finish()
# Qt
try :
myenv = env.Clone()
myenv.Tool("qt4", toolpath = ["#/BuildTools/SCons/Tools"])
env["HAVE_QT"] = True
except :
env["HAVE_QT"] = False
################################################################################
# DocBook setup
################################################################################
if env.get("docbook_xml") :
env["DOCBOOK_XML_DIR"] = env["docbook_xml"]
if env.get("docbook_xsl") :
env["DOCBOOK_XSL_DIR"] = env["docbook_xsl"]
################################################################################
# Set up git hooks
################################################################################
try:
if env.Dir("#/.git").exists() :
- if not env.GetOption("clean") :
+ if not env.GetOption("clean") and env.get("install_git_hooks", True) :
env.Install("#/.git/hooks", Glob("#/BuildTools/Git/Hooks/*"))
except TypeError:
print "You seem to be using Swift in a Git submodule. Not installing hooks."
################################################################################
# Replace #pragma once with proper guards on platforms that require it
################################################################################
if ARGUMENTS.get("replace_pragma_once", False) :
env.Tool("ReplacePragmaOnce", toolpath = ["#/BuildTools/SCons/Tools"])
def relpath(path, start) :
i = len(os.path.commonprefix([path, start]))
return path[i+1:]
for actual_root, dirs, files in os.walk(root) :
if "3rdParty" in actual_root :
continue
for file in files :
if not file.endswith(".h") :
continue
include = relpath(os.path.join(actual_root, file), root)
env.ReplacePragmaOnce("#/include/" + include, "#/" + include)
env.Append(CPPPATH = ["#/include"])
else :
env.Append(CPPPATH = [root])
################################################################################
# Project files
################################################################################
if ARGUMENTS.get("dump_trace", False) :
env.SetOption("no_exec", True)
@@ -634,38 +676,38 @@ for dir in os.listdir(Dir("#").abspath) :
# QA comes last
modules.remove("QA")
modules.append("QA")
# Flags
env["PROJECTS"] = [m for m in modules if m not in ["Documentation", "QA", "SwifTools"] and not m.startswith("3rdParty")]
for stage in ["flags", "build"] :
env["SCONS_STAGE"] = stage
SConscript(dirs = map(lambda x : root + "/" + x, modules))
# SLOCCount
if ARGUMENTS.get("sloccount", False) :
for project in env["PROJECTS"] :
env.SLOCCount("#/" + project)
################################################################################
# Print summary
################################################################################
print
print " Build Configuration"
print " -------------------"
parsers = []
if env.get("HAVE_LIBXML", 0):
parsers.append("LibXML")
if env.get("HAVE_EXPAT", 0):
parsers.append("Expat")
if env.get("EXPAT_BUNDLED", False) :
parsers.append("(Bundled)")
print " Projects: " + ' '.join(env["PROJECTS"])
print ""
print " XML Parsers: " + ' '.join(parsers)
-print " TLS Support: " + ("OpenSSL" if env.get("HAVE_OPENSSL",0) else ("Schannel" if env.get("HAVE_SCHANNEL", 0) else "Disabled"))
-print " DNSSD Support: " + ("Bonjour" if env.get("HAVE_BONJOUR") else ("Avahi" if env.get("HAVE_AVAHI") else "Disabled"))
+print " TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled")
+print " DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled"))
print
diff --git a/BuildTools/SCons/Tools/Test.py b/BuildTools/SCons/Tools/Test.py
index 95fcce9..7e4609d 100644
--- a/BuildTools/SCons/Tools/Test.py
+++ b/BuildTools/SCons/Tools/Test.py
@@ -1,50 +1,53 @@
import SCons.Util, os
def generate(env) :
def registerTest(env, target, type = "unit", is_checker = False) :
if env["TEST_TYPE"] == "all" or env["TEST_TYPE"] == type :
- cmd = target[0].abspath if SCons.Util.is_List(target) else target.abspath
+ if SCons.Util.is_List(target) :
+ cmd = target[0].abspath
+ else :
+ cmd = target.abspath
params = ""
# Special support for unittest checker
if is_checker and env.get("checker_report", False) :
params = " --xml > " + os.path.join(target[0].dir.path, "checker-report.xml")
-
+
ignore_prefix = ""
if env.get("TEST_IGNORE_RESULT", False) :
ignore_prefix = "-"
# Set environment variables for running the test
test_env = env.Clone()
for i in ["HOME", "USERPROFILE", "APPDATA"]:
if os.environ.get(i, "") :
test_env["ENV"][i] = os.environ[i]
if env["target"] == "android" :
test_env["ENV"]["PATH"] = env["android_sdk_bin"] + ";" + test_env["ENV"]["PATH"]
else :
if test_env["PLATFORM"] == "darwin" :
test_env["ENV"]["DYLD_FALLBACK_LIBRARY_PATH"] = ":".join(map(lambda x : str(x), test_env.get("LIBPATH", [])))
elif test_env["PLATFORM"] == "win32" :
test_env["ENV"]["PATH"] = ";".join(map(lambda x : str(x), test_env.get("LIBRUNPATH", []))) + ";" + test_env["ENV"]["PATH"]
# Run the test
if env["target"] == "android":
exec_name = os.path.basename(cmd)
test_env.Command("**dummy**", target, SCons.Action.Action(
["adb shell mount -o rw,remount /system",
- "adb push " + cmd + " /system/bin/" + exec_name,
+ "adb push " + cmd + " /system/bin/" + exec_name,
"adb shell SWIFT_CLIENTTEST_JID=\"" + os.getenv("SWIFT_CLIENTTEST_JID") + "\" SWIFT_CLIENTTEST_PASS=\"" + os.getenv("SWIFT_CLIENTTEST_PASS") + "\" " + env.get("TEST_RUNNER", "") + "/system/bin/" + exec_name], cmdstr = "$TESTCOMSTR"))
else :
- test_env.Command("**dummy**", target,
+ test_env.Command("**dummy**", target,
SCons.Action.Action(ignore_prefix + env.get("TEST_RUNNER", "") + cmd + " " + params, cmdstr = "$TESTCOMSTR"))
def registerScriptTests(env, scripts, name, type) :
if env["TEST_TYPE"] == "all" or env["TEST_TYPE"] == type :
pass
env.AddMethod(registerTest, "Test")
env.AddMethod(registerScriptTests, "ScriptTests")
def exists(env) :
return True
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py
index f98a8b9..2f3b5a5 100644
--- a/BuildTools/SCons/Version.py
+++ b/BuildTools/SCons/Version.py
@@ -1,67 +1,68 @@
import subprocess, os, datetime, re, os.path
def getGitBuildVersion(root, project) :
tag = git("describe --tags --exact --match \"" + project + "-*\"", root)
if tag :
return tag.rstrip()[len(project)+1:]
tag = git("describe --tags --match \"" + project + "-*\"", root)
if tag :
m = re.match(project + "-(.*)-(.*)-(.*)", tag)
if m :
return m.group(1) + "-dev" + m.group(2)
return None
-
+
def git(cmd, root) :
full_cmd = "git " + cmd
p = subprocess.Popen(full_cmd, cwd=root, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt"))
gitVersion = p.stdout.read()
# error = p.stderr.read()
# if error:
# print "Git error: " + error
p.stdin.close()
- return gitVersion if p.wait() == 0 else None
+ if p.wait() == 0 :
+ return gitVersion
+ return None
def getBuildVersion(root, project) :
versionFilename = os.path.join(root, "VERSION." + project)
if os.path.isfile(versionFilename) :
f = open(versionFilename)
version = f.read().strip()
f.close()
return version
- gitVersion = getGitBuildVersion(root, project)
+ gitVersion = getGitBuildVersion(root, project)
if gitVersion :
return gitVersion
return datetime.date.today().strftime("%Y%m%d")
def convertToWindowsVersion(version) :
version_match = re.match("(\d+)\.(\d+)(.*)", version)
major = int(version_match.group(1)) if version_match else 0
minor = int(version_match.group(2)) if version_match else 0
if version_match and len(version_match.group(3)) == 0 :
patch = 60000
else :
match = re.match("^beta(\d+)(.*)", version_match.group(3))
build_string = ""
if match :
patch = 1000*int(match.group(1))
build_string = match.group(2)
else :
rc_match = re.match("^rc(\d+)(.*)", version_match.group(3))
if rc_match :
patch = 10000*int(rc_match.group(1))
build_string = rc_match.group(2)
else :
patch = 0
alpha_match = re.match("^alpha(.*)", version_match.group(3))
if alpha_match :
build_string = alpha_match.group(1)
if len(build_string) > 0 :
- build_match = re.match("^-dev(\d+)", build_string)
+ build_match = re.match("^-dev(\d+)", build_string)
if build_match :
patch += int(build_match.group(1))
return (major, minor, patch)
-
diff --git a/COPYING.thirdparty b/COPYING.thirdparty
index a4b505c..c2c01f7 100644
--- a/COPYING.thirdparty
+++ b/COPYING.thirdparty
@@ -96,70 +96,103 @@ These projects contain some code contributed under the BSD License, under the fo
Copyright (c) 2011, Arnt Gulbrandsen
Copyright (c) 2011, Thilo Cestonaro
Copyright (c) 2011, Vlad Voicu
Copyright (c) 2011, Jan Kaluza
Copyright (c) 2011, Tobias Markmann
Copyright (c) 2011, Soren Dreijer
Copyright (c) 2012, Vitaly Takmazov
Copyright (c) 2012, Pavol Babincak
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of their organizations nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- END OF BSD LICENSE
--- START OF SIMPLIFIED BSD LICENSE
Copyright (c) 2012 Isode Limited, London, England.
Copyright (c) 2012 Yoann Blein.
Copyright (c) 2012 Mateusz Piekos.
Copyright (c) 2012 Catalin Badea.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WA RRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- END OF SIMPLIFIED BSD LICENSE
+Solaris builds compile Swiften/Network/SolarisNetworkEnvironment.cpp
+which incorporates getifaddrs() code under the following license:
+
+--- START OF SOLARIS getifaddrs() LICENSE
+
+Copyright (c) 2006 WIDE Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+--- END OF SOLARIS getifaddrs() LICENSE
+
===============
Google Breakpad
===============
Copyright (c) 2006, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -371,71 +404,71 @@ be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
index 24ebd60..5d27b70 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
@@ -1,32 +1,36 @@
Import("env")
example_env = env.Clone()
example_env.UseFlags(example_env["SWIFTEN_FLAGS"])
example_env.UseFlags(example_env["SWIFTEN_DEP_FLAGS"])
# Precompile Swiften header
# This is useful to slightly speed up compilation.
# if example_env["PLATFORM"] == "win32":
# example_env.WriteVal("Swiften.cpp", example_env.Value("#include <Swiften/Swiften.h>\n"))
# example_env["PCH"] = example_env.PCH("Swiften.cpp")[0]
# example_env["PCHSTOP"] = "Swiften/Swiften.h"
for i in range(1,7) :
example_env.Program("EchoBot" + str(i), ["EchoBot" + str(i) + ".cpp"])
example_env.Program("EchoComponent", "EchoComponent.cpp")
# C++0x
cpp0x = False
cpp0x_env = example_env.Clone()
if env["PLATFORM"] == "win32" :
if int(env["MSVS_VERSION"].split(".")[0]) >= 10 :
cpp0x = True
+elif env["PLATFORM"] == "hpux" :
+ pass
+elif env["PLATFORM"] == "sunos" :
+ pass
else :
if env["CCVERSION"].split(".") >= ["4", "5", "0"] :
# Temporarily disabling c++0x mode because of problems with boost::thread
# on some platforms
#cpp0x = True
cpp0x_env.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if flag != "-Werror"])
cpp0x_env.Append(CXXFLAGS = ["-std=c++0x"])
if cpp0x :
cpp0x_env.Program("EchoBot0x", "EchoBot0x.cpp")
diff --git a/Documentation/SwiftenDevelopersGuide/SConscript b/Documentation/SwiftenDevelopersGuide/SConscript
index c50641f..ba0eb0b 100644
--- a/Documentation/SwiftenDevelopersGuide/SConscript
+++ b/Documentation/SwiftenDevelopersGuide/SConscript
@@ -2,73 +2,75 @@ Import("env")
env.Tool("DocBook", toolpath = ["#/BuildTools/DocBook/SCons"])
################################################################################
# Code generation helper
################################################################################
import sys, re, os.path
def generateDocBookCode(env, target, source) :
# Strips empty lines from the beginning & end of a program
def stripEmptyLines(program) :
programLines = program.split('\n')
newProgramLines = []
inProgram = False
for line in programLines :
if not re.match("^\s*$", line) or inProgram :
inProgram = True
newProgramLines.append(line)
return '\n'.join(newProgramLines).rstrip()
def createCallouts(program, calloutPrefix) :
newProgramLines = []
calloutLines = []
nextID = 0
for line in program.split("\n") :
# FIXME: Takes the largest match
m = re.match(".*\/* \(\*\) (.*) \*/.*", line)
if m :
cobID = "cob-" + calloutPrefix + "-" + str(nextID)
coID = "co-" + calloutPrefix + "-" + str(nextID)
nextID += 1
line = re.sub("/\*.*\*/", "]]><co id=\"%(cobID)s\" linkends=\"%(coID)s\"/><![CDATA[" % {"cobID" : cobID, "coID" : coID}, line)
calloutLines.append("<callout arearefs=\"%(cobID)s\" id=\"%(coID)s\"><para>%(text)s</para></callout>" % {"cobID": cobID, "coID": coID, "text": m.group(1)})
newProgramLines.append(line)
- callouts = "<calloutlist>" + "\n".join(calloutLines) + "</calloutlist>" if len(calloutLines) > 0 else ""
+ callouts = ""
+ if len(calloutLines) > 0 :
+ callouts = "<calloutlist>" + "\n".join(calloutLines) + "</calloutlist>"
return ("\n".join(newProgramLines), callouts)
-
+
# Parse program
filename = source[0].abspath
filenameBase = os.path.basename(filename).replace(".cpp", "")
inputfile = open(filename)
program = ""
programs = {}
programName = ""
inEllipsis = False
for line in inputfile.readlines() :
if inEllipsis :
if "//..." in line :
inEllipsis = False
else :
if line.startswith("/*") or line.startswith(" *") :
continue
if "//..." in line :
inEllipsis = True
line = line.replace("//...", "]]>&#x2026;<![CDATA[")
else :
m = re.match("^/// (.*)", line)
if m :
if programName :
programs[programName] = program
program = ""
programName = m.group(1).strip().replace(" ", "")
continue
line = re.sub("\t", " ", line)
program += line
programs[programName] = program
inputfile.close()
for programName, program in programs.items() :
program = stripEmptyLines(program)
(program, callouts) = createCallouts(program, filenameBase + "-" + programName)
diff --git a/QA/Checker/SConscript b/QA/Checker/SConscript
index d180af2..b0863da 100644
--- a/QA/Checker/SConscript
+++ b/QA/Checker/SConscript
@@ -1,17 +1,17 @@
Import("env")
if env["TEST"] :
if env["SCONS_STAGE"] == "flags" :
- env["CHECKER_FLAGS"] = {
+ env["CHECKER_FLAGS"] = {
"CPPPATH" : ["#/3rdParty/HippoMocks"],
"LIBS": ["Checker"],
"LIBPATH": [Dir(".")],
- "LINKFLAGS": ["/SUBSYSTEM:CONSOLE"] if env["PLATFORM"] == "win32" else []
+ "LINKFLAGS": env["PLATFORM"] == "win32" and ["/SUBSYSTEM:CONSOLE"] or []
}
if env["SCONS_STAGE"] == "build" :
checker_env = env.Clone()
checker_env.UseFlags(env["SWIFTEN_FLAGS"])
checker_env.UseFlags(env["BOOST_FLAGS"])
checker_env.UseFlags(env["CPPUNIT_FLAGS"])
checker_env.Library("Checker", ["checker.cpp", "IO.cpp"])
diff --git a/Slimber/SConscript b/Slimber/SConscript
index 2298b0a..ff4f57d 100644
--- a/Slimber/SConscript
+++ b/Slimber/SConscript
@@ -1,60 +1,64 @@
-import datetime
+import datetime
Import("env")
env["BUILD_SLIMBER"] = True
if env["PLATFORM"] == "win32" :
if not env.get("HAVE_BONJOUR") and "Slimber" in env["PROJECTS"] :
env["PROJECTS"].remove("Slimber")
elif env["PLATFORM"] != "darwin" :
if not env.get("HAVE_AVAHI", False) and "Slimber" in env["PROJECTS"] :
env["PROJECTS"].remove("Slimber")
if not "Slimber" in env["PROJECTS"] and env["SCONS_STAGE"] == "flags" :
print "Bonjour missing. Not building Slimber."
+if not env.get("HAVE_QT", False) and "Slimber" in env["PROJECTS"] :
+ print "Qt missing. Not building Slimber."
+ env["PROJECTS"].remove("Slimber")
+
if "Slimber" in env["PROJECTS"] :
################################################################################
# Flags
################################################################################
if env["SCONS_STAGE"] == "flags" :
env["SLIMBER_FLAGS"] = {
"LIBPATH": [Dir(".")],
"LIBS": ["Slimber"]
}
################################################################################
# Build
################################################################################
if env["SCONS_STAGE"] == "build" :
myenv = env.Clone()
myenv.UseFlags(env["LIMBER_FLAGS"])
myenv.MergeFlags(env["BOOST_FLAGS"])
myenv.MergeFlags(env["SWIFTEN_FLAGS"])
myenv.MergeFlags(env["SWIFTEN_DEP_FLAGS"])
myenv.StaticLibrary("Slimber", [
"LinkLocalPresenceManager.cpp",
"FileVCardCollection.cpp",
"VCardCollection.cpp",
"Server.cpp",
"MainController.cpp",
"MenuletController.cpp",
"Menulet.cpp"
])
-
+
env["SLIMBER_VERSION"] = "0.9.9." + datetime.date.today().strftime("%Y%m%d")
env.Append(UNITTEST_SOURCES = [
File("UnitTest/LinkLocalPresenceManagerTest.cpp"),
File("UnitTest/MenuletControllerTest.cpp")
])
SConscript("CLI/SConscript")
if env["PLATFORM"] == "darwin" :
SConscript("Cocoa/SConscript")
else :
SConscript("Qt/SConscript")
diff --git a/SwifTools/Application/UnixApplicationPathProvider.cpp b/SwifTools/Application/UnixApplicationPathProvider.cpp
index 784256f..6af9b24 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.cpp
+++ b/SwifTools/Application/UnixApplicationPathProvider.cpp
@@ -1,60 +1,61 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <SwifTools/Application/UnixApplicationPathProvider.h>
+#include <stdlib.h>
#include <unistd.h>
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <Swiften/Base/String.h>
#include <Swiften/Base/foreach.h>
namespace Swift {
UnixApplicationPathProvider::UnixApplicationPathProvider(const std::string& name) : ApplicationPathProvider(name) {
resourceDirs.push_back(getExecutableDir() / "../resources"); // Development
resourceDirs.push_back(getExecutableDir() / ".." / "share" / boost::to_lower_copy(getApplicationName())); // Local install
char* xdgDataDirs = getenv("XDG_DATA_DIRS");
if (xdgDataDirs) {
std::vector<std::string> dataDirs = String::split(xdgDataDirs, ':');
if (!dataDirs.empty()) {
foreach(const std::string& dir, dataDirs) {
resourceDirs.push_back(boost::filesystem::path(dir) / "swift");
}
return;
}
}
resourceDirs.push_back("/usr/local/share/" + boost::to_lower_copy(getApplicationName()));
resourceDirs.push_back("/usr/share/" + boost::to_lower_copy(getApplicationName()));
}
boost::filesystem::path UnixApplicationPathProvider::getHomeDir() const {
char* home = getenv("HOME");
return home ? boost::filesystem::path(home) : boost::filesystem::path();
}
boost::filesystem::path UnixApplicationPathProvider::getDataDir() const {
char* xdgDataHome = getenv("XDG_DATA_HOME");
std::string dataDir;
if (xdgDataHome) {
dataDir = std::string(xdgDataHome);
}
- boost::filesystem::path dataPath = (dataDir.empty() ?
- getHomeDir() / ".local" / "share"
+ boost::filesystem::path dataPath = (dataDir.empty() ?
+ getHomeDir() / ".local" / "share"
: boost::filesystem::path(dataDir)) / boost::to_lower_copy(getApplicationName());
try {
boost::filesystem::create_directories(dataPath);
}
catch (const boost::filesystem::filesystem_error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
}
return dataPath;
}
}
diff --git a/Swiften/Client/XMLBeautifier.h b/Swiften/Client/XMLBeautifier.h
index 44dfd20..25ecd18 100644
--- a/Swiften/Client/XMLBeautifier.h
+++ b/Swiften/Client/XMLBeautifier.h
@@ -1,43 +1,50 @@
/*
* Copyright (c) 2011 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+* Copyright (c) 2014 Remko Tronçon and Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
#pragma once
+#include <sstream>
#include <string>
#include <stack>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Parser/XMLParserFactory.h>
#include <Swiften/Parser/XMLParserClient.h>
#include <Swiften/Parser/XMLParser.h>
namespace Swift {
class XMLBeautifier : public XMLParserClient {
public:
XMLBeautifier(bool indention, bool coloring);
virtual ~XMLBeautifier();
std::string beautify(const std::string&);
private:
void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes);
void handleEndElement(const std::string& element, const std::string& ns);
void handleCharacterData(const std::string& data);
private:
void indent();
private:
std::string styleTag(const std::string& text) const;
std::string styleNamespace(const std::string& text) const;
std::string styleAttribute(const std::string& text) const;
std::string styleValue(const std::string& text) const;
private:
bool doIndention;
bool doColoring;
diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h
index 587ba22..79ade49 100644
--- a/Swiften/EventLoop/EventLoop.h
+++ b/Swiften/EventLoop/EventLoop.h
@@ -1,44 +1,44 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <boost/function.hpp>
-#include <boost/thread/mutex.hpp>
+#include <boost/thread.hpp>
#include <list>
#include <deque>
#include <Swiften/Base/API.h>
#include <Swiften/EventLoop/Event.h>
namespace Swift {
class EventOwner;
class SWIFTEN_API EventLoop {
public:
EventLoop();
virtual ~EventLoop();
-
+
void postEvent(boost::function<void ()> event, boost::shared_ptr<EventOwner> owner = boost::shared_ptr<EventOwner>());
void removeEventsFromOwner(boost::shared_ptr<EventOwner> owner);
protected:
/**
* Reimplement this to call handleEvent(event) from the thread in which
* the event loop is residing.
*/
virtual void post(const Event& event) = 0;
-
+
void handleEvent(const Event& event);
private:
boost::mutex eventsMutex_;
unsigned int nextEventID_;
std::list<Event> events_;
bool handlingEvents_;
std::deque<Event> eventsToHandle_;
};
}
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index 1bec5f7..45628e2 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -1,58 +1,60 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
-#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h>
-#include <Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/thread.hpp>
+
#include <Swiften/Base/ByteArray.h>
#include <Swiften/EventLoop/EventLoop.h>
-#include <boost/numeric/conversion/cast.hpp>
+#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h>
+#include <Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h>
namespace Swift {
class BonjourQuerier;
class BonjourRegisterQuery : public DNSSDRegisterQuery, public BonjourQuery {
- public:
+ public:
BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) {
DNSServiceErrorType result = DNSServiceRegister(
- &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast<unsigned short>(port),
- boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord),
+ &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast<unsigned short>(port),
+ boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord),
&BonjourRegisterQuery::handleServiceRegisteredStatic, this);
if (result != kDNSServiceErr_NoError) {
sdRef = NULL;
}
}
void registerService() {
if (sdRef) {
run();
}
else {
eventLoop->postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this());
}
}
void unregisterService() {
finish();
}
void updateServiceInfo(const ByteArray& txtRecord) {
boost::lock_guard<boost::mutex> lock(sdRefMutex);
DNSServiceUpdateRecord(sdRef, NULL, 0, boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord), 0);
}
private:
static void handleServiceRegisteredStatic(DNSServiceRef, DNSServiceFlags, DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain, void *context) {
static_cast<BonjourRegisterQuery*>(context)->handleServiceRegistered(errorCode, name, regtype, domain);
}
void handleServiceRegistered(DNSServiceErrorType errorCode, const char *name, const char *regtype, const char *domain) {
if (errorCode != kDNSServiceErr_NoError) {
eventLoop->postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<DNSSDServiceID>()), shared_from_this());
}
else {
eventLoop->postEvent(boost::bind(boost::ref(onRegisterFinished), boost::optional<DNSSDServiceID>(DNSSDServiceID(name, domain, regtype, 0))), shared_from_this());
diff --git a/Swiften/Network/PlatformNetworkEnvironment.h b/Swiften/Network/PlatformNetworkEnvironment.h
index c6b945e..2092bfd 100644
--- a/Swiften/Network/PlatformNetworkEnvironment.h
+++ b/Swiften/Network/PlatformNetworkEnvironment.h
@@ -1,26 +1,32 @@
/*
* Copyright (c) 2011 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#pragma once
#include <Swiften/Base/Platform.h>
#if defined(SWIFTEN_PLATFORM_MACOSX)
#include <Swiften/Network/UnixNetworkEnvironment.h>
namespace Swift {
typedef UnixNetworkEnvironment PlatformNetworkEnvironment;
}
#elif defined(SWIFTEN_PLATFORM_WIN32)
#include <Swiften/Network/WindowsNetworkEnvironment.h>
namespace Swift {
typedef WindowsNetworkEnvironment PlatformNetworkEnvironment;
}
+#elif defined(SWIFTEN_PLATFORM_SOLARIS)
+#include <Swiften/Network/SolarisNetworkEnvironment.h>
+namespace Swift {
+ typedef SolarisNetworkEnvironment PlatformNetworkEnvironment;
+}
+
#else
#include <Swiften/Network/UnixNetworkEnvironment.h>
namespace Swift {
typedef UnixNetworkEnvironment PlatformNetworkEnvironment;
}
#endif
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
index fcc66b4..284c1f4 100644
--- a/Swiften/Network/SConscript
+++ b/Swiften/Network/SConscript
@@ -38,69 +38,73 @@ sourceList = [
"HostAddress.cpp",
"HostAddressPort.cpp",
"HostNameOrAddress.cpp",
"NetworkFactories.cpp",
"BoostNetworkFactories.cpp",
"NetworkEnvironment.cpp",
"Timer.cpp",
"TLSConnection.cpp",
"TLSConnectionFactory.cpp",
"BoostTimer.cpp",
"ProxyProvider.cpp",
"NullProxyProvider.cpp",
"NATTraverser.cpp",
"NullNATTraverser.cpp",
"NATTraversalGetPublicIPRequest.cpp",
"NATTraversalForwardPortRequest.cpp",
"NATTraversalRemovePortForwardingRequest.cpp",
"NATTraversalInterface.cpp",
]
if myenv.get("unbound", False) :
myenv.Append(CPPDEFINES = "USE_UNBOUND")
sourceList.append("UnboundDomainNameResolver.cpp")
else :
sourceList.append("PlatformDomainNameResolver.cpp")
sourceList.append("PlatformDomainNameServiceQuery.cpp")
sourceList.append("PlatformDomainNameAddressQuery.cpp")
if myenv["PLATFORM"] == "darwin" and myenv["target"] != "android":
myenv.Append(FRAMEWORKS = ["CoreServices", "SystemConfiguration"])
sourceList += [ "MacOSXProxyProvider.cpp" ]
sourceList += [ "UnixNetworkEnvironment.cpp" ]
elif myenv["PLATFORM"] == "win32" :
sourceList += [ "WindowsProxyProvider.cpp" ]
sourceList += [ "WindowsNetworkEnvironment.cpp" ]
+elif myenv["PLATFORM"] == "sunos" :
+ sourceList += [ "UnixProxyProvider.cpp" ]
+ sourceList += [ "SolarisNetworkEnvironment.cpp" ]
+ sourceList += [ "EnvironmentProxyProvider.cpp" ]
else :
sourceList += [ "UnixNetworkEnvironment.cpp" ]
sourceList += [ "UnixProxyProvider.cpp" ]
sourceList += [ "EnvironmentProxyProvider.cpp" ]
if myenv.get("HAVE_GCONF", 0) :
myenv.Append(CPPDEFINES = "HAVE_GCONF")
myenv.MergeFlags(myenv["GCONF_FLAGS"])
sourceList += [ "GConfProxyProvider.cpp" ]
objects = myenv.SwiftenObject(sourceList)
-if myenv["experimental_ft"] :
+if myenv["experimental_ft"] :
# LibNATPMP classes
if myenv.get("HAVE_LIBNATPMP", False) :
- natpmp_env = myenv.Clone()
+ natpmp_env = myenv.Clone()
natpmp_env.Append(CPPDEFINES = natpmp_env["LIBNATPMP_FLAGS"].get("INTERNAL_CPPDEFINES", []))
myenv.Append(CPPDEFINES = ["HAVE_LIBNATPMP"])
objects += natpmp_env.SwiftenObject([
"NATPMPInterface.cpp",
])
# LibMINIUPnP classes
if myenv.get("HAVE_LIBMINIUPNPC", False) :
upnp_env = myenv.Clone()
upnp_env.Append(CPPDEFINES = upnp_env["LIBMINIUPNPC_FLAGS"].get("INTERNAL_CPPDEFINES", []))
myenv.Append(CPPDEFINES = ["HAVE_LIBMINIUPNPC"])
objects += upnp_env.SwiftenObject([
"MiniUPnPInterface.cpp",
])
objects += myenv.SwiftenObject([
"PlatformNATTraversalWorker.cpp",
])
swiften_env.Append(SWIFTEN_OBJECTS = [objects])
diff --git a/Swiften/Network/SolarisNetworkEnvironment.cpp b/Swiften/Network/SolarisNetworkEnvironment.cpp
new file mode 100644
index 0000000..93eec32
--- /dev/null
+++ b/Swiften/Network/SolarisNetworkEnvironment.cpp
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2011 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+* Copyright (c) 2013-2014 Remko Tronçon and Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
+#include <Swiften/Network/SolarisNetworkEnvironment.h>
+
+#include <string>
+#include <vector>
+#include <map>
+#include <boost/optional.hpp>
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <net/if.h>
+
+#include <Swiften/Base/boost_bsignals.h>
+#include <Swiften/Network/HostAddress.h>
+#include <Swiften/Network/NetworkInterface.h>
+
+/*
+ * Copyright (c) 2006 WIDE Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#undef ifa_broadaddr
+#undef ifa_dstaddr
+struct ifaddrs {
+ struct ifaddrs *ifa_next; /* Pointer to next struct */
+ char *ifa_name; /* Interface name */
+ uint64_t ifa_flags; /* Interface flags */
+ struct sockaddr *ifa_addr; /* Interface address */
+ struct sockaddr *ifa_netmask; /* Interface netmask */
+ struct sockaddr *ifa_dstaddr; /* P2P interface destination */
+};
+#define ifa_broadaddr ifa_dstaddr
+
+static int
+get_lifreq(int fd, struct lifreq **ifr_ret)
+{
+ struct lifnum lifn;
+ struct lifconf lifc;
+ struct lifreq *lifrp;
+
+ lifn.lifn_family = AF_UNSPEC;
+ lifn.lifn_flags = 0;
+ if (ioctl(fd, SIOCGLIFNUM, &lifn) == -1)
+ lifn.lifn_count = 16;
+ else
+ lifn.lifn_count += 16;
+
+ for (;;) {
+ lifc.lifc_len = lifn.lifn_count * sizeof (*lifrp);
+ lifrp = (struct lifreq *) malloc(lifc.lifc_len);
+ if (lifrp == NULL)
+ return (-1);
+
+ lifc.lifc_family = AF_UNSPEC;
+ lifc.lifc_flags = 0;
+ lifc.lifc_buf = (char *)lifrp;
+ if (ioctl(fd, SIOCGLIFCONF, &lifc) == -1) {
+ free(lifrp);
+ if (errno == EINVAL) {
+ lifn.lifn_count <<= 1;
+ continue;
+ }
+ (void) close(fd);
+ return (-1);
+ }
+ if (lifc.lifc_len < (lifn.lifn_count - 1) * sizeof (*lifrp))
+ break;
+ free(lifrp);
+ lifn.lifn_count <<= 1;
+ }
+ (void) close(fd);
+
+ *ifr_ret = lifrp;
+
+ return (lifc.lifc_len / sizeof (*lifrp));
+}
+
+static size_t
+nbytes(const struct lifreq *lifrp, int nlif, size_t socklen)
+{
+ size_t len = 0;
+ size_t slen;
+
+ while (nlif > 0) {
+ slen = strlen(lifrp->lifr_name) + 1;
+ len += sizeof (struct ifaddrs) + ((slen + 3) & ~3);
+ len += 3 * socklen;
+ lifrp++;
+ nlif--;
+ }
+ return (len);
+}
+
+static struct sockaddr *
+addrcpy(struct sockaddr_storage *addr, char **bufp)
+{
+ char *buf = *bufp;
+ size_t len;
+
+ len = addr->ss_family == AF_INET ? sizeof (struct sockaddr_in) :
+ sizeof (struct sockaddr_in6);
+ (void) memcpy(buf, addr, len);
+ *bufp = buf + len;
+ return ((struct sockaddr *)buf);
+}
+
+static int
+populate(struct ifaddrs *ifa, int fd, struct lifreq *lifrp, int nlif, int af,
+ char **bufp)
+{
+ char *buf = *bufp;
+ size_t slen;
+
+ while (nlif > 0) {
+ ifa->ifa_next = (nlif > 1) ? ifa + 1 : NULL;
+ (void) strcpy(ifa->ifa_name = buf, lifrp->lifr_name);
+ slen = strlen(lifrp->lifr_name) + 1;
+ buf += (slen + 3) & ~3;
+ if (ioctl(fd, SIOCGLIFFLAGS, lifrp) == -1)
+ ifa->ifa_flags = 0;
+ else
+ ifa->ifa_flags = lifrp->lifr_flags;
+ if (ioctl(fd, SIOCGLIFADDR, lifrp) == -1)
+ ifa->ifa_addr = NULL;
+ else
+ ifa->ifa_addr = addrcpy(&lifrp->lifr_addr, &buf);
+ if (ioctl(fd, SIOCGLIFNETMASK, lifrp) == -1)
+ ifa->ifa_netmask = NULL;
+ else
+ ifa->ifa_netmask = addrcpy(&lifrp->lifr_addr, &buf);
+ if (ifa->ifa_flags & IFF_POINTOPOINT) {
+ if (ioctl(fd, SIOCGLIFDSTADDR, lifrp) == -1)
+ ifa->ifa_dstaddr = NULL;
+ else
+ ifa->ifa_dstaddr =
+ addrcpy(&lifrp->lifr_dstaddr, &buf);
+ } else if (ifa->ifa_flags & IFF_BROADCAST) {
+ if (ioctl(fd, SIOCGLIFBRDADDR, lifrp) == -1)
+ ifa->ifa_broadaddr = NULL;
+ else
+ ifa->ifa_broadaddr =
+ addrcpy(&lifrp->lifr_broadaddr, &buf);
+ } else {
+ ifa->ifa_dstaddr = NULL;
+ }
+
+ ifa++;
+ nlif--;
+ lifrp++;
+ }
+ *bufp = buf;
+ return (0);
+}
+
+static int
+getifaddrs(struct ifaddrs **ifap)
+{
+ int fd4, fd6;
+ int nif4, nif6 = 0;
+ struct lifreq *ifr4 = NULL;
+ struct lifreq *ifr6 = NULL;
+ struct ifaddrs *ifa = NULL;
+ char *buf;
+
+ if ((fd4 = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+ return (-1);
+ if ((fd6 = socket(AF_INET6, SOCK_DGRAM, 0)) == -1 &&
+ errno != EAFNOSUPPORT) {
+ (void) close(fd4);
+ return (-1);
+ }
+
+ if ((nif4 = get_lifreq(fd4, &ifr4)) == -1 ||
+ (fd6 != -1 && (nif6 = get_lifreq(fd6, &ifr6)) == -1))
+ goto failure;
+
+ if (nif4 == 0 && nif6 == 0) {
+ *ifap = NULL;
+ return (0);
+ }
+
+ ifa = (struct ifaddrs *) malloc(nbytes(ifr4, nif4, sizeof (struct sockaddr_in)) +
+ nbytes(ifr6, nif6, sizeof (struct sockaddr_in6)));
+ if (ifa == NULL)
+ goto failure;
+
+ buf = (char *)(ifa + nif4 + nif6);
+
+ if (populate(ifa, fd4, ifr4, nif4, AF_INET, &buf) == -1)
+ goto failure;
+ if (nif4 > 0 && nif6 > 0)
+ ifa[nif4 - 1].ifa_next = ifa + nif4;
+ if (populate(ifa + nif4, fd6, ifr6, nif6, AF_INET6, &buf) == -1)
+ goto failure;
+
+ return (0);
+
+failure:
+ free(ifa);
+ (void) close(fd4);
+ if (fd6 != -1)
+ (void) close(fd6);
+ free(ifr4);
+ free(ifr6);
+ return (-1);
+}
+
+static void
+freeifaddrs(struct ifaddrs *ifa)
+{
+ free(ifa);
+}
+
+/* End WIDE Project code */
+
+namespace Swift {
+
+std::vector<NetworkInterface> SolarisNetworkEnvironment::getNetworkInterfaces() const {
+ std::map<std::string, NetworkInterface> interfaces;
+
+ ifaddrs* addrs = 0;
+ int ret = getifaddrs(&addrs);
+ if (ret != 0) {
+ return std::vector<NetworkInterface>();
+ }
+
+ for (ifaddrs* a = addrs; a != 0; a = a->ifa_next) {
+ std::string name(a->ifa_name);
+ boost::optional<HostAddress> address;
+ if (a->ifa_addr->sa_family == PF_INET) {
+ sockaddr_in* sa = reinterpret_cast<sockaddr_in*>(a->ifa_addr);
+ address = HostAddress(reinterpret_cast<const unsigned char*>(&(sa->sin_addr)), 4);
+ }
+ else if (a->ifa_addr->sa_family == PF_INET6) {
+ sockaddr_in6* sa = reinterpret_cast<sockaddr_in6*>(a->ifa_addr);
+ address = HostAddress(reinterpret_cast<const unsigned char*>(&(sa->sin6_addr)), 16);
+ }
+ if (address) {
+ std::map<std::string, NetworkInterface>::iterator i = interfaces.insert(std::make_pair(name, NetworkInterface(name, a->ifa_flags & IFF_LOOPBACK))).first;
+ i->second.addAddress(*address);
+ }
+ }
+
+ freeifaddrs(addrs);
+
+ std::vector<NetworkInterface> result;
+ for (std::map<std::string,NetworkInterface>::const_iterator i = interfaces.begin(); i != interfaces.end(); ++i) {
+ result.push_back(i->second);
+ }
+ return result;
+}
+
+}
diff --git a/Swiften/Network/SolarisNetworkEnvironment.h b/Swiften/Network/SolarisNetworkEnvironment.h
new file mode 100644
index 0000000..7481ff4
--- /dev/null
+++ b/Swiften/Network/SolarisNetworkEnvironment.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+* Copyright (c) 2013-2014 Remko Tronçon and Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
+#pragma once
+
+#include <vector>
+
+#include <Swiften/Base/boost_bsignals.h>
+
+#include <Swiften/Network/NetworkEnvironment.h>
+#include <Swiften/Network/NetworkInterface.h>
+
+namespace Swift {
+
+ class SolarisNetworkEnvironment : public NetworkEnvironment {
+ public:
+ std::vector<NetworkInterface> getNetworkInterfaces() const;
+ };
+
+}
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp
index e3efc3d..269ac3d 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParserFactoryCollection.cpp
@@ -1,37 +1,37 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <boost/bind.hpp>
#include <algorithm>
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
#include <Swiften/Parser/PayloadParserFactory.h>
namespace Swift {
PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactory_(NULL) {
}
void PayloadParserFactoryCollection::addFactory(PayloadParserFactory* factory) {
factories_.push_back(factory);
}
void PayloadParserFactoryCollection::removeFactory(PayloadParserFactory* factory) {
- factories_.erase(remove(factories_.begin(), factories_.end(), factory), factories_.end());
+ factories_.erase(std::remove(factories_.begin(), factories_.end(), factory), factories_.end());
}
void PayloadParserFactoryCollection::setDefaultFactory(PayloadParserFactory* factory) {
defaultFactory_ = factory;
}
PayloadParserFactory* PayloadParserFactoryCollection::getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
std::vector<PayloadParserFactory*>::reverse_iterator i = std::find_if(
- factories_.rbegin(), factories_.rend(),
+ factories_.rbegin(), factories_.rend(),
boost::bind(&PayloadParserFactory::canParse, _1, element, ns, attributes));
return (i != factories_.rend() ? *i : defaultFactory_);
}
}
diff --git a/Swiften/Roster/XMPPRosterImpl.h b/Swiften/Roster/XMPPRosterImpl.h
index 8c8cf3e..96da1f3 100644
--- a/Swiften/Roster/XMPPRosterImpl.h
+++ b/Swiften/Roster/XMPPRosterImpl.h
@@ -1,37 +1,37 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <map>
#include <set>
#include <Swiften/Base/API.h>
#include <Swiften/Roster/XMPPRoster.h>
namespace Swift {
class SWIFTEN_API XMPPRosterImpl : public XMPPRoster {
public:
XMPPRosterImpl();
- void addContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const RosterItemPayload::Subscription subscription);
+ void addContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, RosterItemPayload::Subscription subscription);
void removeContact(const JID& jid);
void clear();
bool containsJID(const JID& jid);
RosterItemPayload::Subscription getSubscriptionStateForJID(const JID& jid);
std::string getNameForJID(const JID& jid) const;
std::vector<std::string> getGroupsForJID(const JID& jid);
virtual std::vector<XMPPRosterItem> getItems() const;
virtual boost::optional<XMPPRosterItem> getItem(const JID&) const;
virtual std::set<std::string> getGroups() const;
private:
typedef std::map<JID, XMPPRosterItem> RosterMap;
RosterMap entries_;
};
}
diff --git a/Swiften/Serializer/PayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializerCollection.cpp
index ab2b4f4..0db89a9 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializerCollection.cpp
@@ -1,33 +1,33 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <boost/bind.hpp>
#include <algorithm>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializer.h>
namespace Swift {
PayloadSerializerCollection::PayloadSerializerCollection() {
}
void PayloadSerializerCollection::addSerializer(PayloadSerializer* serializer) {
serializers_.push_back(serializer);
}
void PayloadSerializerCollection::removeSerializer(PayloadSerializer* serializer) {
- serializers_.erase(remove(serializers_.begin(), serializers_.end(), serializer), serializers_.end());
+ serializers_.erase(std::remove(serializers_.begin(), serializers_.end(), serializer), serializers_.end());
}
PayloadSerializer* PayloadSerializerCollection::getPayloadSerializer(boost::shared_ptr<Payload> payload) const {
std::vector<PayloadSerializer*>::const_iterator i = std::find_if(
- serializers_.begin(), serializers_.end(),
+ serializers_.begin(), serializers_.end(),
boost::bind(&PayloadSerializer::canSerialize, _1, payload));
return (i != serializers_.end() ? *i : NULL);
}
}
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 7aaa5c2..5b4b7d5 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -1,92 +1,92 @@
/*
* Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <Swiften/Session/BasicSessionStream.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/StreamStack/XMPPLayer.h>
#include <Swiften/StreamStack/StreamStack.h>
#include <Swiften/StreamStack/ConnectionLayer.h>
#include <Swiften/StreamStack/WhitespacePingLayer.h>
#include <Swiften/StreamStack/CompressionLayer.h>
#include <Swiften/StreamStack/TLSLayer.h>
#include <Swiften/TLS/TLSContextFactory.h>
#include <Swiften/TLS/TLSContext.h>
namespace Swift {
BasicSessionStream::BasicSessionStream(
- StreamType streamType,
- boost::shared_ptr<Connection> connection,
- PayloadParserFactoryCollection* payloadParserFactories,
- PayloadSerializerCollection* payloadSerializers,
- TLSContextFactory* tlsContextFactory,
+ StreamType streamType,
+ boost::shared_ptr<Connection> connection,
+ PayloadParserFactoryCollection* payloadParserFactories,
+ PayloadSerializerCollection* payloadSerializers,
+ TLSContextFactory* tlsContextFactory,
TimerFactory* timerFactory,
XMLParserFactory* xmlParserFactory) :
- available(false),
- connection(connection),
- tlsContextFactory(tlsContextFactory),
- timerFactory(timerFactory),
+ available(false),
+ connection(connection),
+ tlsContextFactory(tlsContextFactory),
+ timerFactory(timerFactory),
compressionLayer(NULL),
tlsLayer(NULL),
whitespacePingLayer(NULL) {
xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType);
xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1));
xmppLayer->onElement.connect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1));
xmppLayer->onError.connect(boost::bind(&BasicSessionStream::handleXMPPError, this));
xmppLayer->onDataRead.connect(boost::bind(&BasicSessionStream::handleDataRead, this, _1));
xmppLayer->onWriteData.connect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1));
connection->onDisconnected.connect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1));
connectionLayer = new ConnectionLayer(connection);
streamStack = new StreamStack(xmppLayer, connectionLayer);
available = true;
}
BasicSessionStream::~BasicSessionStream() {
delete compressionLayer;
if (tlsLayer) {
- tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this));
+ tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this, _1));
tlsLayer->onConnected.disconnect(boost::bind(&BasicSessionStream::handleTLSConnected, this));
delete tlsLayer;
}
delete whitespacePingLayer;
delete streamStack;
connection->onDisconnected.disconnect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1));
delete connectionLayer;
xmppLayer->onStreamStart.disconnect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1));
xmppLayer->onElement.disconnect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1));
xmppLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleXMPPError, this));
xmppLayer->onDataRead.disconnect(boost::bind(&BasicSessionStream::handleDataRead, this, _1));
xmppLayer->onWriteData.disconnect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1));
delete xmppLayer;
}
void BasicSessionStream::writeHeader(const ProtocolHeader& header) {
assert(available);
xmppLayer->writeHeader(header);
}
void BasicSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) {
assert(available);
xmppLayer->writeElement(element);
}
void BasicSessionStream::writeFooter() {
assert(available);
xmppLayer->writeFooter();
}
void BasicSessionStream::writeData(const std::string& data) {
assert(available);
xmppLayer->writeData(data);