Remaining changes needed for building libpdb on Windows (except for adding the extra JE source modules)

This commit is contained in:
John Emmas 2013-07-17 08:08:46 +01:00
parent 105652ad09
commit 350ed31655
15 changed files with 40 additions and 34 deletions

View file

@ -51,13 +51,13 @@ BaseUI::BaseUI (const string& str)
: m_context(MainContext::get_default()) : m_context(MainContext::get_default())
, run_loop_thread (0) , run_loop_thread (0)
, _name (str) , _name (str)
#ifndef WIN32 #ifndef PLATFORM_WINDOWS
, request_channel (true) , request_channel (true)
#endif #endif
{ {
base_ui_instance = this; base_ui_instance = this;
#ifndef WIN32 #ifndef PLATFORM_WINDOWS
request_channel.ios()->connect (sigc::mem_fun (*this, &BaseUI::request_handler)); request_channel.ios()->connect (sigc::mem_fun (*this, &BaseUI::request_handler));
#endif #endif
@ -124,7 +124,7 @@ BaseUI::quit ()
} }
} }
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
gboolean gboolean
BaseUI::_request_handler (gpointer data) BaseUI::_request_handler (gpointer data)
{ {
@ -172,7 +172,7 @@ void
BaseUI::signal_new_request () BaseUI::signal_new_request ()
{ {
DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::signal_new_request\n"); DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::signal_new_request\n");
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
// handled in timeout, how to signal...? // handled in timeout, how to signal...?
#else #else
request_channel.wakeup (); request_channel.wakeup ();
@ -186,7 +186,7 @@ void
BaseUI::attach_request_source () BaseUI::attach_request_source ()
{ {
DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::attach_request_source\n"); DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::attach_request_source\n");
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
GSource* request_source = g_timeout_source_new(200); GSource* request_source = g_timeout_source_new(200);
g_source_set_callback (request_source, &BaseUI::_request_handler, this, NULL); g_source_set_callback (request_source, &BaseUI::_request_handler, this, NULL);
g_source_attach (request_source, m_context->gobj()); g_source_attach (request_source, m_context->gobj());

View file

@ -192,9 +192,9 @@ get_absolute_path (const std::string & p)
bool bool
equivalent_paths (const std::string& a, const std::string& b) equivalent_paths (const std::string& a, const std::string& b)
{ {
struct stat bA; GStatBuf bA;
int const rA = g_stat (a.c_str(), &bA); int const rA = g_stat (a.c_str(), &bA);
struct stat bB; GStatBuf bB;
int const rB = g_stat (b.c_str(), &bB); int const rB = g_stat (b.c_str(), &bB);
return (rA == 0 && rB == 0 && bA.st_dev == bB.st_dev && bA.st_ino == bB.st_ino); return (rA == 0 && rB == 0 && bA.st_dev == bB.st_dev && bA.st_ino == bB.st_ino);
@ -225,7 +225,7 @@ exists_and_writable (const std::string & p)
make us unwritable. make us unwritable.
*/ */
struct stat statbuf; GStatBuf statbuf;
if (g_stat (p.c_str(), &statbuf) != 0) { if (g_stat (p.c_str(), &statbuf) != 0) {
/* doesn't exist - not writable */ /* doesn't exist - not writable */

View file

@ -94,7 +94,7 @@ mountpoint (string path)
return best; return best;
} }
#elif defined(WIN32) #elif defined(PLATFORM_WINDOWS)
string string
mountpoint (string path) mountpoint (string path)

View file

@ -92,7 +92,7 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
virtual void thread_init () {}; virtual void thread_init () {};
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
static gboolean _request_handler (gpointer); static gboolean _request_handler (gpointer);
bool request_handler (); bool request_handler ();
#else #else
@ -114,7 +114,7 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
std::string _name; std::string _name;
BaseUI* base_ui_instance; BaseUI* base_ui_instance;
#ifndef WIN32 #ifndef PLATFORM_WINDOWS
CrossThreadChannel request_channel; CrossThreadChannel request_channel;
#endif #endif

View file

@ -198,7 +198,7 @@ RingBuffer<T>::write (T const *src, guint cnt)
} }
template<class T> void template<class T> void
RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec) RingBuffer<T>::get_read_vector (typename RingBuffer<T>::rw_vector *vec)
{ {
guint free_cnt; guint free_cnt;
@ -238,7 +238,7 @@ RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
} }
template<class T> void template<class T> void
RingBuffer<T>::get_write_vector (RingBuffer<T>::rw_vector *vec) RingBuffer<T>::get_write_vector (typename RingBuffer<T>::rw_vector *vec)
{ {
guint free_cnt; guint free_cnt;

View file

@ -69,7 +69,7 @@ public:
private: private:
#if defined(__APPLE__) #if defined(__APPLE__)
semaphore_t _sem; // sem_t is a worthless broken mess on OSX 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 HANDLE _sem; // types are overrated anyway
#else #else
sem_t _sem; sem_t _sem;
@ -114,7 +114,7 @@ Semaphore::try_wait()
return semaphore_timedwait(_sem, zero) == KERN_SUCCESS; return semaphore_timedwait(_sem, zero) == KERN_SUCCESS;
} }
#elif defined(_WIN32) #elif defined(PLATFORM_WINDOWS)
inline inline
Semaphore::Semaphore(unsigned initial) Semaphore::Semaphore(unsigned initial)
@ -151,7 +151,7 @@ Semaphore::try_wait()
return WaitForSingleObject(_sem, 0) == WAIT_OBJECT_0; return WaitForSingleObject(_sem, 0) == WAIT_OBJECT_0;
} }
#else /* !defined(__APPLE__) && !defined(_WIN32) */ #else /* !defined(__APPLE__) && !defined(PLATFORM_WINDOWS) */
Semaphore::Semaphore(unsigned initial) Semaphore::Semaphore(unsigned initial)
{ {

View file

@ -19,7 +19,7 @@
#ifndef __pbd_semutils_h__ #ifndef __pbd_semutils_h__
#define __pbd_semutils_h__ #define __pbd_semutils_h__
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
#include <windows.h> #include <windows.h>
#else #else
#include <semaphore.h> #include <semaphore.h>
@ -29,7 +29,7 @@ namespace PBD {
class ProcessSemaphore { class ProcessSemaphore {
private: private:
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
HANDLE _sem; HANDLE _sem;
#elif __APPLE__ #elif __APPLE__
@ -44,7 +44,7 @@ class ProcessSemaphore {
ProcessSemaphore (const char* name, int val); ProcessSemaphore (const char* name, int val);
~ProcessSemaphore (); ~ProcessSemaphore ();
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
int signal (); int signal ();
int wait (); int wait ();

View file

@ -33,7 +33,7 @@ get_resource_limit (ResourceType resource, ResourceLimit& limit)
{ {
if (resource == OpenFiles) if (resource == OpenFiles)
{ {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
limit.current_limit = _getmaxstdio(); limit.current_limit = _getmaxstdio();
limit.max_limit = 2048; limit.max_limit = 2048;
return true; return true;
@ -55,7 +55,7 @@ set_resource_limit (ResourceType resource, const ResourceLimit& limit)
{ {
if (resource == OpenFiles) if (resource == OpenFiles)
{ {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
// no soft and hard limits on windows // no soft and hard limits on windows
rlimit_t new_max = _setmaxstdio(limit.current_limit); rlimit_t new_max = _setmaxstdio(limit.current_limit);

View file

@ -27,7 +27,7 @@ using namespace std;
namespace { namespace {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
const char * const path_delimiter = ";"; const char * const path_delimiter = ";";
#else #else
const char * const path_delimiter = ":"; const char * const path_delimiter = ":";

View file

@ -23,7 +23,7 @@ using namespace PBD;
ProcessSemaphore::ProcessSemaphore (const char* name, int val) ProcessSemaphore::ProcessSemaphore (const char* name, int val)
{ {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
if ((_sem = CreateSemaphore(NULL, val, 32767, name)) == NULL) { if ((_sem = CreateSemaphore(NULL, val, 32767, name)) == NULL) {
throw failed_constructor (); throw failed_constructor ();
} }
@ -48,14 +48,14 @@ ProcessSemaphore::ProcessSemaphore (const char* name, int val)
ProcessSemaphore::~ProcessSemaphore () ProcessSemaphore::~ProcessSemaphore ()
{ {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
CloseHandle(_sem); CloseHandle(_sem);
#elif __APPLE__ #elif __APPLE__
sem_close (ptr_to_sem()); sem_close (ptr_to_sem());
#endif #endif
} }
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
int int
ProcessSemaphore::signal () ProcessSemaphore::signal ()

View file

@ -10,7 +10,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION (FilesystemTest);
void void
FilesystemTest::testPathIsWithin () FilesystemTest::testPathIsWithin ()
{ {
#ifndef WIN32 #ifndef PLATFORM_WINDOWS
system ("rm -r foo"); system ("rm -r foo");
CPPUNIT_ASSERT (g_mkdir_with_parents ("foo/bar/baz", 0755) == 0); CPPUNIT_ASSERT (g_mkdir_with_parents ("foo/bar/baz", 0755) == 0);

View file

@ -28,7 +28,7 @@
PBD::SearchPath PBD::SearchPath
test_search_path () test_search_path ()
{ {
#ifdef WIN32 #ifdef PLATFORM_WINDOWS
std::string wsp(g_win32_get_package_installation_directory_of_module(NULL)); std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
return Glib::build_filename (wsp, "pbd_testdata"); return Glib::build_filename (wsp, "pbd_testdata");
#else #else

View file

@ -84,14 +84,20 @@ Transmitter::deliver ()
/* do the right thing if this should not return */ /* do the right thing if this should not return */
if (does_not_return()) { if (does_not_return()) {
#ifndef WIN32 #ifndef PLATFORM_WINDOWS
// TODO !!!! Commented out temporarily (for Windows)
sigset_t mask; sigset_t mask;
sigemptyset (&mask); sigemptyset (&mask);
sigsuspend (&mask); sigsuspend (&mask);
#endif
/*NOTREACHED*/ /*NOTREACHED*/
exit (1); exit (1);
/* JE - From what I can tell, the above code suspends
* program execution until (any) signal occurs. Not
* sure at the moment what this achieves, unless it
* provides some time for the user to see the message.
*/
#endif
} }
} }

View file

@ -20,10 +20,8 @@
#include "pbd/uuid.h" #include "pbd/uuid.h"
using namespace PBD; PBD::UUID&
PBD::UUID::operator= (std::string const & str)
UUID&
UUID::operator= (std::string const & str)
{ {
boost::uuids::string_generator gen; boost::uuids::string_generator gen;
*((boost::uuids::uuid*) this) = gen (str); *((boost::uuids::uuid*) this) = gen (str);
@ -31,7 +29,7 @@ UUID::operator= (std::string const & str)
} }
std::string std::string
UUID::to_s () const PBD::UUID::to_s () const
{ {
return std::string ((const char*) data, size()); return std::string ((const char*) data, size());
} }

View file

@ -167,6 +167,7 @@ XMLTree::write() const
void void
XMLTree::debug(FILE* out) const XMLTree::debug(FILE* out) const
{ {
#ifdef LIBXML_DEBUG_ENABLED
xmlDocPtr doc; xmlDocPtr doc;
XMLNodeList children; XMLNodeList children;
@ -176,6 +177,7 @@ XMLTree::debug(FILE* out) const
writenode(doc, _root, doc->children, 1); writenode(doc, _root, doc->children, 1);
xmlDebugDumpDocument (out, doc); xmlDebugDumpDocument (out, doc);
xmlFreeDoc(doc); xmlFreeDoc(doc);
#endif
} }
const string& const string&