summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/pbd')
-rw-r--r--libs/pbd/pbd/abstract_ui.cc35
-rw-r--r--libs/pbd/pbd/abstract_ui.h16
-rw-r--r--libs/pbd/pbd/atomic_counter.h99
-rw-r--r--libs/pbd/pbd/base_ui.h18
-rw-r--r--libs/pbd/pbd/cartesian.h2
-rw-r--r--libs/pbd/pbd/compose.h30
-rw-r--r--libs/pbd/pbd/convert.h2
-rw-r--r--libs/pbd/pbd/debug.h1
-rw-r--r--libs/pbd/pbd/demangle.h2
-rw-r--r--libs/pbd/pbd/fallback_folders.h62
-rw-r--r--libs/pbd/pbd/ffs.h29
-rw-r--r--libs/pbd/pbd/file_utils.h8
-rw-r--r--libs/pbd/pbd/floating.h4
-rw-r--r--libs/pbd/pbd/functor_command.h2
-rw-r--r--libs/pbd/pbd/glib_semaphore.h57
-rw-r--r--libs/pbd/pbd/localeguard.h37
-rw-r--r--libs/pbd/pbd/localtime_r.h13
-rw-r--r--libs/pbd/pbd/memento_command.h6
-rw-r--r--libs/pbd/pbd/msvc_pbd.h256
-rw-r--r--libs/pbd/pbd/pathexpand.h1
-rw-r--r--libs/pbd/pbd/pathscanner.h4
-rw-r--r--libs/pbd/pbd/properties.h12
-rw-r--r--libs/pbd/pbd/property_basics.h17
-rw-r--r--libs/pbd/pbd/pthread_utils.h4
-rw-r--r--libs/pbd/pbd/rcu.h6
-rw-r--r--libs/pbd/pbd/resource.h49
-rw-r--r--libs/pbd/pbd/ringbuffer.h14
-rw-r--r--libs/pbd/pbd/ringbufferNPT.h14
-rw-r--r--libs/pbd/pbd/search_path.h46
-rw-r--r--libs/pbd/pbd/semaphore.h13
-rw-r--r--libs/pbd/pbd/semutils.h16
-rw-r--r--libs/pbd/pbd/sequence_property.h12
-rw-r--r--libs/pbd/pbd/signals.h2
-rw-r--r--libs/pbd/pbd/stacktrace.h8
-rw-r--r--libs/pbd/pbd/stl_delete.h10
-rw-r--r--libs/pbd/pbd/timersub.h32
-rw-r--r--libs/pbd/pbd/tokenizer.h2
-rw-r--r--libs/pbd/pbd/touchable.h8
-rw-r--r--libs/pbd/pbd/undo.h4
-rw-r--r--libs/pbd/pbd/unknown_type.h4
-rw-r--r--libs/pbd/pbd/unwind.h2
-rw-r--r--libs/pbd/pbd/uuid.h40
42 files changed, 855 insertions, 144 deletions
diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc
index d43bc64f63..67c39b57e4 100644
--- a/libs/pbd/pbd/abstract_ui.cc
+++ b/libs/pbd/pbd/abstract_ui.cc
@@ -28,6 +28,15 @@
#include "i18n.h"
+#ifdef COMPILER_MSVC
+#include <ardourext/misc.h> // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
+ // searched and sorted. Thus, when instantiating the container, MSVC complains
+ // if the type of object being contained has no appropriate comparison operators
+ // defined (specifically, if operators '<' and '==' are undefined). This seems
+ // to be the case with ptw32 'pthread_t' which is a simple struct.
+DECLARE_DEFAULT_COMPARISONS(ptw32_handle_t)
+#endif
+
using namespace std;
template<typename RequestBuffer> void
@@ -146,7 +155,7 @@ AbstractUI<RequestObject>::get_request (RequestType rt)
return 0;
}
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated per-thread request of type %2, caller %3\n", name(), rt, pthread_self()));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated per-thread request of type %2, caller %3\n", name(), rt, pthread_name()));
vec.buf[0]->type = rt;
vec.buf[0]->valid = true;
@@ -158,7 +167,7 @@ AbstractUI<RequestObject>::get_request (RequestType rt)
* are not at work.
*/
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated normal heap request of type %2, caller %3\n", name(), rt, pthread_self()));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated normal heap request of type %2, caller %3\n", name(), rt, pthread_name()));
RequestObject* req = new RequestObject;
req->type = rt;
@@ -213,7 +222,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
for (i = request_buffers.begin(); i != request_buffers.end(); ) {
if ((*i).second->dead) {
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 deleting dead per-thread request buffer for %3 @ %4\n",
- name(), pthread_self(), i->first, i->second));
+ name(), pthread_name(), i->second));
delete (*i).second;
RequestBufferMapIterator tmp = i;
++tmp;
@@ -241,7 +250,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
request_buffer_map_lock.lock ();
if (!req->valid) {
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 handling invalid heap request, type %3, deleting\n", name(), pthread_self(), req->type));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 handling invalid heap request, type %3, deleting\n", name(), pthread_name(), req->type));
delete req;
request_buffer_map_lock.unlock ();
continue;
@@ -253,7 +262,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
*/
if (req->invalidation) {
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 remove request from its invalidation list\n", name(), pthread_self()));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 remove request from its invalidation list\n", name(), pthread_name()));
/* after this call, if the object referenced by the
* invalidation record is deleted, it will no longer
@@ -281,7 +290,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
lm.release ();
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 execute request type %3\n", name(), pthread_self(), req->type));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 execute request type %3\n", name(), pthread_name(), req->type));
/* and lets do it ... this is a virtual call so that each
* specific type of UI can have its own set of requests without
@@ -290,7 +299,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
do_request (req);
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 delete heap request type %3\n", name(), pthread_self(), req->type));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 delete heap request type %3\n", name(), pthread_name(), req->type));
delete req;
/* re-acquire the list lock so that we check again */
@@ -315,7 +324,7 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
/* the thread that runs this UI's event loop is sending itself
a request: we dispatch it immediately and inline.
*/
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of request type %3\n", name(), pthread_self(), req->type));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of request type %3\n", name(), pthread_name(), req->type));
do_request (req);
} else {
@@ -334,13 +343,13 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
RequestBuffer* rbuf = per_thread_request_buffer.get ();
if (rbuf != 0) {
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send per-thread request type %3\n", name(), pthread_self(), req->type));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send per-thread request type %3\n", name(), pthread_name(), req->type));
rbuf->increment_write_ptr (1);
} else {
/* no per-thread buffer, so just use a list with a lock so that it remains
single-reader/single-writer semantics
*/
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send heap request type %3\n", name(), pthread_self(), req->type));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send heap request type %3\n", name(), pthread_name(), req->type));
Glib::Threads::Mutex::Lock lm (request_list_lock);
request_list.push_back (req);
}
@@ -349,7 +358,7 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
at the per-thread and generic request lists.
*/
- request_channel.wakeup ();
+ signal_new_request ();
}
}
@@ -357,7 +366,7 @@ template<typename RequestObject> void
AbstractUI<RequestObject>::call_slot (InvalidationRecord* invalidation, const boost::function<void()>& f)
{
if (caller_is_self()) {
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of call slot via functor @ %3, invalidation %4\n", name(), pthread_self(), &f, invalidation));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of call slot via functor @ %3, invalidation %4\n", name(), pthread_name(), &f, invalidation));
f ();
return;
}
@@ -368,7 +377,7 @@ AbstractUI<RequestObject>::call_slot (InvalidationRecord* invalidation, const bo
return;
}
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 queue call-slot using functor @ %3, invalidation %4\n", name(), pthread_self(), &f, invalidation));
+ DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 queue call-slot using functor @ %3, invalidation %4\n", name(), pthread_name(), &f, invalidation));
/* copy semantics: copy the functor into the request object */
diff --git a/libs/pbd/pbd/abstract_ui.h b/libs/pbd/pbd/abstract_ui.h
index f78ba26090..1ceefe7b3b 100644
--- a/libs/pbd/pbd/abstract_ui.h
+++ b/libs/pbd/pbd/abstract_ui.h
@@ -52,7 +52,7 @@
class Touchable;
template<typename RequestObject>
-class ABSTRACT_UI_API AbstractUI : public BaseUI /* see notes in visibility.h about why this is not LIBPBD_API */
+class /*ABSTRACT_UI_API*/ AbstractUI : public BaseUI /* see notes in visibility.h about why this is not LIBPBD_API */
{
public:
AbstractUI (const std::string& name);
@@ -74,8 +74,22 @@ class ABSTRACT_UI_API AbstractUI : public BaseUI /* see notes in visibility.h ab
, ui (uir) {}
};
typedef typename RequestBuffer::rw_vector RequestBufferVector;
+
+#if defined(__MINGW32__)
+
+ struct pthread_cmp
+ {
+ bool operator() (const ptw32_handle_t& thread1, const ptw32_handle_t& thread2)
+ {
+ return thread1.p < thread2.p;
+ }
+ };
+ typedef typename std::map<pthread_t,RequestBuffer*, pthread_cmp>::iterator RequestBufferMapIterator;
+ typedef std::map<pthread_t,RequestBuffer*, pthread_cmp> RequestBufferMap;
+#else
typedef typename std::map<pthread_t,RequestBuffer*>::iterator RequestBufferMapIterator;
typedef std::map<pthread_t,RequestBuffer*> RequestBufferMap;
+#endif
RequestBufferMap request_buffers;
static Glib::Threads::Private<RequestBuffer> per_thread_request_buffer;
diff --git a/libs/pbd/pbd/atomic_counter.h b/libs/pbd/pbd/atomic_counter.h
new file mode 100644
index 0000000000..1e1998e1f1
--- /dev/null
+++ b/libs/pbd/pbd/atomic_counter.h
@@ -0,0 +1,99 @@
+/*
+ Copyright (C) 2010 Tim Mayberry
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef PBD_ATOMIC_COUNTER_H
+#define PBD_ATOMIC_COUNTER_H
+
+#include <glib.h>
+
+namespace PBD {
+
+class atomic_counter
+{
+ /**
+ * Prevent copying and assignment
+ */
+ atomic_counter (const atomic_counter&);
+ atomic_counter& operator= (const atomic_counter&);
+
+public:
+
+ atomic_counter (gint value = 0)
+ :
+ m_value(value)
+ { }
+
+ gint get() const
+ {
+ return g_atomic_int_get (&m_value);
+ }
+
+ void set (gint new_value)
+ {
+ g_atomic_int_set (&m_value, new_value);
+ }
+
+ void increment ()
+ {
+ g_atomic_int_inc (&m_value);
+ }
+
+ void operator++ ()
+ {
+ increment ();
+ }
+
+ bool decrement_and_test ()
+ {
+ return g_atomic_int_dec_and_test (&m_value);
+ }
+
+ bool operator-- ()
+ {
+ return decrement_and_test ();
+ }
+
+ bool compare_and_exchange (gint old_value, gint new_value)
+ {
+ return g_atomic_int_compare_and_exchange
+ (
+ &m_value,
+ old_value,
+ new_value
+ );
+ }
+
+ /**
+ * convenience method, \see compare_and_exchange
+ */
+ bool cas (gint old_value, gint new_value)
+ {
+ return compare_and_exchange (old_value, new_value);
+ }
+
+private:
+
+ // Has to be mutable when using the apple version of gcc.
+ mutable volatile gint m_value;
+
+};
+
+} // namespace PBD
+
+#endif // PBD_ATOMIC_COUNTER_H
diff --git a/libs/pbd/pbd/base_ui.h b/libs/pbd/pbd/base_ui.h
index ee2bbf5ee9..ea1afbbb5a 100644
--- a/libs/pbd/pbd/base_ui.h
+++ b/libs/pbd/pbd/base_ui.h
@@ -72,13 +72,13 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
void quit ();
protected:
- CrossThreadChannel request_channel;
bool _ok;
Glib::RefPtr<Glib::MainLoop> _main_loop;
- Glib::Threads::Thread* run_loop_thread;
+ Glib::RefPtr<Glib::MainContext> m_context;
+ Glib::Threads::Thread* run_loop_thread;
Glib::Threads::Mutex _run_lock;
- Glib::Threads::Cond _running;
+ Glib::Threads::Cond _running;
/* this signals _running from within the event loop,
from an idle callback
@@ -93,9 +93,17 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
virtual void thread_init () {};
+#ifdef PLATFORM_WINDOWS
+ static gboolean _request_handler (gpointer);
+ bool request_handler ();
+#else
/** Called when there input ready on the request_channel
*/
bool request_handler (Glib::IOCondition);
+#endif
+
+ void signal_new_request ();
+ void attach_request_source ();
/** Derived UI objects must implement this method,
* which will be called whenever there are requests
@@ -106,6 +114,10 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
private:
std::string _name;
BaseUI* base_ui_instance;
+
+#ifndef PLATFORM_WINDOWS
+ CrossThreadChannel request_channel;
+#endif
static uint64_t rt_bit;
diff --git a/libs/pbd/pbd/cartesian.h b/libs/pbd/pbd/cartesian.h
index 20c8b27088..5f0b951d5f 100644
--- a/libs/pbd/pbd/cartesian.h
+++ b/libs/pbd/pbd/cartesian.h
@@ -97,7 +97,7 @@ struct LIBPBD_API AngularVector {
}
};
-LIBPBD_API inline void CartesianVector::angular (AngularVector& a) const {
+inline void CartesianVector::angular (AngularVector& a) const {
cartesian_to_spherical (x, y, z, a.azi, a.ele, a.length);
}
diff --git a/libs/pbd/pbd/compose.h b/libs/pbd/pbd/compose.h
index a80cb213b2..cb4182699f 100644
--- a/libs/pbd/pbd/compose.h
+++ b/libs/pbd/pbd/compose.h
@@ -204,7 +204,7 @@ namespace StringPrivate
// a series of functions which accept a format string on the form "text %1
// more %2 less %3" and a number of templated parameters and spits out the
// composited string
- template <typename T1> LIBPBD_API
+ template <typename T1>
inline std::string string_compose(const std::string &fmt, const T1 &o1)
{
StringPrivate::Composition c(fmt);
@@ -212,7 +212,7 @@ namespace StringPrivate
return c.str();
}
- template <typename T1, typename T2> LIBPBD_API
+ template <typename T1, typename T2>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2)
{
@@ -221,7 +221,7 @@ namespace StringPrivate
return c.str();
}
- template <typename T1, typename T2, typename T3> LIBPBD_API
+ template <typename T1, typename T2, typename T3>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3)
{
@@ -230,7 +230,7 @@ namespace StringPrivate
return c.str();
}
- template <typename T1, typename T2, typename T3, typename T4> LIBPBD_API
+ template <typename T1, typename T2, typename T3, typename T4>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4)
@@ -240,7 +240,7 @@ namespace StringPrivate
return c.str();
}
- template <typename T1, typename T2, typename T3, typename T4, typename T5> LIBPBD_API
+ template <typename T1, typename T2, typename T3, typename T4, typename T5>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5)
@@ -251,7 +251,7 @@ namespace StringPrivate
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6> LIBPBD_API
+ typename T6>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6)
@@ -262,7 +262,7 @@ namespace StringPrivate
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7> LIBPBD_API
+ typename T6, typename T7>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -274,7 +274,7 @@ namespace StringPrivate
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8> LIBPBD_API
+ typename T6, typename T7, typename T8>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -286,7 +286,7 @@ namespace StringPrivate
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9> LIBPBD_API
+ typename T6, typename T7, typename T8, typename T9>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -298,7 +298,7 @@ namespace StringPrivate
}
template <typename T1, typename T2, typename T3, typename T4, typename T5,
- typename T6, typename T7, typename T8, typename T9, typename T10> LIBPBD_API
+ typename T6, typename T7, typename T8, typename T9, typename T10>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -313,7 +313,7 @@ namespace StringPrivate
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11> LIBPBD_API
+ typename T11>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -328,7 +328,7 @@ namespace StringPrivate
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12> LIBPBD_API
+ typename T11, typename T12>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -343,7 +343,7 @@ namespace StringPrivate
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13> LIBPBD_API
+ typename T11, typename T12, typename T13>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -359,7 +359,7 @@ namespace StringPrivate
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
- typename T11, typename T12, typename T13, typename T14> LIBPBD_API
+ typename T11, typename T12, typename T13, typename T14>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
@@ -376,7 +376,7 @@ namespace StringPrivate
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11, typename T12, typename T13, typename T14,
- typename T15> LIBPBD_API
+ typename T15>
inline std::string string_compose(const std::string &fmt,
const T1 &o1, const T2 &o2, const T3 &o3,
const T4 &o4, const T5 &o5, const T6 &o6,
diff --git a/libs/pbd/pbd/convert.h b/libs/pbd/pbd/convert.h
index 1269254906..6580a6e8e7 100644
--- a/libs/pbd/pbd/convert.h
+++ b/libs/pbd/pbd/convert.h
@@ -47,7 +47,7 @@ LIBPBD_API std::string length2string (const int64_t frames, const double sample_
LIBPBD_API std::vector<std::string> internationalize (const char *, const char **);
LIBPBD_API bool strings_equal_ignore_case (const std::string& a, const std::string& b);
-template <class T> std::string LIBPBD_API
+template <class T> std::string /*LIBPBD_API*/
to_string (T t, std::ios_base & (*f)(std::ios_base&))
{
std::ostringstream oss;
diff --git a/libs/pbd/pbd/debug.h b/libs/pbd/pbd/debug.h
index dc7e1ce906..54577f1a7e 100644
--- a/libs/pbd/pbd/debug.h
+++ b/libs/pbd/pbd/debug.h
@@ -45,6 +45,7 @@ namespace PBD {
LIBPBD_API extern uint64_t Pool;
LIBPBD_API extern uint64_t EventLoop;
LIBPBD_API extern uint64_t AbstractUI;
+ extern uint64_t FileUtils;
}
}
diff --git a/libs/pbd/pbd/demangle.h b/libs/pbd/pbd/demangle.h
index c9f5c194c0..12dc58839c 100644
--- a/libs/pbd/pbd/demangle.h
+++ b/libs/pbd/pbd/demangle.h
@@ -32,7 +32,7 @@
namespace PBD
{
- template<typename T> LIBPBD_API
+ template<typename T> /*LIBPBD_API*/
std::string demangled_name (T const & obj)
{
#ifdef __GNUC__
diff --git a/libs/pbd/pbd/fallback_folders.h b/libs/pbd/pbd/fallback_folders.h
new file mode 100644
index 0000000000..db8992db6d
--- /dev/null
+++ b/libs/pbd/pbd/fallback_folders.h
@@ -0,0 +1,62 @@
+/*
+ Copyright (C) 2009 John Emmas
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#ifndef __platform_fallback_folders_h__
+#define __platform_fallback_folders_h__
+
+#include <pbd/msvc_pbd.h>
+#include <glib/gtypes.h>
+
+#ifdef PLATFORM_WINDOWS // Would not be relevant for Cygwin!!
+ LIBPBD_API gchar* PBD_APICALLTYPE get_win_special_folder (int csidl);
+#endif
+
+namespace PBD {
+
+ typedef enum fallback_folder_t {
+ FOLDER_LOCALE,
+ FOLDER_GTK,
+ FOLDER_CONFIG,
+ FOLDER_ARDOUR,
+ FOLDER_MODULE,
+ FOLDER_DATA,
+ FOLDER_ICONS,
+ FOLDER_PIXMAPS,
+ FOLDER_CONTROL_SURFACES,
+ FOLDER_VAMP,
+ FOLDER_LADSPA,
+ FOLDER_VST,
+ FOLDER_BUNDLED_LV2,
+ FALLBACK_FOLDER_MAX
+ };
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ LIBPBD_API G_CONST_RETURN gchar* PBD_APICALLTYPE get_platform_fallback_folder (PBD::fallback_folder_t index);
+ LIBPBD_API G_CONST_RETURN gchar* G_CONST_RETURN * PBD_APICALLTYPE alloc_platform_fallback_folders ();
+ LIBPBD_API void PBD_APICALLTYPE free_platform_fallback_folders ();
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+} // namespace PBD
+
+#endif /* __platform_fallback_folders_h__ */
diff --git a/libs/pbd/pbd/ffs.h b/libs/pbd/pbd/ffs.h
new file mode 100644
index 0000000000..f21fc82a39
--- /dev/null
+++ b/libs/pbd/pbd/ffs.h
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2013 Tim Mayberry
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __libpbd_ffs_h__
+#define __libpbd_ffs_h__
+
+#include "pbd/libpbd_visibility.h"
+
+namespace PBD {
+ LIBPBD_API int ffs(int x);
+}
+
+#endif /* __libpbd_ffs_h__ */
diff --git a/libs/pbd/pbd/file_utils.h b/libs/pbd/pbd/file_utils.h
index 6f8a98b697..01ff8606a7 100644
--- a/libs/pbd/pbd/file_utils.h
+++ b/libs/pbd/pbd/file_utils.h
@@ -69,15 +69,15 @@ find_matching_files_in_directories (const std::vector<std::string>& directory_pa
std::vector<std::string>& result);
/**
- * Takes a SearchPath and puts a list of all the files in the search path
+ * Takes a Searchpath and puts a list of all the files in the search path
* that match pattern into the result vector.
*
- * @param search_path A SearchPath
+ * @param search_path A Searchpath
* @param pattern A Glib::PatternSpec used to match the files
* @param result A vector in which to place the resulting matches.
*/
LIBPBD_API void
-find_matching_files_in_search_path (const SearchPath& search_path,
+find_matching_files_in_search_path (const Searchpath& search_path,
const Glib::PatternSpec& pattern,
std::vector<std::string>& result);
@@ -88,7 +88,7 @@ find_matching_files_in_search_path (const SearchPath& search_path,
* @return true If file is found within the search path.
*/
LIBPBD_API bool
-find_file_in_search_path (const SearchPath& search_path,
+find_file_in_search_path (const Searchpath& search_path,
const std::string& filename,
std::string& result);
diff --git a/libs/pbd/pbd/floating.h b/libs/pbd/pbd/floating.h
index e5d582625a..c0003a3113 100644
--- a/libs/pbd/pbd/floating.h
+++ b/libs/pbd/pbd/floating.h
@@ -26,13 +26,15 @@
#ifndef __libpbd__floating_h__
#define __libpbd__floating_h__
+#include <stdint.h>
+
#include <cmath>
#include "pbd/libpbd_visibility.h"
namespace PBD {
-union LIBPBD_API Float_t
+union /*LIBPBD_API*/ Float_t
{
Float_t (float num = 0.0f) : f(num) {}
diff --git a/libs/pbd/pbd/functor_command.h b/libs/pbd/pbd/functor_command.h
index d2aacd18ac..6cca13209f 100644
--- a/libs/pbd/pbd/functor_command.h
+++ b/libs/pbd/pbd/functor_command.h
@@ -37,7 +37,7 @@
namespace PBD {
template <class obj_type, class arg_type>
-class LIBPBD_API FunctorCommand : public Command
+class /*LIBPBD_API*/ FunctorCommand : public Command
{
private:
typedef void (obj_type::*functor_type)(arg_type);
diff --git a/libs/pbd/pbd/glib_semaphore.h b/libs/pbd/pbd/glib_semaphore.h
new file mode 100644
index 0000000000..7f96120d7d
--- /dev/null
+++ b/libs/pbd/pbd/glib_semaphore.h
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2010 Tim Mayberry
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef PBD_GLIB_SEMAPHORE_H
+#define PBD_GLIB_SEMAPHORE_H
+
+#include <glibmm/threads.h>
+
+#include "pbd/libpbd_visibility.h"
+#include "atomic_counter.h"
+
+namespace PBD {
+
+class LIBPBD_API GlibSemaphore
+{
+
+ // prevent copying and assignment
+ GlibSemaphore(const GlibSemaphore& sema);
+ GlibSemaphore& operator= (const GlibSemaphore& sema);
+
+public:
+
+ GlibSemaphore (gint initial_val = 1);
+
+ void wait ();
+
+ bool try_wait ();
+
+ void post ();
+
+private:
+
+ atomic_counter m_counter;
+ Glib::Threads::Cond m_cond;
+ Glib::Threads::Mutex m_mutex;
+
+};
+
+} // namespace PBD
+
+#endif // PBD_SEMAPHORE_H
diff --git a/libs/pbd/pbd/localeguard.h b/libs/pbd/pbd/localeguard.h
new file mode 100644
index 0000000000..21ea5380fa
--- /dev/null
+++ b/libs/pbd/pbd/localeguard.h
@@ -0,0 +1,37 @@
+/*
+ Copyright (C) 1999-2010 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __pbd_localeguard_h__
+#define __pbd_localeguard_h__
+
+#include <string>
+
+namespace PBD {
+
+struct LIBPBD_API /* Added by JE - */ LocaleGuard {
+ LocaleGuard (const char*);
+ ~LocaleGuard ();
+ const char* old;
+
+ /* JE - temporary !!!! */static std::string current;
+};
+
+}; // namespace
+
+#endif /* __pbd_localeguard_h__ */
diff --git a/libs/pbd/pbd/localtime_r.h b/libs/pbd/pbd/localtime_r.h
new file mode 100644
index 0000000000..ad5b89d134
--- /dev/null
+++ b/libs/pbd/pbd/localtime_r.h
@@ -0,0 +1,13 @@
+#ifndef PBD_LOCALTIME_R
+#define PBD_LOCALTIME_R
+#include <time.h>
+
+#ifdef COMPILER_MSVC
+ #define localtime_r( _clock, _result ) \
+ ( *(_result) = *localtime( (_clock) ), \
+ (_result) )
+#else
+ extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
+#endif
+
+#endif
diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h
index 6560780f3c..f6d11a0b33 100644
--- a/libs/pbd/pbd/memento_command.h
+++ b/libs/pbd/pbd/memento_command.h
@@ -51,7 +51,7 @@
* can do `just-in-time' binding from the crossfade ID.
*/
template <class obj_T>
-class LIBPBD_API MementoCommandBinder : public PBD::Destructible
+class /*LIBPBD_API*/ MementoCommandBinder : public PBD::Destructible
{
public:
/** @return Stateful object to operate on */
@@ -68,7 +68,7 @@ public:
/** A simple MementoCommandBinder which binds directly to an object */
template <class obj_T>
-class LIBPBD_API SimpleMementoCommandBinder : public MementoCommandBinder<obj_T>
+class /*LIBPBD_API*/ SimpleMementoCommandBinder : public MementoCommandBinder<obj_T>
{
public:
SimpleMementoCommandBinder (obj_T& o)
@@ -100,7 +100,7 @@ private:
* memento, and redo is restoring the after memento.
*/
template <class obj_T>
-class LIBPBD_API MementoCommand : public Command
+class /*LIBPBD_API*/ MementoCommand : public Command
{
public:
MementoCommand (obj_T& a_object, XMLNode* a_before, XMLNode* a_after)
diff --git a/libs/pbd/pbd/msvc_pbd.h b/libs/pbd/pbd/msvc_pbd.h
new file mode 100644
index 0000000000..a623ca2eb2
--- /dev/null
+++ b/libs/pbd/pbd/msvc_pbd.h
@@ -0,0 +1,256 @@
+/*
+ Copyright (C) 2009 John Emmas
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#ifndef _msvc_pbd_h_
+#define _msvc_pbd_h_
+
+#ifdef PBD_IS_IN_WIN_STATIC_LIB // #define if your project uses libpbd (under Windows) as a static library
+#undef LIBPBD_DLL
+#define PBD_IS_IN_WINDLL 0
+#endif
+
+#include <pbd/libpbd_visibility.h>
+
+#ifndef COMPILER_MSVC
+#include <sys/time.h>
+#else
+#include <ardourext/misc.h>
+#include <ardourext/sys/time.h>
+#endif
+
+#if !defined(PBD_IS_IN_WINDLL)
+ #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+ // If you need '__declspec' compatibility, add extra compilers to the above as necessary
+ #define PBD_IS_IN_WINDLL 1
+ #else
+ #define PBD_IS_IN_WINDLL 0
+ #endif
+#endif
+
+#if PBD_IS_IN_WINDLL && !defined(PBD_APICALLTYPE)
+ #if defined(BUILDING_PBD)
+ #define PBD_APICALLTYPE __cdecl
+ #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+ #define PBD_APICALLTYPE __cdecl
+ #else
+ #error "Attempting to define __declspec with an incompatible compiler !"
+ #endif
+#elif !defined(PBD_APICALLTYPE)
+ // Other compilers / platforms could be accommodated here
+ #define PBD_APICALLTYPE
+#ifndef GETOPT_API
+ #define GETOPT_API
+ #define GETOPT_APICALLTYPE
+#endif
+#endif
+
+#ifndef GETOPT_API
+ #if defined(BUILDING_GETOPT)
+ #define GETOPT_API __declspec(dllexport)
+ #define GETOPT_APICALLTYPE __cdecl
+ #elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MINGW32__)
+ #define GETOPT_API __declspec(dllimport)
+ #define GETOPT_APICALLTYPE __cdecl
+ #else
+ #error "Attempting to define __declspec with an incompatible compiler !"
+ #endif
+#endif // GETOPT_API
+
+#ifndef _MAX_PATH
+#define _MAX_PATH 260
+#endif
+#ifndef PATH_MAX
+#define PATH_MAX _MAX_PATH
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// This function is (hopefully) temporary and is placed here
+// because 'g_usleep()' doesn't seem to work very well for glib-win32
+// JE - let's see if we can do without this now! void pbd_g_usleep (unsigned long microseconds);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#ifndef POLLIN
+#define POLLIN 1
+#define POLLPRI 2
+#define POLLOUT 4
+#define POLLERR 8
+#define POLLHUP 16
+#define POLLNVAL 32
+#define NPOLLFILE 64
+
+#define POLLRDNORM POLLIN
+#define POLLRDBAND POLLIN
+#define POLLWRNORM POLLOUT
+#define POLLWRBAND POLLOUT
+#endif
+
+#ifdef PLATFORM_WINDOWS
+
+#ifndef PBDEXTN_API
+ #if defined(BUILDING_PBDEXTN)
+ #define PBDEXTN_API __declspec(dllexport)
+ #define PBDEXTN_APICALLTYPE __cdecl
+ #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+ #define PBDEXTN_API __declspec(dllimport)
+ #define PBDEXTN_APICALLTYPE __cdecl
+ #else
+ #error "Attempting to define __declspec with an incompatible compiler !"
+ #endif
+#endif // PBDEXTN_API
+
+#ifndef CYGIMPORT_API
+ #define CYGIMPORT_API __declspec(dllimport)
+ #define CYGIMPORT_APICALLTYPE __cdecl
+#endif // CYGIMPORT_API
+
+#ifndef __THROW
+#define __THROW throw()
+#endif
+
+#ifndef RTLD_DEFAULT
+#define RTLD_DEFAULT ((void *) 0)
+#define RTLD_NEXT ((void *) -1L)
+#define RTLD_LAZY 0x00001
+#define RTLD_NOW 0x00002
+#define RTLD_BINDING_MASK 0x00003
+#define RTLD_NOLOAD 0x00004
+#define RTLD_GLOBAL 0x00004
+#define RTLD_DEEPBIND 0x00008
+#endif
+
+#ifndef OPEN_MAX
+#define OPEN_MAX 32
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+PBDEXTN_API int PBDEXTN_APICALLTYPE cyginit (unsigned int result);
+LIBPBD_API int PBD_APICALLTYPE dlclose (void *handle) __THROW;
+LIBPBD_API void* PBD_APICALLTYPE dlopen (const char *file_name, int mode) __THROW;
+LIBPBD_API void* PBD_APICALLTYPE dlsym (void *handle, const char *symbol_name) __THROW;
+LIBPBD_API char* PBD_APICALLTYPE dlerror () __THROW;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#ifndef __CYGWIN__
+/* For whatever reason, Ardour's 'libevoral' refuses to build as a DLL if we include both 'rpc.h' */
+/* and 'WinSock2.h'. It doesn't seem to matter which order we #include them. Given that we can't */
+/* edit 'rpc.h' or 'WinSock2.h', just make sure we don't #include them when building libevoral. */
+#ifndef BUILDING_EVORAL
+#include <rpc.h>
+typedef int (FAR PBDEXTN_APICALLTYPE *CYGINIT_API)(unsigned int);
+#endif
+#include <io.h>
+#include <sys/types.h>
+
+#ifndef FILENAME_MAX
+#define FILENAME_MAX (260)
+#endif
+
+#ifndef _SSIZE_T_
+#define _SSIZE_T_
+typedef long _ssize_t;
+
+#ifndef _NO_OLDNAMES
+typedef _ssize_t ssize_t;
+#endif
+#endif /* ! _SSIZE_T_ */
+
+struct dirent
+{
+ long d_ino; // Always zero
+ unsigned short d_reclen; // Always zero
+ unsigned short d_namlen; // Length of name in d_name
+ char d_name[FILENAME_MAX]; // File name
+};
+
+// This is an internal data structure. Do not use it
+// except as an argument to one of the functions below.
+typedef struct
+{
+ // Disk transfer area for this dir
+ struct _finddata_t dd_dta;
+
+ // 'dirent' struct to return from dir (NOTE: this
+ // is not thread safe).
+ struct dirent dd_dir;
+
+ // '_findnext()' handle
+ long dd_handle;
+
+ // Current status of search:
+ // 0 = not started yet (next entry to read is first entry)
+ // -1 = off the end
+ // Otherwise - positive (0 based) index of next entry
+ int dd_stat;
+
+ // Full path for dir with search pattern (struct will be extended)
+ char dd_name[1];
+} DIR;
+
+struct pollfd
+{
+ int fd;
+ short events;
+ short revents;
+};
+
+typedef unsigned int nfds_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+LIBPBD_API int __cdecl gettimeofday(struct timeval *__restrict tv, __timezone_ptr_t tz);
+LIBPBD_API ssize_t PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes, off_t offset);
+LIBPBD_API ssize_t PBD_APICALLTYPE pwrite(int handle, const void *buf, size_t nbytes, off_t offset);
+LIBPBD_API int PBD_APICALLTYPE poll(struct pollfd *fds, nfds_t nfds, int timeout);
+LIBPBD_API double PBD_APICALLTYPE round(double x);
+
+namespace PBD {
+
+LIBPBD_API bool PBD_APICALLTYPE TestForMinimumSpecOS(char *revision="currently ignored");
+LIBPBD_API char* PBD_APICALLTYPE realpath (const char *original_path, char resolved_path[_MAX_PATH+1]);
+LIBPBD_API int PBD_APICALLTYPE mkstemp (char *template_name);
+LIBPBD_API int PBD_APICALLTYPE ntfs_link (const char *existing_filepath, const char *link_filepath);
+LIBPBD_API int PBD_APICALLTYPE ntfs_unlink (const char *link_filepath);
+
+// These are used to replicate 'dirent.h' functionality
+LIBPBD_API DIR* PBD_APICALLTYPE opendir (const char *szPath);
+LIBPBD_API struct dirent* PBD_APICALLTYPE readdir (DIR *pDir);
+LIBPBD_API int PBD_APICALLTYPE closedir (DIR *pDir);
+
+} // namespace PBD
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif // !__CYGWIN__
+#endif // PLATFORM_WINDOWS
+#endif // _msvc_pbd_h_
diff --git a/libs/pbd/pbd/pathexpand.h b/libs/pbd/pbd/pathexpand.h
index 5f1c03f8ee..5c5d4cf772 100644
--- a/libs/pbd/pbd/pathexpand.h
+++ b/libs/pbd/pbd/pathexpand.h
@@ -24,6 +24,7 @@
#include "pbd/libpbd_visibility.h"
namespace PBD {
+ LIBPBD_API std::string canonical_path (const std::string& path);
LIBPBD_API std::string path_expand (std::string path);
LIBPBD_API std::string search_path_expand (std::string path);
}
diff --git a/libs/pbd/pbd/pathscanner.h b/libs/pbd/pbd/pathscanner.h
index ef6499c759..d62203c008 100644
--- a/libs/pbd/pbd/pathscanner.h
+++ b/libs/pbd/pbd/pathscanner.h
@@ -22,7 +22,11 @@
#include <vector>
#include <string>
+#ifdef COMPILER_MSVC
+#include <ardourext/misc.h>
+#else
#include <regex.h>
+#endif
#include "pbd/libpbd_visibility.h"
diff --git a/libs/pbd/pbd/properties.h b/libs/pbd/pbd/properties.h
index 27a0be1895..70d18db4c7 100644
--- a/libs/pbd/pbd/properties.h
+++ b/libs/pbd/pbd/properties.h
@@ -37,7 +37,7 @@ namespace PBD {
/** Parent class for classes which represent a single scalar property in a Stateful object */
template<class T>
-class LIBPBD_API PropertyTemplate : public PropertyBase
+class /*LIBPBD_API*/ PropertyTemplate : public PropertyBase
{
public:
PropertyTemplate (PropertyDescriptor<T> p, T const& v)
@@ -197,7 +197,7 @@ private:
PropertyTemplate (PropertyTemplate<T> const &);
};
-template<class T> LIBPBD_API
+template<class T> /*LIBPBD_API*/
std::ostream & operator<<(std::ostream& os, PropertyTemplate<T> const& s)
{
return os << s.val ();
@@ -207,7 +207,7 @@ std::ostream & operator<<(std::ostream& os, PropertyTemplate<T> const& s)
* with types that can be written to / read from stringstreams.
*/
template<class T>
-class LIBPBD_API Property : public PropertyTemplate<T>
+class /*LIBPBD_API*/ Property : public PropertyTemplate<T>
{
public:
Property (PropertyDescriptor<T> q, T const& v)
@@ -285,7 +285,7 @@ private:
* separators, etc.
*/
template<>
-class LIBPBD_API Property<std::string> : public PropertyTemplate<std::string>
+class /*LIBPBD_API*/ Property<std::string> : public PropertyTemplate<std::string>
{
public:
Property (PropertyDescriptor<std::string> d, std::string const & v)
@@ -319,7 +319,7 @@ private:
};
template<class T>
-class LIBPBD_API EnumProperty : public Property<T>
+class /*LIBPBD_API*/ EnumProperty : public Property<T>
{
public:
EnumProperty (PropertyDescriptor<T> q, T const& v)
@@ -352,7 +352,7 @@ private:
* one.
*/
template <class T>
-class LIBPBD_API SharedStatefulProperty : public PropertyBase
+class /*LIBPBD_API*/ SharedStatefulProperty : public PropertyBase
{
public:
typedef boost::shared_ptr<T> Ptr;
diff --git a/libs/pbd/pbd/property_basics.h b/libs/pbd/pbd/property_basics.h
index 2da21ddb84..d0eb1db922 100644
--- a/libs/pbd/pbd/property_basics.h
+++ b/libs/pbd/pbd/property_basics.h
@@ -38,7 +38,7 @@ class LIBPBD_API StatefulDiffCommand;
typedef GQuark PropertyID;
template<typename T>
-struct LIBPBD_API PropertyDescriptor {
+struct /*LIBPBD_API*/ PropertyDescriptor {
PropertyDescriptor () : property_id (0) {}
PropertyDescriptor (PropertyID pid) : property_id (pid) {}
@@ -47,16 +47,17 @@ struct LIBPBD_API PropertyDescriptor {
};
/** A list of IDs of Properties that have changed in some situation or other */
-class LIBPBD_API PropertyChange : public std::set<PropertyID>
+class /*LIBPBD_API*/ PropertyChange : public std::set<PropertyID>
{
public:
- PropertyChange() {}
+ LIBPBD_API PropertyChange() {}
+ LIBPBD_API ~PropertyChange() {}
template<typename T> PropertyChange(PropertyDescriptor<T> p);
- PropertyChange(const PropertyChange& other) : std::set<PropertyID> (other) {}
+ LIBPBD_API PropertyChange(const PropertyChange& other) : std::set<PropertyID> (other) {}
- PropertyChange operator=(const PropertyChange& other) {
+ LIBPBD_API PropertyChange operator=(const PropertyChange& other) {
clear ();
insert (other.begin (), other.end ());
return *this;
@@ -65,7 +66,7 @@ public:
template<typename T> PropertyChange operator=(PropertyDescriptor<T> p);
template<typename T> bool contains (PropertyDescriptor<T> p) const;
- bool contains (const PropertyChange& other) const {
+ LIBPBD_API bool contains (const PropertyChange& other) const {
for (const_iterator x = other.begin (); x != other.end (); ++x) {
if (find (*x) != end ()) {
return true;
@@ -74,8 +75,8 @@ public:
return false;
}
- void add (PropertyID id) { insert (id); }
- void add (const PropertyChange& other) { insert (other.begin (), other.end ()); }
+ LIBPBD_API void add (PropertyID id) { insert (id); }
+ LIBPBD_API void add (const PropertyChange& other) { insert (other.begin (), other.end ()); }
template<typename T> void add (PropertyDescriptor<T> p);
};
diff --git a/libs/pbd/pbd/pthread_utils.h b/libs/pbd/pbd/pthread_utils.h
index c66feb73a5..37ce723715 100644
--- a/libs/pbd/pbd/pthread_utils.h
+++ b/libs/pbd/pbd/pthread_utils.h
@@ -20,7 +20,11 @@
#ifndef __pbd_pthread_utils__
#define __pbd_pthread_utils__
+#ifdef COMPILER_MSVC
+#include <ardourext/pthread.h>
+#else
#include <pthread.h>
+#endif
#include <signal.h>
#include <string>
#include <stdint.h>
diff --git a/libs/pbd/pbd/rcu.h b/libs/pbd/pbd/rcu.h
index 6ee68afabf..eceec24cd5 100644
--- a/libs/pbd/pbd/rcu.h
+++ b/libs/pbd/pbd/rcu.h
@@ -45,7 +45,7 @@
and managed object.
*/
template<class T>
-class LIBPBD_API RCUManager
+class /*LIBPBD_API*/ RCUManager
{
public:
@@ -111,7 +111,7 @@ class LIBPBD_API RCUManager
means that no actual objects will be deleted incorrectly if this is misused.
*/
template<class T>
-class LIBPBD_API SerializedRCUManager : public RCUManager<T>
+class /*LIBPBD_API*/ SerializedRCUManager : public RCUManager<T>
{
public:
@@ -214,7 +214,7 @@ private:
*/
template<class T>
-class LIBPBD_API RCUWriter
+class /*LIBPBD_API*/ RCUWriter
{
public:
diff --git a/libs/pbd/pbd/resource.h b/libs/pbd/pbd/resource.h
new file mode 100644
index 0000000000..ec826e4930
--- /dev/null
+++ b/libs/pbd/pbd/resource.h
@@ -0,0 +1,49 @@
+/*
+ Copyright (C) 2011 Tim Mayberry
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdint.h>
+
+namespace PBD {
+
+typedef uint64_t rlimit_t;
+
+enum ResourceType {
+ OpenFiles
+};
+
+struct ResourceLimit
+{
+ rlimit_t current_limit;
+ rlimit_t max_limit;
+};
+
+/**
+ * @return true on success, false on error
+ */
+bool
+get_resource_limit (ResourceType resource, ResourceLimit& limit);
+
+/**
+ * @return true on success, false on error
+ */
+bool
+set_resource_limit (ResourceType resource, const ResourceLimit& limit);
+
+
+} // namespace PBD
diff --git a/libs/pbd/pbd/ringbuffer.h b/libs/pbd/pbd/ringbuffer.h
index bb2b8244f9..e3cec6adf1 100644
--- a/libs/pbd/pbd/ringbuffer.h
+++ b/libs/pbd/pbd/ringbuffer.h
@@ -26,7 +26,7 @@
#include "pbd/libpbd_visibility.h"
template<class T>
-class LIBPBD_API RingBuffer
+class /*LIBPBD_API*/ RingBuffer
{
public:
RingBuffer (guint sz) {
@@ -120,7 +120,7 @@ class LIBPBD_API RingBuffer
guint size_mask;
};
-template<class T> LIBPBD_API guint
+template<class T> /*LIBPBD_API*/ guint
RingBuffer<T>::read (T *dest, guint cnt)
{
guint free_cnt;
@@ -159,7 +159,7 @@ RingBuffer<T>::read (T *dest, guint cnt)
return to_read;
}
-template<class T> LIBPBD_API guint
+template<class T> /*LIBPBD_API*/ guint
RingBuffer<T>::write (T const *src, guint cnt)
{
@@ -199,8 +199,8 @@ RingBuffer<T>::write (T const *src, guint cnt)
return to_write;
}
-template<class T> LIBPBD_API void
-RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
+template<class T> /*LIBPBD_API*/ void
+RingBuffer<T>::get_read_vector (typename RingBuffer<T>::rw_vector *vec)
{
guint free_cnt;
@@ -240,8 +240,8 @@ RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
}
}
-template<class T> LIBPBD_API void
-RingBuffer<T>::get_write_vector (RingBuffer<T>::rw_vector *vec)
+template<class T> /*LIBPBD_API*/ void
+RingBuffer<T>::get_write_vector (typename RingBuffer<T>::rw_vector *vec)
{
guint free_cnt;
diff --git a/libs/pbd/pbd/ringbufferNPT.h b/libs/pbd/pbd/ringbufferNPT.h
index 65fe939597..cd17299961 100644
--- a/libs/pbd/pbd/ringbufferNPT.h
+++ b/libs/pbd/pbd/ringbufferNPT.h
@@ -32,7 +32,7 @@ namespace PBD {
/* ringbuffer class where the element size is not required to be a power of two */
template<class T>
-class LIBPBD_API RingBufferNPT
+class /*LIBPBD_API*/ RingBufferNPT
{
public:
RingBufferNPT (size_t sz) {
@@ -120,7 +120,7 @@ class LIBPBD_API RingBufferNPT
mutable gint read_ptr;
};
-template<class T> LIBPBD_API size_t
+template<class T> /*LIBPBD_API*/ size_t
RingBufferNPT<T>::read (T *dest, size_t cnt)
{
size_t free_cnt;
@@ -159,7 +159,7 @@ RingBufferNPT<T>::read (T *dest, size_t cnt)
return to_read;
}
-template<class T> LIBPBD_API size_t
+template<class T> /*LIBPBD_API*/ size_t
RingBufferNPT<T>::write (const T *src, size_t cnt)
{
size_t free_cnt;
@@ -198,8 +198,8 @@ RingBufferNPT<T>::write (const T *src, size_t cnt)
return to_write;
}
-template<class T> LIBPBD_API void
-RingBufferNPT<T>::get_read_vector (RingBufferNPT<T>::rw_vector *vec)
+template<class T> /*LIBPBD_API*/ void
+RingBufferNPT<T>::get_read_vector (typename RingBufferNPT<T>::rw_vector *vec)
{
size_t free_cnt;
size_t cnt2;
@@ -238,8 +238,8 @@ RingBufferNPT<T>::get_read_vector (RingBufferNPT<T>::rw_vector *vec)
}
}
-template<class T> LIBPBD_API void
-RingBufferNPT<T>::get_write_vector (RingBufferNPT<T>::rw_vector *vec)
+template<class T> /*LIBPBD_API*/ void
+RingBufferNPT<T>::get_write_vector (typename RingBufferNPT<T>::rw_vector *vec)
{
size_t free_cnt;
size_t cnt2;
diff --git a/libs/pbd/pbd/search_path.h b/libs/pbd/pbd/search_path.h
index ad0b6c75d5..909bffb0a4 100644
--- a/libs/pbd/pbd/search_path.h
+++ b/libs/pbd/pbd/search_path.h
@@ -17,8 +17,8 @@
*/
-#ifndef PBD_SEARCH_PATH_INCLUDED
-#define PBD_SEARCH_PATH_INCLUDED
+#ifndef __libpbd_search_path_h__
+#define __libpbd_search_path_h__
#include <string>
#include <vector>
@@ -28,26 +28,26 @@
namespace PBD {
/**
- * @class SearchPath
+ * @class Searchpath
*
- * The SearchPath class is a helper class for getting a
+ * The Searchpath class is a helper class for getting a
* vector of paths contained in a search path string where a
* "search path string" contains absolute directory paths
* separated by a colon(:) or a semi-colon(;) on windows.
*
- * The SearchPath class does not test whether the paths exist
+ * The Searchpath class does not test whether the paths exist
* or are directories. It is basically just a container.
*/
-class LIBPBD_API SearchPath : public std::vector<std::string>
+class /*LIBPBD_API*/ Searchpath : public std::vector<std::string>
{
public:
/**
- * Create an empty SearchPath.
+ * Create an empty Searchpath.
*/
- SearchPath ();
+ LIBPBD_API Searchpath ();
/**
- * Initialize SearchPath from a string where the string contains
+ * Initialize Searchpath from a string where the string contains
* one or more absolute paths to directories which are delimited
* by a path separation character. The path delimeter is a
* colon(:) on unix and a semi-colon(;) on windows.
@@ -57,15 +57,17 @@ public:
*
* @param search_path A path string.
*/
- SearchPath (const std::string& search_path);
+ LIBPBD_API Searchpath (const std::string& search_path);
/**
- * Initialize SearchPath from a vector of paths that may or may
+ * Initialize Searchpath from a vector of paths that may or may
* not exist.
*
* @param paths A vector of paths.
*/
- SearchPath (const std::vector<std::string>& paths);
+ LIBPBD_API Searchpath (const std::vector<std::string>& paths);
+
+ LIBPBD_API ~Searchpath () {};
/**
* @return a search path string.
@@ -73,41 +75,41 @@ public:
* The string that is returned contains the platform specific
* path separator.
*/
- const std::string to_string () const;
+ LIBPBD_API const std::string to_string () const;
/**
* Add all the directories in path to this.
*/
- SearchPath& operator+= (const SearchPath& spath);
+ LIBPBD_API Searchpath& operator+= (const Searchpath& spath);
/**
* Add another directory path to the search path.
*/
- SearchPath& operator+= (const std::string& directory_path);
+ LIBPBD_API Searchpath& operator+= (const std::string& directory_path);
/**
- * Concatenate another SearchPath onto this.
+ * Concatenate another Searchpath onto this.
*/
- SearchPath& operator+ (const SearchPath& other);
+ LIBPBD_API Searchpath& operator+ (const Searchpath& other);
/**
* Add another path to the search path.
*/
- SearchPath& operator+ (const std::string& directory_path);
+ LIBPBD_API Searchpath& operator+ (const std::string& directory_path);
/**
* Add a sub-directory to each path in the search path.
* @param subdir The directory name, it should not contain
* any path separating tokens.
*/
- SearchPath& add_subdirectory_to_paths (const std::string& subdir);
+ LIBPBD_API Searchpath& add_subdirectory_to_paths (const std::string& subdir);
protected:
- void add_directory (const std::string& directory_path);
- void add_directories (const std::vector<std::string>& paths);
+ LIBPBD_API void add_directory (const std::string& directory_path);
+ LIBPBD_API void add_directories (const std::vector<std::string>& paths);
};
} // namespace PBD
-#endif
+#endif /* __libpbd_search_path_h__ */
diff --git a/libs/pbd/pbd/semaphore.h b/libs/pbd/pbd/semaphore.h
index a2390f5a18..265a219e07 100644
--- a/libs/pbd/pbd/semaphore.h
+++ b/libs/pbd/pbd/semaphore.h
@@ -22,8 +22,11 @@
#ifdef __APPLE__
# include <mach/mach.h>
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
# include <windows.h>
+#ifndef INFINITE
+#define INFINITE 0xffffffffL
+#endif
#else
# include <semaphore.h>
# include <errno.h>
@@ -46,7 +49,7 @@ namespace PBD {
only safe way to reliably signal from a real-time audio thread. The
counting semantics also complement ringbuffers of events nicely.
*/
-class LIBPBD_API Semaphore
+class /*LIBPBD_API*/ Semaphore
{
public:
/**
@@ -70,7 +73,7 @@ public:
private:
#if defined(__APPLE__)
semaphore_t _sem; // sem_t is a worthless broken mess on OSX
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
HANDLE _sem; // types are overrated anyway
#else
sem_t _sem;
@@ -115,7 +118,7 @@ Semaphore::try_wait()
return semaphore_timedwait(_sem, zero) == KERN_SUCCESS;
}
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
inline
Semaphore::Semaphore(unsigned initial)
@@ -152,7 +155,7 @@ Semaphore::try_wait()
return WaitForSingleObject(_sem, 0) == WAIT_OBJECT_0;
}
-#else /* !defined(__APPLE__) && !defined(_WIN32) */
+#else /* !defined(__APPLE__) && !defined(PLATFORM_WINDOWS) */
Semaphore::Semaphore(unsigned initial)
{
diff --git a/libs/pbd/pbd/semutils.h b/libs/pbd/pbd/semutils.h
index 719a3d0f46..5c0191e25b 100644
--- a/libs/pbd/pbd/semutils.h
+++ b/libs/pbd/pbd/semutils.h
@@ -19,7 +19,11 @@
#ifndef __pbd_semutils_h__
#define __pbd_semutils_h__
+#ifdef PLATFORM_WINDOWS
+#include <windows.h>
+#else
#include <semaphore.h>
+#endif
#include "pbd/libpbd_visibility.h"
@@ -27,7 +31,10 @@ namespace PBD {
class LIBPBD_API ProcessSemaphore {
private:
-#ifdef __APPLE__
+#ifdef PLATFORM_WINDOWS
+ HANDLE _sem;
+
+#elif __APPLE__
sem_t* _sem;
sem_t* ptr_to_sem() const { return _sem; }
#else
@@ -39,8 +46,15 @@ class LIBPBD_API ProcessSemaphore {
ProcessSemaphore (const char* name, int val);
~ProcessSemaphore ();
+#ifdef PLATFORM_WINDOWS
+
+ int signal ();
+ int wait ();
+
+#else
int signal () { return sem_post (ptr_to_sem()); }
int wait () { return sem_wait (ptr_to_sem()); }
+#endif
};
}
diff --git a/libs/pbd/pbd/sequence_property.h b/libs/pbd/pbd/sequence_property.h
index 28775b5f3c..e105e82e47 100644
--- a/libs/pbd/pbd/sequence_property.h
+++ b/libs/pbd/pbd/sequence_property.h
@@ -44,7 +44,7 @@ namespace PBD {
* any change.
*/
template<typename Container>
-class LIBPBD_API SequenceProperty : public PropertyBase
+class /*LIBPBD_API*/ SequenceProperty : public PropertyBase
{
public:
typedef std::set<typename Container::value_type> ChangeContainer;
@@ -95,14 +95,14 @@ class LIBPBD_API SequenceProperty : public PropertyBase
/* record the change described in our change member */
if (!_changes.added.empty()) {
- for (typename ChangeContainer::iterator i = _changes.added.begin(); i != _changes.added.end(); ++i) {
+ for (typename ChangeContainer::const_iterator i = _changes.added.begin(); i != _changes.added.end(); ++i) {
XMLNode* add_node = new XMLNode ("Add");
child->add_child_nocopy (*add_node);
get_content_as_xml (*i, *add_node);
}
}
if (!_changes.removed.empty()) {
- for (typename ChangeContainer::iterator i = _changes.removed.begin(); i != _changes.removed.end(); ++i) {
+ for (typename ChangeContainer::const_iterator i = _changes.removed.begin(); i != _changes.removed.end(); ++i) {
XMLNode* remove_node = new XMLNode ("Remove");
child->add_child_nocopy (*remove_node);
get_content_as_xml (*i, *remove_node);
@@ -171,7 +171,7 @@ class LIBPBD_API SequenceProperty : public PropertyBase
with this diff().
*/
- for (typename ChangeContainer::iterator i = a->changes().added.begin(); i != a->changes().added.end(); ++i) {
+ for (typename ChangeContainer::const_iterator i = a->changes().added.begin(); i != a->changes().added.end(); ++i) {
(*i)->DropReferences.connect_same_thread (*cmd, boost::bind (&Destructible::drop_references, cmd));
}
}
@@ -311,10 +311,10 @@ class LIBPBD_API SequenceProperty : public PropertyBase
}
Container& operator= (const Container& other) {
- for (typename Container::iterator i = _val.begin(); i != _val.end(); ++i) {
+ for (typename Container::const_iterator i = _val.begin(); i != _val.end(); ++i) {
_changes.remove (*i);
}
- for (typename Container::iterator i = other.begin(); i != other.end(); ++i) {
+ for (typename Container::const_iterator i = other.begin(); i != other.end(); ++i) {
_changes.add (*i);
}
return _val = other;
diff --git a/libs/pbd/pbd/signals.h b/libs/pbd/pbd/signals.h
index 3896fd55b5..672dc66850 100644
--- a/libs/pbd/pbd/signals.h
+++ b/libs/pbd/pbd/signals.h
@@ -79,7 +79,7 @@ private:
};
template<typename R>
-class LIBPBD_API OptionalLastValue
+class /*LIBPBD_API*/ OptionalLastValue
{
public:
typedef boost::optional<R> result_type;
diff --git a/libs/pbd/pbd/stacktrace.h b/libs/pbd/pbd/stacktrace.h
index fbb92c8fa0..c5d9743b1e 100644
--- a/libs/pbd/pbd/stacktrace.h
+++ b/libs/pbd/pbd/stacktrace.h
@@ -44,7 +44,7 @@ namespace PBD {
LIBPBD_API std::string demangle (const std::string&);
template<typename T>
-class LIBPBD_API thing_with_backtrace
+class /*LIBPBD_API*/ thing_with_backtrace
{
public:
thing_with_backtrace () {
@@ -113,11 +113,11 @@ private:
static Glib::Threads::Mutex all_mutex;
};
-template<typename T> LIBPBD_API std::list<PBD::thing_with_backtrace<T> *> PBD::thing_with_backtrace<T>::all;
-template<typename T> LIBPBD_API Glib::Threads::Mutex PBD::thing_with_backtrace<T>::all_mutex;
+template<typename T> /*LIBPBD_API*/ std::list<PBD::thing_with_backtrace<T> *> PBD::thing_with_backtrace<T>::all;
+template<typename T> /*LIBPBD_API*/ Glib::Threads::Mutex PBD::thing_with_backtrace<T>::all_mutex;
} // namespace PBD
-
+// JE - !!!!#include "../pbd/stacktrace.impl"
#endif /* __libpbd_stacktrace_h__ */
diff --git a/libs/pbd/pbd/stl_delete.h b/libs/pbd/pbd/stl_delete.h
index b98bb5e8e3..1598a90e2c 100644
--- a/libs/pbd/pbd/stl_delete.h
+++ b/libs/pbd/pbd/stl_delete.h
@@ -26,7 +26,7 @@
first include the revelant container type header.
*/
#if defined(_CPP_VECTOR) || defined(_GLIBCXX_VECTOR) || defined(__SGI_STL_VECTOR) || defined(_LIBCPP_VECTOR)
-template<class T> LIBPBD_API void vector_delete (std::vector<T *> *vec)
+template<class T> /*LIBPBD_API*/ void vector_delete (std::vector<T *> *vec)
{
typename std::vector<T *>::iterator i;
@@ -38,7 +38,7 @@ template<class T> LIBPBD_API void vector_delete (std::vector<T *> *vec)
#endif // _CPP_VECTOR || _GLIBCXX_VECTOR || __SGI_STL_VECTOR || _LIBCPP_VECTOR
#if defined(_CPP_MAP) || defined(_GLIBCXX_MAP) || defined(__SGI_STL_MAP)
-template<class K, class T> LIBPBD_API void map_delete (std::map<K, T *> *m)
+template<class K, class T> /*LIBPBD_API*/ void map_delete (std::map<K, T *> *m)
{
typename std::map<K, T *>::iterator i;
@@ -50,7 +50,7 @@ template<class K, class T> LIBPBD_API void map_delete (std::map<K, T *> *m)
#endif // _CPP_MAP || _GLIBCXX_MAP || __SGI_STL_MAP
#if defined(_CPP_LIST) || defined(_GLIBCXX_LIST) || defined(__SGI_STL_LIST)
-template<class T> LIBPBD_API void list_delete (std::list<T *> *l)
+template<class T> /*LIBPBD_API*/ void list_delete (std::list<T *> *l)
{
typename std::list<T *>::iterator i;
@@ -63,7 +63,7 @@ template<class T> LIBPBD_API void list_delete (std::list<T *> *l)
#endif // _CPP_LIST || _GLIBCXX_LIST || __SGI_STL_LIST
#if defined(_CPP_SLIST) || defined(_GLIBCXX_SLIST) || defined(__SGI_STL_SLIST)
-template<class T> LIBPBD_API void slist_delete (std::slist<T *> *l)
+template<class T> /*LIBPBD_API*/ void slist_delete (std::slist<T *> *l)
{
typename std::slist<T *>::iterator i;
@@ -76,7 +76,7 @@ template<class T> LIBPBD_API void slist_delete (std::slist<T *> *l)
#endif // _CPP_SLIST || _GLIBCXX_SLIST || __SGI_STL_SLIST
#if defined(_CPP_SET) || defined(_GLIBCXX_SET) || defined(__SGI_STL_SET)
-template<class T> void LIBPBD_API set_delete (std::set<T *> *sset)
+template<class T> void /*LIBPBD_API*/ set_delete (std::set<T *> *sset)
{
typename std::set<T *>::iterator i;
diff --git a/libs/pbd/pbd/timersub.h b/libs/pbd/pbd/timersub.h
new file mode 100644
index 0000000000..6cb152414c
--- /dev/null
+++ b/libs/pbd/pbd/timersub.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991-1994,1996-2003,2005,2006,2009
+ Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+
+#ifndef timersub
+# define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif
+
diff --git a/libs/pbd/pbd/tokenizer.h b/libs/pbd/pbd/tokenizer.h
index b4b3b107c0..3253473519 100644
--- a/libs/pbd/pbd/tokenizer.h
+++ b/libs/pbd/pbd/tokenizer.h
@@ -37,7 +37,7 @@ namespace PBD {
are discarded.
*/
template<typename StringType, typename Iter>
-LIBPBD_API unsigned int
+/*LIBPBD_API*/ unsigned int
tokenize(const StringType& str,
const StringType& delims,
Iter it,
diff --git a/libs/pbd/pbd/touchable.h b/libs/pbd/pbd/touchable.h
index ed7d75df52..297be8b0f1 100644
--- a/libs/pbd/pbd/touchable.h
+++ b/libs/pbd/pbd/touchable.h
@@ -21,7 +21,7 @@
#include "pbd/libpbd_visibility.h"
-class LIBPBD_API Touchable
+class /*LIBPBD_API*/ Touchable
{
public:
Touchable() : _delete_after_touch (false) {}
@@ -37,7 +37,7 @@ class LIBPBD_API Touchable
};
template<class T>
-class LIBPBD_API DynamicTouchable : public Touchable
+class /*LIBPBD_API*/ DynamicTouchable : public Touchable
{
public:
DynamicTouchable (T& t, void (T::*m)(void))
@@ -53,7 +53,7 @@ class LIBPBD_API DynamicTouchable : public Touchable
};
template<class T1, class T2>
-class LIBPBD_API DynamicTouchable1 : public Touchable
+class /*LIBPBD_API*/ DynamicTouchable1 : public Touchable
{
public:
DynamicTouchable1 (T1& t, void (T1::*m)(T2), T2 a)
@@ -70,7 +70,7 @@ class LIBPBD_API DynamicTouchable1 : public Touchable
};
template<class T1, class T2, class T3>
-class LIBPBD_API DynamicTouchable2 : public Touchable
+class /*LIBPBD_API*/ DynamicTouchable2 : public Touchable
{
public:
DynamicTouchable2 (T1& t, void (T1::*m)(T2, T3), T2 a1, T3 a2)
diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h
index 753bc13b15..794e68ce97 100644
--- a/libs/pbd/pbd/undo.h
+++ b/libs/pbd/pbd/undo.h
@@ -25,7 +25,11 @@
#include <map>
#include <sigc++/slot.h>
#include <sigc++/bind.h>
+#ifndef COMPILER_MSVC
#include <sys/time.h>
+#else
+#include <ardourext/misc.h>
+#endif
#include "pbd/libpbd_visibility.h"
#include "pbd/command.h"
diff --git a/libs/pbd/pbd/unknown_type.h b/libs/pbd/pbd/unknown_type.h
index 4d984269a7..ef9db1ac43 100644
--- a/libs/pbd/pbd/unknown_type.h
+++ b/libs/pbd/pbd/unknown_type.h
@@ -22,9 +22,9 @@
#include <exception>
-#include "pbd/libpbd_visibility.h"
+//#include "pbd/libpbd_visibility.h"
-class LIBPBD_API unknown_type : public std::exception {
+class /*LIBPBD_API*/ unknown_type : public std::exception {
public:
virtual const char *what() const throw() { return "unknown type"; }
};
diff --git a/libs/pbd/pbd/unwind.h b/libs/pbd/pbd/unwind.h
index cf7998fdd4..5a0fe26559 100644
--- a/libs/pbd/pbd/unwind.h
+++ b/libs/pbd/pbd/unwind.h
@@ -25,7 +25,7 @@
namespace PBD {
template <typename T>
-class LIBPBD_API Unwinder {
+class /*LIBPBD_API*/ Unwinder {
public:
Unwinder (T& var, T new_val) : _var (var), _old_val (var) { var = new_val; }
~Unwinder () { _var = _old_val; }
diff --git a/libs/pbd/pbd/uuid.h b/libs/pbd/pbd/uuid.h
index 333a902b4d..77e84c5f09 100644
--- a/libs/pbd/pbd/uuid.h
+++ b/libs/pbd/pbd/uuid.h
@@ -22,31 +22,37 @@
#define __pbd_uuid_h__
#include <string>
-#include <uuid/uuid.h>
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_generators.hpp>
#include "pbd/libpbd_visibility.h"
namespace PBD {
-class LIBPBD_API UUID {
+class LIBPBD_API UUID : public boost::uuids::uuid {
public:
- UUID () { uuid_generate (id); }
- UUID (UUID const & other) { uuid_copy (id, other.id); }
- UUID (std::string const & str) { uuid_parse (str.c_str(), id); }
-
- UUID& operator= (std::string const & str);
- std::string to_s () const;
-
- bool operator== (UUID const & other) const { return !uuid_compare (id, other.id); }
- bool operator!= (UUID const & other) const { return uuid_compare (id, other.id); }
- bool operator< (UUID const & other) const { return uuid_compare (id, other.id) < 0; }
-
- operator bool() const { return !uuid_is_null (id); }
-
- private:
- uuid_t id;
+ UUID ()
+ : boost::uuids::uuid (boost::uuids::random_generator()()) {}
+ UUID (std::string const & str)
+ : boost::uuids::uuid (boost::uuids::string_generator()(str)) {}
+ explicit UUID (boost::uuids::uuid const& u)
+ : boost::uuids::uuid(u)
+ {}
+
+ operator boost::uuids::uuid() {
+ return static_cast<boost::uuids::uuid&>(*this);
+ }
+
+ operator boost::uuids::uuid() const {
+ return static_cast<boost::uuids::uuid const&>(*this);
+ }
+
+ UUID& operator= (std::string const & str);
+ std::string to_s () const;
+
+ operator bool() const { return !is_nil(); }
};
} // namespace PBD