Index: Makefile.am
===================================================================
--- Makefile.am	(revision 4)
+++ Makefile.am	(revision 40)
@@ -1,3 +1,4 @@
-SUBDIRS=src test
+SUBDIRS=src
+ACLOCAL_AMFLAGS=-I m4
 
 pkgconfigdir=$(libdir)/pkgconfig
Index: bootstrap.sh
===================================================================
--- bootstrap.sh	(revision 40)
+++ bootstrap.sh	(revision 40)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+scriptdir=`dirname $0`
+
+cd "${scriptdir}"
+
+libtoolize
+aclocal -I m4
+automake -a
+autoconf
Index: configure.ac
===================================================================
--- configure.ac	(revision 39)
+++ configure.ac	(revision 40)
@@ -7,4 +7,5 @@
 AC_PROG_CC
 AC_PROG_CXX
+AC_CONFIG_MACRO_DIR([m4])
 
 AC_CHECK_HEADERS([windows.h winsock2.h])
@@ -54,10 +55,5 @@
         src/Makefile
         src/xplcommon/Makefile
-        src/xplcommon/posix/Makefile
-        src/xplcommon/win32/Makefile
-        test/Makefile
 ])
 
-AC_CONFIG_HEADERS([src/xplcommon/config.h])
-
 AC_OUTPUT()
Index: c/xplcommon/BlockingStream.cc
===================================================================
--- src/xplcommon/BlockingStream.cc	(revision 31)
+++ 	(revision )
@@ -1,175 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "BlockingStream.h"
-
-#include "ReadingBuffer.h"
-#include "WritingBuffer.h"
-
-#include <cstring>
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::BlockingStream;
-
-using std::min;
-
-//------------------------------------------------------------------------------
-
-inline bool BlockingStream::checkInterrupted()
-{
-    if (!interrupted) {
-        interrupted = event.check();
-        if (!interrupted && event.failed()) {
-            setErrorCode(event.getErrorCode());
-        }
-    }
-
-    return interrupted;
-}
-
-//------------------------------------------------------------------------------
-
-bool BlockingStream::read(void* dest, size_t length)
-{
-    unsigned char* d = reinterpret_cast<unsigned char*>(dest);
-
-    ReadingBuffer& readingBuffer = stream.getReadingBuffer();
-    while (length>0) {
-        size_t copied = readingBuffer.extract(d, length, readingOffset);
-        readingOffset += copied;
-        length -= copied;
-        d += copied;
-
-        if (length!=0) {
-            if (!fill()) return false;
-        }
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool BlockingStream::skip(size_t length)
-{
-    ReadingBuffer& readingBuffer = stream.getReadingBuffer();
-    while (length>0) {
-        size_t toSkip = min(length, readingBuffer.getLength() - readingOffset);
-        readingOffset += toSkip;
-        length -= toSkip;
-
-        if (length!=0) {
-            if (!fill()) return false;
-        }
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool BlockingStream::write(const void* src, size_t length)
-{
-    const unsigned char* s = reinterpret_cast<const unsigned char*>(src);
-
-    WritingBuffer& writingBuffer = stream.getWritingBuffer();
-    while(length>0) {
-        size_t copied = writingBuffer.append(s, length);
-        length -= copied;
-        s += copied;
-
-        if (length==0) break;
-        if (!flush()) return false;
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool BlockingStream::flush()
-{
-    WritingBuffer& writingBuffer = stream.getWritingBuffer();
-    while (*this) {
-        if (checkInterrupted()) return false;
-
-        if (writingBuffer.write()) {
-            return true;
-        } else if (writingBuffer.failed()) {
-            setErrorCode(writingBuffer.getErrorCode());
-        } else {
-            Waiter* waiter = stream.getWaiter();
-            waiter->wait();
-            if (waiter->failed()) {
-                setErrorCode(waiter->getErrorCode());
-            }
-        }
-    }
-    return false;
-}
-
-//------------------------------------------------------------------------------
-
-bool BlockingStream::fill()
-{
-    ReadingBuffer& readingBuffer = stream.getReadingBuffer();
-
-    readingBuffer.reset();
-    readingOffset = 0;
-    while (*this) {
-        if (checkInterrupted()) return false;
-
-        if (readingBuffer.read()) {
-            eof = readingBuffer.isEmpty();
-            return !eof;
-        } else if (readingBuffer.failed()) {
-            setErrorCode(readingBuffer.getErrorCode());
-        } else {
-            Waiter* waiter = stream.getWaiter();
-            waiter->wait();
-            if (waiter->failed()) {
-                setErrorCode(waiter->getErrorCode());
-                return false;
-            }
-        }
-    }
-    return false;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/BlockingStream.h
===================================================================
--- src/xplcommon/BlockingStream.h	(revision 31)
+++ 	(revision )
@@ -1,198 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_BLOCKINGSTREAM_H
-#define XPLCOMMON_BLOCKINGSTREAM_H
-//------------------------------------------------------------------------------
-
-#include "Failable.h"
-
-#include "BufferedStream.h"
-
-#include "Waiter.h"
-#include "WaitableEvent.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * Wrapper for a buffered stream, which an event and provides
- * blocking, but interruptible read() and write() operations.
- *
- * The class is designed in a way, that it expects its constructed
- * instances to be called only from a single thread at a time, except
- * for the interrupt() function, which may be called from another
- * thread anytime.
- */
-class BlockingStream : public Failable
-{
-private:
-    /**
-     * The buffered stream used.
-     */
-    BufferedStream& stream;
-
-    /**
-     * The waitable event.
-     */
-    WaitableEvent event;
-
-    /**
-     * Indicate if we are interrupted.
-     */
-    bool interrupted;
-
-    /**
-     * The offset in the buffer of the reading stream.
-     */
-    size_t readingOffset;
-
-    /**
-     * Indicate if the end-of-file has been reached while reading.
-     */
-    bool eof;
-
-public:
-    /**
-     * Construct the blocking stream for the given buffered stream.
-     *
-     * The stream must have a waiter which is used for waiting.
-     */
-    BlockingStream(BufferedStream& stream);
-
-    /**
-     * Determine if the stream has neither failed nor been
-     * interrupted.
-     */
-    operator bool() const;
-
-    /**
-     * Interrupt the stream. Pending or future read and write calls
-     * will return indicating error. The isInterrupted() function can
-     * be used to check if the stream was interrupted or not.
-     */
-    void interrupt();
-
-    /**
-     * Indicate if the stream is interrupted or not.
-     */
-    bool isInterrupted();
-
-    /**
-     * Read the given number of bytes into the given buffer.
-     *
-     * @return if the reading has succeeded
-     */
-    bool read(void* dest, size_t length);
-
-    /**
-     * Skip the given number of bytes.
-     */
-    bool skip(size_t length);
-
-    /**
-     * Write the given number of bytes from the given buffer. The data
-     * may not be written to the underlying stream fully, so if you
-     * want to make sure that it is sent, call flush() afterwards.
-     *
-     * @return true on success, false on error.
-     */
-    bool write(const void* src, size_t length);
-
-    /**
-     * Flush anything written so far into the buffer, but not to the
-     * underlying stream.
-     *
-     * @return whether the operation has succeeded.
-     */
-    bool flush();
-
-private:
-    /**
-     * Fill the buffer with data from the stream.
-     */
-    bool fill();
-
-    /**
-     * Check for the stream being interrupted.
-     *
-     * @return if the stream is interrupted, false otherwise
-     */
-    bool checkInterrupted();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline BlockingStream::BlockingStream(BufferedStream& stream) :
-    stream(stream),
-    event(stream.getWaiter()),
-    interrupted(false),
-    readingOffset(0),
-    eof(false)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline BlockingStream::operator bool() const
-{
-    return !failed() && !interrupted && !eof;
-}
-
-//------------------------------------------------------------------------------
-
-inline void BlockingStream::interrupt()
-{
-    event.fire();
-}
-
-//------------------------------------------------------------------------------
-
-inline bool BlockingStream::isInterrupted()
-{
-    return interrupted;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_BLOCKINGSTREAM_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/Buffer.h
===================================================================
--- src/xplcommon/Buffer.h	(revision 30)
+++ 	(revision )
@@ -1,242 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_BUFFER_H
-#define XPLCOMMON_BUFFER_H
-//------------------------------------------------------------------------------
-
-#include <algorithm>
-
-#include <cstdlib>
-#include <cstring>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for buffers. It maintains a memory area of a certain
- * capacity and the length of the data in the buffer.
- */
-class Buffer
-{
-private:
-    /**
-     * The data itself.
-     */
-    unsigned char* data;
-
-    /**
-     * The capacity of the buffer.
-     */
-    size_t capacity;
-
-    /**
-     * The amount of data in the buffer.
-     */
-    size_t length;
-
-public:
-    /**
-     * Construct the buffer with the given capacity.
-     */
-    Buffer(size_t capacity);
-
-    /**
-     * Destroy the buffer.
-     */
-    ~Buffer();
-
-    /**
-     * Get the capacity of the buffer.
-     */
-    size_t getCapacity() const;
-
-    /**
-     * Get the pointer to the data.
-     */
-    const unsigned char* getData() const;
-
-    /**
-     * Get the pointer to the data for modification.
-     */
-    unsigned char* getData();
-
-    /**
-     * Get the length of the data.
-     */
-    size_t getLength() const;
-
-    /**
-     * Get whether the buffer is empty or not.
-     */
-    bool isEmpty() const;
-
-    /**
-     * Get the available capacity in the buffer.
-     */
-    size_t getAvailable() const;
-
-    /**
-     * Reset the buffer.
-     */
-    void reset();
-
-    /**
-     * Add the given amount to the length. Should not exceed the
-     * capacity!
-     *
-     * @return the actual amount added.
-     */
-    size_t addLength(size_t n);
-
-    /**
-     * Append the given data to the contents of the given buffer.
-     *
-     * @return the number of bytes actually appended
-     */
-    size_t append(const void* src, size_t size);
-
-    /**
-     * Extract data into the given buffer from the given offset.
-     *
-     * @return the number of bytes actually extracted.
-     */
-    size_t extract(void* dest, size_t size, size_t offset = 0) const;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Buffer::Buffer(size_t capacity) :
-    data(new unsigned char[capacity]),
-    capacity(capacity),
-    length(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Buffer::~Buffer()
-{
-    delete[] data;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Buffer::getCapacity() const
-{
-    return capacity;
-}
-
-//------------------------------------------------------------------------------
-
-inline const unsigned char* Buffer::getData() const
-{
-    return data;
-}
-
-//------------------------------------------------------------------------------
-
-inline unsigned char* Buffer::getData()
-{
-    return data;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Buffer::getLength() const
-{
-    return length;
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Buffer::isEmpty() const
-{
-    return length==0;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Buffer::getAvailable() const
-{
-    return capacity - length;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Buffer::reset()
-{
-    length = 0;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Buffer::addLength(size_t n)
-{
-    size_t toAdd = std::min(n, getAvailable());
-    length += toAdd;
-    return toAdd;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Buffer::append(const void* src, size_t size)
-{
-    size_t toCopy = std::min(size, getAvailable());
-    memcpy(data + length, src, toCopy);
-    length += toCopy;
-    return toCopy;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Buffer::extract(void* dest, size_t size, size_t offset) const
-{
-    size_t toCopy = (offset>=length) ? 0 : std::min(size, length - offset);
-    memcpy(dest, data + offset, toCopy);
-    return toCopy;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_BUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/BufferedStream.h
===================================================================
--- src/xplcommon/BufferedStream.h	(revision 29)
+++ 	(revision )
@@ -1,120 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_BUFFEREDSTREAM_H
-#define XPLCOMMON_BUFFEREDSTREAM_H
-//------------------------------------------------------------------------------
-
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a buffered stream
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for streams on which a waiter can wait and provides a
- * reading and/or a writing buffer.
- */
-class BufferedStream : public Failable
-{
-public:
-    /**
-     * The default buffer capacity.
-     */
-    static const size_t DEFAULT_CAPACITY = 4096;
-
-public:
-    /**
-     * Destroy the buffered stream.
-     */
-    virtual ~BufferedStream();
-
-    /**
-     * Get the reference of the reading buffer. Note, that it can be a
-     * 0 reference, if the stream has no reading buffer.
-     */
-    ReadingBuffer& getReadingBuffer();
-
-    /**
-     * Get the reference of the writing buffer. Note, that it can be a
-     * 0 reference, if the stream has no writing buffer.
-     */
-    WritingBuffer& getWritingBuffer();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a buffered stream
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/BufferedStream.h"
-
-namespace xplcommon { typedef win32::BufferedStream BufferedStream; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/BufferedStream.h"
-
-namespace xplcommon { typedef posix::BufferedStream BufferedStream; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_BUFFEREDSTREAM_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/CondVar.h
===================================================================
--- src/xplcommon/CondVar.h	(revision 34)
+++ 	(revision )
@@ -1,118 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_CONDVAR_H
-#define XPLCOMMON_CONDVAR_H
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a condition variable
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-class Mutex;
-
-//------------------------------------------------------------------------------
-
-/**
- * Condition variable.
- */
-class CondVar
-{
-public:
-    /**
-     * Wait for the condition variable.
-     *
-     * @param mutex the mutex to unlock and re-lock.
-     * @param timeout the number of milliseconds to wait at most. If
-     * negative, the function will wait indefinitely.
-     *
-     * @return true, if the condition variable was signalled, false
-     * if a timeout occured
-     */
-    bool wait(Mutex& mutex, int timeout = -1);
-
-    /**
-     * Signal the condition variable to wake up one thread.
-     */
-    void signal();
-
-    /**
-     * Signal all threads waiting on the condition variable.
-     */
-    void broadcast();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a condition variable
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/CondVar.h"
-
-namespace xplcommon { typedef win32::CondVar CondVar; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/CondVar.h"
-
-namespace xplcommon { typedef posix::CondVar CondVar; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_CONDVAR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/DataStream.cc
===================================================================
--- src/xplcommon/DataStream.cc	(revision 31)
+++ 	(revision )
@@ -1,120 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "DataStream.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::DataStream;
-
-using std::string;
-using std::min;
-
-//------------------------------------------------------------------------------
-
-size_t DataStream::readLength()
-{
-    size_t length = 0;
-
-    uint8_t d = 0;
-    do {
-        d = readU8();
-        length <<= 7;
-        length |= d&0x7f;
-    } while( (d&0x80)==0x80 );
-
-    return length;
-}
-
-//------------------------------------------------------------------------------
-
-string DataStream::readString()
-{
-    size_t length = readLength();
-    if (!*this) return "";
-
-    char* buffer = new char[length];
-    if (read(buffer, length)) {
-        string str(buffer, length);
-        delete buffer;
-        return str;
-    } else {
-        delete buffer;
-        return "";
-    }
-}
-
-//------------------------------------------------------------------------------
-
-size_t DataStream::readString(char* dest, size_t capacity)
-{
-    size_t length = readLength();
-    size_t destLength = 0;
-    if (*this && length>0) {
-        size_t destLength = min(length, capacity - 1);
-        if (read(dest, destLength)) {
-            if (destLength<length) {
-                if (!skip(length - destLength)) {
-                    length = destLength = 0;
-                }
-            }
-        } else {
-            length = destLength = 0;
-        }
-    } else {
-        length = 0;
-    }
-
-    dest[destLength] = '\0';
-
-    return length;
-}
-
-//------------------------------------------------------------------------------
-
-bool DataStream::writeLength(size_t length)
-{
-    do {
-        uint8_t x = length&0x7f;
-        length >>= 7;
-        if (length>0) x |= 0x80;
-        if (!writeU8(x)) return false;
-    } while(length>0);
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/DataStream.h
===================================================================
--- src/xplcommon/DataStream.h	(revision 31)
+++ 	(revision )
@@ -1,445 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_DATASTREAM_H
-#define XPLCOMMON_DATASTREAM_H
-//------------------------------------------------------------------------------
-
-#include "BlockingStream.h"
-
-#include <string>
-
-#include <cstring>
-
-#include <inttypes.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A blocking stream with extra functions to read and write values of
- * basic data types. The values are read and written in host
- * byte-order, so this stream does not work properly between machines
- * of different endianness.
- *
- * The reading functions return the value read and you can check of
- * error or interruption only by calling the appropriate
- * functions. The purpose of this behaviour is that the data could be
- * read item-by-item without having to check for the stream's
- * health all the time. Such checks are needed only, if some decision
- * is made, based on the data. In case of an error, the read functions
- * return some well-define default value, typically 0.
- *
- * The writing functions return a boolean value indicating success or
- * failure, but writing can be handled the same way as reading from
- * the point of view of error checking.
- */
-class DataStream : public BlockingStream
-{
-public:
-    /**
-     * Construct the stream.
-     */
-    DataStream(BufferedStream& stream);
-
-    /**
-     * Template for simple, type-specific reading.
-     */
-    template <typename T> T readT(T defaultValue = 0);
-
-    /**
-     * Read a signed, 8-bit value
-     */
-    int8_t readS8();
-
-    /**
-     * Read an unsigned, 8-bit value
-     */
-    uint8_t readU8();
-
-    /**
-     * Read a signed, 16-bit value
-     */
-    int16_t readS16();
-
-    /**
-     * Read an unsigned, 16-bit value
-     */
-    uint16_t readU16();
-
-    /**
-     * Read a signed, 32-bit value
-     */
-    int32_t readS32();
-
-    /**
-     * Read an unsigned, 32-bit value
-     */
-    uint32_t readU32();
-
-    /**
-     * Read a signed, 64-bit value
-     */
-    int64_t readS64();
-
-    /**
-     * Read an unsigned, 64-bit value
-     */
-    uint64_t readU64();
-
-    /**
-     * Read a float value.
-     */
-    float readFloat();
-
-    /**
-     * Read a double value.
-     */
-    double readDouble();
-
-    /**
-     * Read a long double value.
-     */
-    long double readLongDouble();
-
-    /**
-     * Read a length value. This is a of at most 32 bits, represented
-     * by a variable number of bytes for space efficiency.
-     *
-     * @see writeLength()
-     */
-    size_t readLength();
-
-    /**
-     * Read a string.
-     */
-    std::string readString();
-
-    /**
-     * Read a string into the given buffer. If the string is too large
-     * for the buffer, its end will be discarded. A trailing 0 is
-     * added in cases!
-     *
-     * @return the actual length of the string.
-     */
-    size_t readString(char* dest, size_t capacity);
-
-    /**
-     * Write a signed, 8-bit value
-     */
-    bool writeS8(int8_t x);
-
-    /**
-     * Write an unsigned, 8-bit value
-     */
-    bool writeU8(uint8_t x);
-
-    /**
-     * Write a signed, 16-bit value
-     */
-    bool writeS16(int16_t x);
-
-    /**
-     * Write an unsigned, 16-bit value
-     */
-    bool writeU16(uint16_t x);
-
-    /**
-     * Write a signed, 32-bit value
-     */
-    bool writeS32(int32_t x);
-
-    /**
-     * Write an unsigned, 32-bit value
-     */
-    bool writeU32(uint32_t x);
-
-    /**
-     * Write a signed, 64-bit value
-     */
-    bool writeS64(int64_t x);
-
-    /**
-     * Write an unsigned, 64-bit value
-     */
-    bool writeU64(uint64_t x);
-
-    /**
-     * Write a float value.
-     */
-    bool writeFloat(float x);
-
-    /**
-     * Write a double value.
-     */
-    bool writeDouble(double x);
-
-    /**
-     * Write a long double value.
-     */
-    bool writeLongDouble(long double x);
-
-    /**
-     * Write a length value. This a 32-bit value written as a sequence
-     * of bytes of variable length. A bytes's lower 7 bits contain
-     * parts of the value. The MSB indicates if another byte is left.
-     */
-    bool writeLength(size_t length);
-
-    /**
-     * Write a string. First the string's length is written as a
-     * length (see writeLength()), then the characters of the string
-     * without the trailing 0.
-     */
-    bool writeString(const char* s, size_t length);
-
-    /**
-     * Write a string. First the string's length is written as a
-     * length (see writeLength()), then the characters of the string
-     * without the trailing 0.
-     */
-    bool writeString(const std::string& s);
-
-    /**
-     * Write a string. First the string's length is written as a
-     * length (see writeLength()), then the characters of the string
-     * without the trailing 0.
-     */
-    bool writeString(const char* s);
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline DataStream::DataStream(BufferedStream& stream) :
-    BlockingStream(stream)
-{
-}
-
-//------------------------------------------------------------------------------
-
-template <typename T> T DataStream::readT(T defaultValue)
-{
-    T value = defaultValue;
-    read(&value, sizeof(value));
-    return value;
-}
-
-//------------------------------------------------------------------------------
-
-inline int8_t DataStream::readS8()
-{
-    return readT<int8_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline uint8_t DataStream::readU8()
-{
-    return readT<uint8_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline int16_t DataStream::readS16()
-{
-    return readT<int16_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline uint16_t DataStream::readU16()
-{
-    return readT<uint16_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline int32_t DataStream::readS32()
-{
-    return readT<int32_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline uint32_t DataStream::readU32()
-{
-    return readT<uint32_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline int64_t DataStream::readS64()
-{
-    return readT<int64_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline uint64_t DataStream::readU64()
-{
-    return readT<uint64_t>(0);
-}
-
-//------------------------------------------------------------------------------
-
-inline float DataStream::readFloat()
-{
-    return readT<float>(0.0);
-}
-
-//------------------------------------------------------------------------------
-
-inline double DataStream::readDouble()
-{
-    return readT<double>(0.0);
-}
-
-//------------------------------------------------------------------------------
-
-inline long double DataStream::readLongDouble()
-{
-    return readT<long double>(0.0);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeS8(int8_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeU8(uint8_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeS16(int16_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeU16(uint16_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeS32(int32_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeU32(uint32_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeS64(int64_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeU64(uint64_t x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeFloat(float x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeDouble(double x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeLongDouble(long double x)
-{
-    return write(&x, sizeof(x));
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeString(const char* s, size_t length)
-{
-    if (!writeLength(length)) return false;
-    else return write(s, length);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeString(const std::string& s)
-{
-    return writeString(s.c_str(), s.length());
-}
-
-//------------------------------------------------------------------------------
-
-inline bool DataStream::writeString(const char* s)
-{
-    return writeString(s, strlen(s));
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_DATASTREAM_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/Failable.h
===================================================================
--- src/xplcommon/Failable.h	(revision 20)
+++ 	(revision )
@@ -1,185 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_FAILABLE_H
-#define XPLCOMMON_FAILABLE_H
-//------------------------------------------------------------------------------
-
-#include "types.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * An object whose instances can fail, and the reason of the failure
- * is indicated by an integral error code.
- */
-class Failable
-{
-private:
-    /**
-     * The error code.
-     */
-    errorCode_t errorCode;
-
-public:
-    /**
-     * Construct the object and initialize the error code to indicate
-     * no error.
-     */
-    Failable();
-
-    /**
-     * Indicate if the object has failed.
-     */
-    bool failed() const;
-
-    /**
-     * Get the error code.
-     */
-    errorCode_t getErrorCode() const;
-
-    /**
-     * Discard the error code.
-     */
-    void repair();
-
-protected:
-    /**
-     * Set the error code.
-     */
-    void setErrorCode(errorCode_t ec);
-};
-
-//------------------------------------------------------------------------------
-
-/**
- * An object that references another failable object and fails
- * together with that object.
- *
- * The Child class should contain a function named getFailable()
- * which returns the failable object.
- */
-template <class Child>
-class FailableReference
-{
-public:
-    /**
-     * Indicate if the referenced object has failed.
-     */
-    bool failed() const;
-
-    /**
-     * Get the error code from the referenced object.
-     */
-    errorCode_t getErrorCode() const;
-
-    /**
-     * Discard the error code of the referenced object.
-     */
-    void repair();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Failable::Failable() :
-    errorCode(XPL_NO_ERROR)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Failable::failed() const
-{
-    return errorCode!=XPL_NO_ERROR;
-}
-
-//------------------------------------------------------------------------------
-
-inline errorCode_t Failable::getErrorCode() const
-{
-    return errorCode;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Failable::repair()
-{
-    errorCode = XPL_NO_ERROR;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Failable::setErrorCode(errorCode_t ec)
-{
-    errorCode = ec;
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-template <class Child>
-inline bool FailableReference<Child>::failed() const
-{
-    return static_cast<const Child*>(this)->getFailable().failed();
-}
-
-//------------------------------------------------------------------------------
-
-template <class Child>
-inline errorCode_t FailableReference<Child>::getErrorCode() const
-{
-    return static_cast<const Child*>(this)->getFailable().getErrorCode();
-}
-
-//------------------------------------------------------------------------------
-
-template <class Child>
-inline void FailableReference<Child>::repair()
-{
-    static_cast<Child*>(this)->getFailable().repair();
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_FAILABLE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/LocalAcceptor.h
===================================================================
--- src/xplcommon/LocalAcceptor.h	(revision 21)
+++ 	(revision )
@@ -1,130 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_LOCALACCEPTOR_H
-#define XPLCOMMON_LOCALACCEPTOR_H
-//------------------------------------------------------------------------------
-
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a connection acceptor working with local sockets
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * An acceptor that provides a LocalSocket for each accepted
- * connection.
- */
-class LocalAcceptor : public FailableReference<LocalAcceptor>
-{
-public:
-
-    /**
-     * Start accepting a connection.
-     *
-     * If a connection is already accepted, but not retrieved yet, it
-     * returns true.
-     *
-     * If a new socket becomes immediately available, it returns true.
-     *
-     * If some error occurs, the acceptor is marked as failed.
-     */
-    bool accept();
-
-    /**
-     * Get the local socket accepted last. If no socket was accepted,
-     * return 0. The local socket's waiter will be the given one. If
-     * the server socket has no waiter, this one should be 0. If the
-     * server socket has a waiter, this one should not be 0. In other
-     * words, if the server socket is non-blocking, the accepted one
-     * should also be non-blocking, if the server socket is blocking,
-     * the accepted one should also be blocking.
-     */
-    LocalSocket* getSocket(Waiter* waiter,
-                           size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY,
-                           size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY);
-    /**
-     * Get the local socket accepted last. If no socket was accepted,
-     * return 0. The local socket's waiter will be the same as that of
-     * the associated server socket.
-     */
-    LocalSocket* getSocket(size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY,
-                           size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY);
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a connection acceptor working with local sockets
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/LocalAcceptor.h"
-
-namespace xplcommon { typedef win32::LocalAcceptor LocalAcceptor; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/LocalAcceptor.h"
-
-namespace xplcommon { typedef posix::LocalAcceptor LocalAcceptor; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_LOCALACCEPTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/LocalClientSocket.h
===================================================================
--- src/xplcommon/LocalClientSocket.h	(revision 21)
+++ 	(revision )
@@ -1,121 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_LOCALCLIENTSOCKET_H
-#define XPLCOMMON_LOCALCLIENTSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "BufferedStream.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a socket that can be connected to a local, named access point provided by a LocalServerSocket
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-class LocalConnector;
-
-//------------------------------------------------------------------------------
-
-/**
- * Client socket that connects to a server socket locally. On Linux it
- * is a Unix socket, on Windows it is a named pipe.
- *
- * The server socket's name should be given.
- */
-class LocalClientSocket : public BufferedStream
-{
-public:
-    /**
-     * Construct the client socket with the given name.
-     *
-     * @param waiter the waiter to use for waiting a possible event
-     * occuring on the socket. If given, the socket will be
-     * non-blocking. Otherwise, it will be blocking, and the connect()
-     * function of the Connector might block as well as the reading
-     * and writing buffers.
-     */
-    LocalClientSocket(const char* name, Waiter* waiter = 0,
-                      size_t readingCapacity = DEFAULT_CAPACITY,
-                      size_t writingCapacity = DEFAULT_CAPACITY);
-
-    /**
-     * Get the connector. Use this object to connect to another socket.
-     */
-    LocalConnector& getConnector();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, // The public interface of a socket that can be connected to a local, named access point provided by a LocalServerSocket
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/LocalClientSocket.h"
-
-namespace xplcommon { typedef win32::LocalClientSocket LocalClientSocket; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/LocalClientSocket.h"
-
-namespace xplcommon { typedef posix::LocalClientSocket LocalClientSocket; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_LOCALCLIENTSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/LocalConnector.h
===================================================================
--- src/xplcommon/LocalConnector.h	(revision 21)
+++ 	(revision )
@@ -1,112 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_LOCALCONNECTOR_H
-#define XPLCOMMON_LOCALCONNECTOR_H
-//------------------------------------------------------------------------------
-
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a connector for a local client socket
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * Class representing the creation of a connection to some remote
- * entity, like a socket or a pipe. It cannot be created directly,
- * only acquired from a client socket.
- */
-class LocalConnector : public FailableReference<LocalConnector>
-{
-public:
-    /**
-     * Connect to an address properly set up.
-     *
-     * If the connection succeeds immediately, it indicates success.
-     *
-     * If the connection does not succeed, because it would block, it
-     * sets up the socket to wait for the connection to succeed, and
-     * returns failure.
-     *
-     * If the connection fails for another reason, the error code is
-     * set, and false is returned.
-     */
-    bool connect();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a connector for a local client socket
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/LocalConnector.h"
-
-namespace xplcommon { typedef win32::LocalConnector LocalConnector; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/LocalConnector.h"
-
-namespace xplcommon { typedef posix::LocalConnector LocalConnector; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_LOCALCONNECTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/LocalServerSocket.h
===================================================================
--- src/xplcommon/LocalServerSocket.h	(revision 17)
+++ 	(revision )
@@ -1,113 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_LOCALSERVERSOCKET_H
-#define XPLCOMMON_LOCALSERVERSOCKET_H
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a server socket providing a local, named access point
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A server socket that provides a local, named access point. On
- * Linux, it is a Unix socket, on Windows it is a named pipe.
- *
- * It is identified by a name that should be unique for the user.
- */
-class LocalServerSocket
-{
-public:
-    /**
-     * Construct the socket with the given name.
-     *
-     * It will be bound to the name and able to listen for incoming
-     * connections.
-     *
-     * @param waiter the waiter to use for waiting a possible event
-     * occuring on the socket. If given, the socket will be
-     * non-blocking. Otherwise, it will be blocking, and the accept()
-     * function of the Acceptor might block.
-     */
-    LocalServerSocket(const char* name, Waiter* waiter = 0);
-
-    /**
-     * Get the acceptor.
-     */
-    LocalAcceptor& getAcceptor();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a server socket providing a local, named access point
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/LocalServerSocket.h"
-
-namespace xplcommon { typedef win32::LocalServerSocket LocalServerSocket; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/LocalServerSocket.h"
-
-namespace xplcommon { typedef posix::LocalServerSocket LocalServerSocket; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_LOCALSERVERSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/LocalSocket.h
===================================================================
--- src/xplcommon/LocalSocket.h	(revision 17)
+++ 	(revision )
@@ -1,97 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_LOCALSOCKET_H
-#define XPLCOMMON_LOCALSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "BufferedStream.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a socket accepted from a local server socket
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A socket that works on a local connection. On Linux, it is a Unix
- * socket, on Windows it is a named pipe.
- */
-class LocalSocket : public BufferedStream
-{
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a socket accepted from a local server socket
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/LocalSocket.h"
-
-namespace xplcommon { typedef win32::LocalSocket LocalSocket; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/LocalSocket.h"
-
-namespace xplcommon { typedef posix::LocalSocket LocalSocket; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_LOCALSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/xplcommon/Makefile.am
===================================================================
--- src/xplcommon/Makefile.am	(revision 39)
+++ src/xplcommon/Makefile.am	(revision 40)
@@ -1,8 +1,5 @@
 INCLUDES=@XPSDK_INCLUDES@
 
-SUBDIRS=
-
 if TARGET_API_POSIX
-SUBDIRS+=posix
 AM_CPPFLAGS=-DLIN
 AM_CXXFLAGS=-fPIC -fno-stack-protector
@@ -10,5 +7,4 @@
 
 if TARGET_API_WIN32
-SUBDIRS+=win32
 AM_CPPFLAGS=-DIBM
 AM_LDFLAGS=@XPSDK_LDFLAGS@ -no-undefined
@@ -23,38 +19,7 @@
 
 libxplcommon_la_SOURCES= \
-	PseudoRandom.cc		\
-	BlockingStream.cc	\
-	DataStream.cc		\
 	Util.cc
-
-if TARGET_API_POSIX
-libxplcommon_la_LIBADD=posix/libxplcommon_posix.la
-endif
-
-if TARGET_API_WIN32
-libxplcommon_la_LIBADD=win32/libxplcommon_win32.la
-endif
 
 include_xplcommondir=$(includedir)/xplcommon
 include_xplcommon_HEADERS=\
-	config.h		\
-	types.h			\
-	PseudoRandom.h		\
-	Thread.h		\
-	Mutex.h			\
-	CondVar.h		\
-	Failable.h		\
-	Waiter.h		\
-	WaitableEvent.h		\
-	Buffer.h		\
-	BufferedStream.h	\
-	ReadingBuffer.h		\
-	WritingBuffer.h		\
-	LocalAcceptor.h		\
-	LocalSocket.h		\
-	LocalServerSocket.h	\
-	LocalConnector.h	\
-	LocalClientSocket.h	\
-	BlockingStream.h	\
-	DataStream.h		\
 	Util.h
Index: c/xplcommon/Mutex.h
===================================================================
--- src/xplcommon/Mutex.h	(revision 32)
+++ 	(revision )
@@ -1,110 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_MUTEX_H
-#define XPLCOMMON_MUTEX_H
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a mutex
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A mutual exclusion device.
- */
-class Mutex
-{
-public:
-    /**
-     * Lock the mutex. If the mutex is locked by another thread, the
-     * caller one waits until the other thread releases the mutex.
-     */
-    void lock();
-
-    /**
-     * Try to lock the mutex. If the mutex is locked by another
-     * thread, this function returns false immediately. Otherwise it
-     * locks the mutex and returns true.
-     */
-    bool tryLock();
-
-    /**
-     * Unlock the mutex.
-     */
-    void unlock();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a mutex
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/Mutex.h"
-
-namespace xplcommon { typedef win32::Mutex Mutex; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/Mutex.h"
-
-namespace xplcommon { typedef posix::Mutex Mutex; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_MUTEX_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/PseudoRandom.cc
===================================================================
--- src/xplcommon/PseudoRandom.cc	(revision 27)
+++ 	(revision )
@@ -1,66 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "PseudoRandom.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::PseudoRandom;
-
-//------------------------------------------------------------------------------
-
-void PseudoRandom::initialize(uint32_t seed)
-{
-    vector[0] = seed;
-    for(size_t i = 1; i<vectorSize-3; ++i) {
-        int32_t x = (static_cast<long long>(16807) *
-                     static_cast<long long>(vector[i-1])) % 2147483647;
-        if (x<0) x += 2147483647;
-        vector[i] = x;
-    }
-    for(size_t i = vectorSize - 3; i<vectorSize; ++i) {
-        vector[i] = vector[i-31];
-    }
-
-    nextIndex = 0;
-
-    for(size_t i = vectorSize; i<numDiscarded; ++i) {
-        next();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/PseudoRandom.h
===================================================================
--- src/xplcommon/PseudoRandom.h	(revision 27)
+++ 	(revision )
@@ -1,176 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_PSEUDORANDOM_H
-#define XPLCOMMON_PSEUDORANDOM_H
-//------------------------------------------------------------------------------
-
-#include <cstdlib>
-#include <ctime>
-
-#include <inttypes.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A pseudo-random number generator. The algorithm is the same as
- * described in http://www.mathstat.dal.ca/~selinger/random, i.e. the
- * GNU libc random number generator. It is reimplemented, because
- * Windows does not provide a thread-safe, reentrable pseudo-random
- * number generation facility, so it should have been implemented for
- * Win32 anyway.
- */
-class PseudoRandom
-{
-public:
-    /**
-     * The largest random number generated in the unconverted
-     * sequence.
-     */
-    static const uint32_t MAX = (1<<31);
-
-private:
-    /**
-     * The size of the vector.
-     */
-    static const size_t vectorSize = 34;
-
-    /**
-     * The number of random numbers thrown away.
-     */
-    static const size_t numDiscarded = 344;
-
-    /**
-     * The vector of random numbers used to generate the next one.
-     */
-    uint32_t vector[vectorSize];
-
-    /**
-     * The index of the next random number.
-     */
-    int nextIndex;
-
-public:
-    /**
-     * Construct the random number generator with a default seed
-     * (taken by calling time()).
-     */
-    PseudoRandom();
-
-    /**
-     * Construct the random number generator with the given seed.
-     */
-    PseudoRandom(uint32_t seed);
-
-    /**
-     * Get the next raw value.
-     */
-    uint32_t next();
-
-    /**
-     * Get the next random number as an unsigned value between [from, to].
-     */
-    unsigned nextUnsigned(unsigned to = MAX, unsigned from=0);
-
-    /**
-     * Get the next random number as a double value between [from,
-     * to].
-     */
-    double nextDouble(double to = 1.0, double from= 0.0);
-
-private:
-    /**
-     * Initialize the random number generator with the given seed.
-     */
-    void initialize(uint32_t seed);
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline PseudoRandom::PseudoRandom()
-{
-    initialize(time(0));
-}
-
-//------------------------------------------------------------------------------
-
-inline PseudoRandom::PseudoRandom(uint32_t seed)
-{
-    initialize(seed);
-}
-
-//------------------------------------------------------------------------------
-
-inline uint32_t PseudoRandom::next()
-{
-    int i1 = (nextIndex<3) ? (vectorSize + nextIndex - 3) : (nextIndex - 3);
-    int i2 = (nextIndex<31) ? (vectorSize + nextIndex - 31) : (nextIndex - 31);
-
-    vector[nextIndex] = vector[i1] + vector[i2];
-    uint32_t x = vector[nextIndex]>>1;
-
-    ++nextIndex; if (nextIndex>=static_cast<int>(vectorSize)) nextIndex = 0;
-
-    return x;
-}
-
-//------------------------------------------------------------------------------
-
-inline unsigned PseudoRandom::nextUnsigned(unsigned to, unsigned from)
-{
-    return from + static_cast<unsigned>(static_cast<double>(to - from) * next()
-                                        / static_cast<double>(MAX));
-}
-
-//------------------------------------------------------------------------------
-
-inline double PseudoRandom::nextDouble(double to, double from)
-{
-    return from + (to-from) * next() / static_cast<double>(MAX);
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_PSEUDORANDOM_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/ReadingBuffer.h
===================================================================
--- src/xplcommon/ReadingBuffer.h	(revision 21)
+++ 	(revision )
@@ -1,122 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_READINGBUFFER_H
-#define XPLCOMMON_READINGBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "Buffer.h"
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a reading buffer
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffer used for reading from a buffered stream. It cannot be
- * created directly, only acquired from the stream.
- *
- * It should be made empty, and then the function read() should be
- * called on it. If it returns true, some data could be read. If the
- * amount of data read is 0, that indicates and end-of-file condition.
- */
-class ReadingBuffer : public Buffer, public FailableReference<ReadingBuffer>
-{
-public:
-    /**
-     * Read into the buffer using the buffered stream if possible.
-     *
-     * If the buffer contains data, this function returns immediately
-     * with success, so the buffer should be reset before reading.
-     *
-     * If some data can be read immediately, that is stored in the
-     * buffer, and success is indicated. Success is indicated even if
-     * the amount of data read is 0, allowing for signalling the
-     * end-of-file or end-of-connection condition.
-     *
-     * If the reading operation would block, the stream is set up so
-     * that it would read, and failure is returned.
-     *
-     * Otherwise, if the reading operation fails for some other
-     * reason, the buffer's error code is set, so it should always be
-     * checked on a failure!
-     */
-    bool read();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a reading buffer
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/ReadingBuffer.h"
-
-namespace xplcommon { typedef win32::ReadingBuffer ReadingBuffer; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/ReadingBuffer.h"
-
-namespace xplcommon { typedef posix::ReadingBuffer ReadingBuffer; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_READINGBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/Thread.h
===================================================================
--- src/xplcommon/Thread.h	(revision 35)
+++ 	(revision )
@@ -1,123 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_THREAD_H
-#define XPLCOMMON_THREAD_H
-//------------------------------------------------------------------------------
-
-// The public interface of the Thread class common to all platforms
-#if 0
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A thread
- */
-class Thread
-{
-public:
-    /**
-     * Sleep for the given number of milliseconds.
-     */
-    static void sleep(unsigned millis);
-
-public:
-    /**
-     * Construct the thread.
-     *
-     * @param detached if true, the thread will be created as a
-     * detached one, i.e. it can't be joined later on. The thread
-     * object will also be deleted when its run() function has
-     * finished.
-     */
-    Thread(bool detached = false);
-
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Thread();
-
-    /**
-     * Start the thread.
-     *
-     * @return if the thread could be started
-     */
-    bool start();
-
-    /**
-     * Perform the thread's real operation. To be implemented in children
-     */
-    virtual void run() = 0;
-
-    /**
-     * Wait for the thread to quit.
-     */
-    void join();
-};
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of the Thread class common to all platforms
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-#include "win32/Thread.h"
-
-namespace xplcommon { typedef win32::Thread Thread; }
-
-//------------------------------------------------------------------------------
-#else // TARGET_API_WIN32
-//------------------------------------------------------------------------------
-
-#include "posix/Thread.h"
-
-namespace xplcommon { typedef posix::Thread Thread; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_THREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/WaitableEvent.h
===================================================================
--- src/xplcommon/WaitableEvent.h	(revision 20)
+++ 	(revision )
@@ -1,123 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WAITABLEEVENT_H
-#define XPLCOMMON_WAITABLEEVENT_H
-//------------------------------------------------------------------------------
-
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-// The public interface of the WaitableEvent class common to all platforms
-#if 0
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * An event on which one can wait with a waiter.
- */
-class WaitableEvent : public Failable
-{
-public:
-    /**
-     * Construct the event.
-     *
-     * @param waiter the waiter to be used for waiting. If given, the
-     * check() function will always return immediately. If not given,
-     * the check() function may block and returns only when the event
-     * is fired.
-     */
-    WaitableEvent(Waiter* waiter = 0);
-
-    /**
-     * Destroy the event.
-     */
-    virtual ~WaitableEvent();
-
-    /**
-     * Fire the event.
-     */
-    void fire();
-
-    /**
-     * Check if the event is fired or not. If so, the fired status
-     * will be cleared.
-     */
-    bool check();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, // The public interface of the WaitableEvent class common to all platforms
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/WaitableEvent.h"
-
-namespace xplcommon { typedef win32::WaitableEvent WaitableEvent; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/WaitableEvent.h"
-
-namespace xplcommon { typedef posix::WaitableEvent WaitableEvent; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WAITABLEEVENT_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/Waiter.h
===================================================================
--- src/xplcommon/Waiter.h	(revision 20)
+++ 	(revision )
@@ -1,110 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WAITER_H
-#define XPLCOMMON_WAITER_H
-//------------------------------------------------------------------------------
-
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-// The public interface of the Waiter class common to all platforms
-#if 0
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * Class that can be used to register waitable objects and then wait
- * for them. The objects are registered when they created and a Waiter
- * instance is passed to them.
- */
-class Waiter : public Failable
-{
-public:
-    /**
-     * Wait for any if the waitables to become ready or until a
-     * timeout expires.
-     *
-     * If any of the waitables are ready, the function returns immediately.
-     *
-     * @return true if any of the waitables has become ready, false if
-     * the timeout occurs.
-     */
-    bool wait(int timeout = -1);
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of the Waiter class common to all platforms
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/Waiter.h"
-
-namespace xplcommon { typedef win32::Waiter Waiter; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/Waiter.h"
-
-namespace xplcommon { typedef posix::Waiter Waiter; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WAITER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/WritingBuffer.h
===================================================================
--- src/xplcommon/WritingBuffer.h	(revision 21)
+++ 	(revision )
@@ -1,128 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WRITINGBUFFER_H
-#define XPLCOMMON_WRITINGBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "Buffer.h"
-#include "Failable.h"
-
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of a writing buffer
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffer used for writing into a buffered stream.  It cannot be
- * created directly, only acquired from the stream.
- *
- * The data to write should be stored in the buffer. Then write()
- * should be called. If it returns true, it indicates that all data
- * has been written. In that case the buffer is automatically emptied.
- */
-class WritingBuffer : public Buffer, public FailableReference<WritingBuffer>
-{
-public:
-    /**
-     * Reset the buffer. It resets the offset too.
-     */
-    void reset();
-
-    /**
-     * Write the contents of the buffer using the associated buffered
-     * stream.
-     *
-     * If the buffer is empty, the function returns indicating
-     * success.
-     *
-     * If the complete remaining contents could be written, it also indicates
-     * success, and the buffer is reset, ready to be used again.
-     *
-     * If not everything can be written and the write operation
-     * indicates that it would block, this function returns failure
-     * after the stream has been set up  to handle the corresponding
-     * poll events.
-     *
-     * Otherwise, if the writing operation fails for some other
-     * reason, the buffer's error code is set to the error's code and
-     * false is returned.
-     */
-    bool write();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of a writing buffer
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/WritingBuffer.h"
-
-namespace xplcommon { typedef win32::WritingBuffer WritingBuffer; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/WritingBuffer.h"
-
-namespace xplcommon { typedef posix::WritingBuffer WritingBuffer; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WRITINGBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/config.h.in
===================================================================
--- src/xplcommon/config.h.in	(revision 39)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/* src/xplcommon/config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if you have the <windows.h> header file. */
-#undef HAVE_WINDOWS_H
-
-/* Define to 1 if you have the <winsock2.h> header file. */
-#undef HAVE_WINSOCK2_H
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
-#undef LT_OBJDIR
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define if the target is the POSIX API. */
-#undef TARGET_API_POSIX
-
-/* Define if the target is the Win32 API. */
-#undef TARGET_API_WIN32
-
-/* Define if the target is the 64-bit Win32 API. */
-#undef TARGET_API_WIN64
-
-/* Version number of package */
-#undef VERSION
Index: c/xplcommon/posix/.copyright
===================================================================
--- src/xplcommon/posix/.copyright	(revision 3)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
Index: c/xplcommon/posix/.namespace
===================================================================
--- src/xplcommon/posix/.namespace	(revision 3)
+++ 	(revision )
@@ -1,2 +1,0 @@
-xplcommon
-posix
Index: c/xplcommon/posix/.srcmessage
===================================================================
--- src/xplcommon/posix/.srcmessage	(revision 3)
+++ 	(revision )
@@ -1,2 +1,0 @@
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
Index: c/xplcommon/posix/Acceptor.cc
===================================================================
--- src/xplcommon/posix/Acceptor.cc	(revision 14)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Acceptor.h"
-
-#include "ServerSocket.h"
-
-#include <poll.h>
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::Acceptor;
-
-//------------------------------------------------------------------------------
-
-Acceptor::~Acceptor()
-{
-    delete [] address;
-}
-
-//------------------------------------------------------------------------------
-
-bool Acceptor::accept()
-{
-    if (failed()) return false;
-    if (acceptedFD>=0) return true;
-
-    size_t addrlen = addressLength;
-    int result = socket.accept(reinterpret_cast<struct ::sockaddr*>(address),
-                               (address==0) ? 0 : &addrlen);
-    if (result<0) {
-        if (socket.failed()) {
-            socket.events &= ~POLLIN;
-        } else {
-            socket.events |= POLLIN;
-        }
-        return false;
-    } else {
-        acceptedFD = result;
-        socket.events &= ~POLLIN;
-        return true;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Acceptor.h
===================================================================
--- src/xplcommon/posix/Acceptor.h	(revision 14)
+++ 	(revision )
@@ -1,165 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_ACCEPTOR_H
-#define XPLCOMMON_POSIX_ACCEPTOR_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-#include "ServerSocket.h"
-
-#include <cstdlib>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * Class representing the accepting of an incoming connection on a
- * socket.
- */
-class Acceptor : public ::xplcommon::FailableReference<Acceptor>
-{
-protected:
-    /**
-     * The socket we belong to.
-     */
-    ServerSocket& socket;
-
-    /**
-     * The file descriptor accepted the last time.
-     */
-    int acceptedFD;
-
-    /**
-     * The buffer for the remote address, if we are interested.
-     */
-    unsigned char* address;
-
-    /**
-     * The length of the remote address buffer.
-     */
-    size_t addressLength;
-
-protected:
-    /**
-     * Construct the acceptor.
-     *
-     * @param addressLength the length of the buffer for the peer
-     * address. If 0, not buffer will be created.
-     */
-    Acceptor(ServerSocket* socket, size_t addressLength = 0);
-
-public:
-    /**
-     * Destroy the acceptor.
-     */
-    virtual ~Acceptor();
-
-    /**
-     * Start accepting a connection.
-     *
-     * If a connection is already accepted, but not retrieved yet, it
-     * returns true.
-     *
-     * If a new socket becomes immediately available, it returns true.
-     *
-     * If some error occurs, the acceptor is marked as failed.
-     */
-    bool accept();
-
-protected:
-    /**
-     * Called when a connection gets processed and we can become ready
-     * for the next one.
-     */
-    void connectionProcessed();
-
-private:
-    /**
-     * Get the failable object.
-     */
-    const ::xplcommon::Failable& getFailable() const;
-
-    /**
-     * Get the failable object.
-     */
-    ::xplcommon::Failable& getFailable();
-
-    friend class FailableReference<Acceptor>;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Acceptor::Acceptor(ServerSocket* socket, size_t addressLength) :
-    socket(*socket),
-    acceptedFD(-1),
-    address( (addressLength==0) ? 0 : new unsigned char[addressLength]),
-    addressLength(addressLength)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline void Acceptor::connectionProcessed()
-{
-    acceptedFD = -1;
-}
-
-//------------------------------------------------------------------------------
-
-inline const ::xplcommon::Failable& Acceptor::getFailable() const
-{
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-inline ::xplcommon::Failable& Acceptor::getFailable()
-{
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_ACCEPTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/BufferedStream.cc
===================================================================
--- src/xplcommon/posix/BufferedStream.cc	(revision 16)
+++ 	(revision )
@@ -1,113 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "BufferedStream.h"
-
-#include "ReadingBuffer.h"
-#include "WritingBuffer.h"
-
-#include <unistd.h>
-#include <poll.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::BufferedStream;
-
-//------------------------------------------------------------------------------
-
-BufferedStream::BufferedStream(Waiter* waiter, int fd,
-                                   size_t readingCapacity,
-                                   size_t writingCapacity,
-                                   short events) :
-    Waitable(waiter, fd, events),
-    readingBuffer( (readingCapacity==0) ? 0 :
-                   new ReadingBuffer(readingCapacity, this)),
-    writingBuffer( (writingCapacity==0) ? 0 :
-                   new WritingBuffer(writingCapacity, this))
-{
-}
-
-//------------------------------------------------------------------------------
-
-BufferedStream::~BufferedStream()
-{
-    delete writingBuffer;
-    delete readingBuffer;
-}
-
-//------------------------------------------------------------------------------
-
-ssize_t BufferedStream::read(void* dest, size_t length)
-{
-    ssize_t result = ::read(fd, dest, length);
-    if (result<0 && errno!=EAGAIN && errno!=EWOULDBLOCK) {
-        setErrorCodeFromErrno();
-    }
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-ssize_t BufferedStream::write(const void* src, size_t length)
-{
-    ssize_t result = ::write(fd, src, length);
-    if (result<0 && errno!=EAGAIN && errno!=EWOULDBLOCK) {
-        setErrorCodeFromErrno();
-    }
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-bool BufferedStream::isReady()
-{
-    return false;
-}
-
-//------------------------------------------------------------------------------
-
-void BufferedStream::handleEvents(short ev)
-{
-    if ((ev&POLLIN)==POLLIN && readingBuffer!=0) {
-        readingBuffer->read();
-    }
-    if ((ev&POLLOUT)==POLLOUT && writingBuffer!=0) {
-        writingBuffer->write();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/BufferedStream.h
===================================================================
--- src/xplcommon/posix/BufferedStream.h	(revision 16)
+++ 	(revision )
@@ -1,170 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_BUFFEREDSTREAM_H
-#define XPLCOMMON_POSIX_BUFFEREDSTREAM_H
-//------------------------------------------------------------------------------
-
-#include "Waitable.h"
-
-#include <cstdlib>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-class ReadingBuffer;
-class WritingBuffer;
-
-//------------------------------------------------------------------------------
-
-/**
- * A waitable that has a read and/or a write buffer associated with
- * it.
- */
-class BufferedStream : public Waitable
-{
-public:
-    /**
-     * The default buffer capacity.
-     */
-    static const size_t DEFAULT_CAPACITY = 4096;
-
-private:
-    /**
-     * The reading buffer. It may be 0, if no reading buffer is
-     * associated with this waitable.
-     */
-    ReadingBuffer* readingBuffer;
-
-    /**
-     * The writing buffer. It may be 0, if no writing buffer is
-     * associated with this waitable.
-     */
-    WritingBuffer* writingBuffer;
-
-protected:
-    /**
-     * Construct the buffered waitable with the given capacities of
-     * the reading and writing buffers. If any of the capacities is 0,
-     * the corresponding buffer will not be created.
-     */
-    BufferedStream(Waiter* waiter = 0, int fd = -1,
-                     size_t readingCapacity = DEFAULT_CAPACITY,
-                     size_t writingCapacity = DEFAULT_CAPACITY,
-                     short events = 0);
-
-public:
-    /**
-     * Destroy the buffered waitable.
-     */
-    virtual ~BufferedStream();
-
-    /**
-     * Get the reference of the reading buffer. Note, that it can be a
-     * 0 reference, if the waitable has no reading buffer.
-     */
-    ReadingBuffer& getReadingBuffer();
-
-    /**
-     * Get the reference of the writing buffer. Note, that it can be a
-     * 0 reference, if the waitable has no writing buffer.
-     */
-    WritingBuffer& getWritingBuffer();
-
-protected:
-    /**
-     * Read using the file descriptor at most the given number of
-     * bytes into the given buffer.
-     *
-     * This default implementation uses the read(2) function for
-     * reading.
-     *
-     * @return the number of bytes read (0 in case of end-of-file or
-     * when the connection is closed), -1 on error. In case of error,
-     * the error code will be set up.
-     */
-    virtual ssize_t read(void* dest, size_t length);
-
-    /**
-     * Write using the file descriptor the given number of bytes from
-     * the given buffer.
-     *
-     * This default implementation uses the write(2) function for
-     * writing.
-     *
-     * @return the number of bytes written, or -1 on error. In case of error,
-     * the error code will be set up.
-     */
-    virtual ssize_t write(const void* src, size_t length);
-
-    /**
-     * Check if the waitable is ready.
-     */
-    virtual bool isReady();
-
-    /**
-     * Handle any events on the file descriptor.
-     */
-    virtual void handleEvents(short events);
-
-    friend class ReadingBuffer;
-    friend class WritingBuffer;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ReadingBuffer& BufferedStream::getReadingBuffer()
-{
-    return *readingBuffer;
-}
-
-//------------------------------------------------------------------------------
-
-inline WritingBuffer& BufferedStream::getWritingBuffer()
-{
-    return *writingBuffer;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_BUFFEREDSTREAM_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/ClientSocket.cc
===================================================================
--- src/xplcommon/posix/ClientSocket.cc	(revision 21)
+++ 	(revision )
@@ -1,73 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ClientSocket.h"
-
-#include "Connector.h"
-
-#include <poll.h>
-
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::ClientSocket;
-
-//------------------------------------------------------------------------------
-
-void ClientSocket::handleEvents(short events)
-{
-    if (connector.connecting && (events&POLLOUT)==POLLOUT) {
-        connector.handleWritable();
-        events &= ~POLLOUT;
-    }
-
-    BufferedStream::handleEvents(events);
-}
-
-//------------------------------------------------------------------------------
-
-bool ClientSocket::connect(const struct sockaddr* addr, size_t addrlen)
-{
-    int result = ::connect(fd, addr, addrlen);
-    if (result<0 && errno!=EINPROGRESS) {
-        setErrorCodeFromErrno();
-    }
-    return result>=0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/ClientSocket.h
===================================================================
--- src/xplcommon/posix/ClientSocket.h	(revision 21)
+++ 	(revision )
@@ -1,112 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_CLIENTSOCKET_H
-#define XPLCOMMON_POSIX_CLIENTSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "Socket.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-class Connector;
-
-//------------------------------------------------------------------------------
-
-/**
- * A socket that can be connected to another one.
- */
-class ClientSocket : public Socket
-{
-private:
-    /**
-     * The connector.
-     */
-    Connector& connector;
-
-protected:
-    /**
-     * Construct the socket with the given parameters.
-     */
-    ClientSocket(int domain, int type, Connector& connector,
-                 Waiter* waiter = 0, int protocol = 0,
-                 size_t readingCapacity = DEFAULT_CAPACITY,
-                 size_t writingCapacity = DEFAULT_CAPACITY);
-
-protected:
-    /**
-     * Handle any events on the file descriptor. If a connection is in
-     * progress, and the incoming events have the EPOLLOUT flag set,
-     * the connector is called to handle the event. Then the parent
-     * class' handleEvents function is called.
-     */
-    virtual void handleEvents(short events);
-
-    /**
-     * Connect the socket to the given address.
-     *
-     * @return whether the connection succeeded or not. If it does not
-     * succeeded, it may be either because of the socket being
-     * non-blocking and some time is needed, or because of a failure,
-     * in which case the error code will be set properly.
-     */
-    bool connect(const struct sockaddr* addr, size_t addrlen);
-
-    friend class Connector;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ClientSocket::ClientSocket(int domain, int type, Connector& connector,
-                                  Waiter* waiter, int protocol,
-                                  size_t readingCapacity,
-                                  size_t writingCapacity) :
-    Socket(domain, type, waiter, protocol, readingCapacity, writingCapacity),
-    connector(connector)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_CLIENTSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/CondVar.cc
===================================================================
--- src/xplcommon/posix/CondVar.cc	(revision 34)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "CondVar.h"
-
-#include <sys/time.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::CondVar;
-
-//------------------------------------------------------------------------------
-
-void CondVar::getAbsTime(struct ::timespec& abstime, int timeout)
-{
-    struct timeval tv;
-    gettimeofday(&tv, 0);
-
-    abstime.tv_sec = tv.tv_sec + timeout / 1000;
-    abstime.tv_nsec = (tv.tv_usec + (timeout%1000) * 1000) * 1000;
-    if (abstime.tv_nsec>=1000000000) {
-        ++abstime.tv_sec;
-        abstime.tv_nsec -= 1000000000;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/CondVar.h
===================================================================
--- src/xplcommon/posix/CondVar.h	(revision 34)
+++ 	(revision )
@@ -1,148 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_CONDVAR_H
-#define XPLCOMMON_POSIX_CONDVAR_H
-//------------------------------------------------------------------------------
-
-#include "Mutex.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A condition variable for POSIX threads.
- */
-class CondVar
-{
-private:
-    /**
-     * Fill the given timespec with the absolute time corresponding to
-     * the given relative timeout.
-     */
-    static void getAbsTime(struct ::timespec& abstime, int timeout);
-
-    /**
-     * The pthreads structure.
-     */
-    pthread_cond_t cond;
-
-public:
-    /**
-     * Construct the condition variable.
-     */
-    CondVar();
-
-    /**
-     * Destroy the condition variable.
-     */
-    ~CondVar();
-
-    /**
-     * Wait for the condition variable.
-     *
-     * @param mutex the mutex to unlock and re-lock.
-     * @param timeout the number of milliseconds to wait at most. If
-     * negative, the function will wait indefinitely.
-     *
-     * @return true, if the condition variable was signalled, false
-     * if a timeout occured
-     */
-    bool wait(Mutex& mutex, int timeout = -1);
-
-    /**
-     * Signal the condition variable to wake up one thread.
-     */
-    void signal();
-
-    /**
-     * Signal all threads waiting on the condition variable.
-     */
-    void broadcast();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline CondVar::CondVar()
-{
-    pthread_cond_init(&cond, 0);
-}
-
-//------------------------------------------------------------------------------
-
-inline CondVar::~CondVar()
-{
-    pthread_cond_destroy(&cond);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool CondVar::wait(Mutex& mutex, int timeout)
-{
-    if (timeout<0) {
-        pthread_cond_wait(&cond, &mutex.mutex);
-        return true;
-    } else {
-        struct ::timespec abstime;
-        getAbsTime(abstime, timeout);
-        return pthread_cond_timedwait(&cond, &mutex.mutex, &abstime)==0;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-inline void CondVar::signal()
-{
-    pthread_cond_signal(&cond);
-}
-
-//------------------------------------------------------------------------------
-
-inline void CondVar::broadcast()
-{
-    pthread_cond_broadcast(&cond);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_CONDVAR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Connector.cc
===================================================================
--- src/xplcommon/posix/Connector.cc	(revision 14)
+++ 	(revision )
@@ -1,93 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Connector.h"
-
-#include "ClientSocket.h"
-
-#include <poll.h>
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::Connector;
-
-//------------------------------------------------------------------------------
-
-bool Connector::connect()
-{
-    if (connected) return true;
-    if (connecting || failed()) return false;
-
-    size_t addrlen = 0;
-    const struct sockaddr* addr = getAddress(addrlen);
-
-    if (socket.connect(addr, addrlen)) {
-        connected = true;
-        return true;
-    } else if (socket.failed()) {
-        return false;
-    } else {
-        connecting = true;
-        socket.events |= POLLOUT;
-        return false;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void Connector::handleWritable()
-{
-    if (!connecting) return;
-
-    connecting = false;
-    socket.events &= ~POLLOUT;
-
-    int error = 0;
-    socklen_t len = sizeof(error);
-    if (getsockopt(socket.fd, SOL_SOCKET, SO_ERROR, &error, &len)<0) {
-        socket.setErrorCodeFromErrno();
-    } else {
-        if (error==0) {
-            connected = true;
-        } else {
-            socket.setErrorCode(error);
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Connector.h
===================================================================
--- src/xplcommon/posix/Connector.h	(revision 14)
+++ 	(revision )
@@ -1,163 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_CONNECTOR_H
-#define XPLCOMMON_POSIX_CONNECTOR_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-#include "ClientSocket.h"
-
-#include <cstdlib>
-
-//------------------------------------------------------------------------------
-
-struct sockaddr;
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * Class representing the creation of a connection to some remote
- * entity, like a socket or a pipe.
- */
-class Connector : public FailableReference<Connector>
-{
-private:
-    /**
-     * The socket on behalf of which the connection is being
-     * performed.
-     */
-    ClientSocket& socket;
-
-    /**
-     * Indicate that we are in the process of connecting.
-     */
-    bool connecting;
-
-    /**
-     * Indicate that we are connected.
-     */
-    bool connected;
-
-protected:
-    /**
-     * Construct the connector.
-     */
-    Connector(ClientSocket* socket);
-
-public:
-    /**
-     * Connect to an address properly set up.
-     *
-     * If the connection succeeds immediately, it indicates success.
-     *
-     * If the connection does not succeed, because it would block, it
-     * sets up the socket to wait for the connection to succeed, and
-     * returns failure.
-     *
-     * If the connection fails for another reason, the error code is
-     * set, and false is returned.
-     */
-    bool connect();
-
-protected:
-    /**
-     * Get the parameters for connecting.
-     */
-    virtual const struct sockaddr* getAddress(size_t& addrlen) = 0;
-
-    /**
-     * Handle the event that the socket is writable.
-     *
-     * If connection is in progress, this function returns
-     * immediately.
-     *
-     * Otherwise it reads the error code using getsockopt(), and if it
-     * indicates success, the connector is set to connected, otherwise
-     * it is set to failed.
-     */
-    void handleWritable();
-
-private:
-    /**
-     * Get the failable object.
-     */
-    const ::xplcommon::Failable& getFailable() const;
-
-    /**
-     * Get the failable object.
-     */
-    ::xplcommon::Failable& getFailable();
-
-    friend class FailableReference<Connector>;
-    friend class ClientSocket;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Connector::Connector(ClientSocket* socket) :
-    socket(*socket),
-    connecting(false),
-    connected(false)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline const ::xplcommon::Failable& Connector::getFailable() const
-{
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-inline ::xplcommon::Failable& Connector::getFailable()
-{
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_CONNECTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalAcceptor.h
===================================================================
--- src/xplcommon/posix/LocalAcceptor.h	(revision 11)
+++ 	(revision )
@@ -1,122 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_LOCALACCEPTOR_H
-#define XPLCOMMON_POSIX_LOCALACCEPTOR_H
-//------------------------------------------------------------------------------
-
-#include "Acceptor.h"
-
-#include "LocalSocket.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * An acceptor that provides a LocalSocket for each accepted
- * connection.
- */
-class LocalAcceptor : public Acceptor
-{
-private:
-    /**
-     * Construct the acceptor.
-     *
-     * @param addressLength the length of the buffer for the peer
-     * address. If 0, not buffer will be created.
-     */
-    LocalAcceptor(ServerSocket* socket);
-
-public:
-    /**
-     * Get the local socket accepted last. If no socket was accepted,
-     * return 0. The local socket's waiter will be the given one
-     * (which can be 0).
-     */
-    LocalSocket* getSocket(Waiter* waiter,
-                           size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY,
-                           size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY);
-    /**
-     * Get the local socket accepted last. If no socket was accepted,
-     * return 0. The local socket's waiter will be the same as that of
-     * the associated server socket.
-     */
-    LocalSocket* getSocket(size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY,
-                           size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY);
-
-
-    friend class LocalServerSocket;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalAcceptor::LocalAcceptor(ServerSocket* socket) :
-    Acceptor(socket)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalSocket* LocalAcceptor::getSocket(Waiter* waiter,
-                                             size_t readingCapacity,
-                                             size_t writingCapacity)
-{
-    if (acceptedFD<0) return 0;
-
-    LocalSocket* socket = new LocalSocket(acceptedFD, waiter,
-                                          readingCapacity, writingCapacity);
-    connectionProcessed();
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalSocket* LocalAcceptor::getSocket(size_t readingCapacity,
-                                             size_t writingCapacity)
-{
-    return getSocket(socket.getWaiter(), readingCapacity, writingCapacity);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_LOCALACCEPTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalClientSocket.cc
===================================================================
--- src/xplcommon/posix/LocalClientSocket.cc	(revision 21)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "LocalClientSocket.h"
-
-#include "LocalConnector.h"
-#include "LocalServerSocket.h"
-
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::LocalClientSocket;
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-LocalClientSocket::LocalClientSocket(const char* name, Waiter* waiter,
-                                     size_t readingCapacity,
-                                     size_t writingCapacity) :
-    ClientSocket(AF_UNIX, SOCK_STREAM, connector, waiter, 0,
-                 readingCapacity, writingCapacity),
-    connector(this, name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalClientSocket.h
===================================================================
--- src/xplcommon/posix/LocalClientSocket.h	(revision 21)
+++ 	(revision )
@@ -1,101 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_LOCALCLIENTSOCKET_H
-#define XPLCOMMON_POSIX_LOCALCLIENTSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "ClientSocket.h"
-
-#include "LocalConnector.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * Client socket that connects to a server socket locally (i.e. a Unit
- * socket).
- *
- * The server socket's name should be given. The name will be used as
- * described for LocalServerSocket.
- */
-class LocalClientSocket : public ClientSocket
-{
-private:
-    /**
-     * The address to use for connecting.
-     */
-    LocalConnector connector;
-
-public:
-    /**
-     * Construct the client socket with the given name.
-     *
-     * @param waiter the waiter to use for waiting a possible event
-     * occuring on the socket. If given, the socket will be
-     * non-blocking. Otherwise, it will be blocking, and the connect()
-     * function of the Connector might block as well as the reading
-     * and writing buffers.
-     */
-    LocalClientSocket(const char* name, Waiter* waiter = 0,
-                      size_t readingCapacity = DEFAULT_CAPACITY,
-                      size_t writingCapacity = DEFAULT_CAPACITY);
-
-    /**
-     * Get the connector for this client.
-     */
-    LocalConnector& getConnector();
-
-    friend class LocalConnector;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalConnector& LocalClientSocket::getConnector()
-{
-    return connector;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_LOCALCLIENTSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalConnector.cc
===================================================================
--- src/xplcommon/posix/LocalConnector.cc	(revision 21)
+++ 	(revision )
@@ -1,52 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "LocalConnector.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::LocalConnector;
-
-//------------------------------------------------------------------------------
-
-const struct sockaddr* LocalConnector::getAddress(size_t& addrlen)
-{
-    addrlen = sizeof(address);
-    return reinterpret_cast<const struct sockaddr*>(&address);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalConnector.h
===================================================================
--- src/xplcommon/posix/LocalConnector.h	(revision 21)
+++ 	(revision )
@@ -1,90 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_LOCALCONNECTOR_H
-#define XPLCOMMON_POSIX_LOCALCONNECTOR_H
-//------------------------------------------------------------------------------
-
-#include "Connector.h"
-
-#include "LocalServerSocket.h"
-
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * The connector class used by the local client socket.
- */
-class LocalConnector : public Connector
-{
-private:
-    /**
-     * The reference to the corresponding socket's address.
-     */
-    struct sockaddr_un address;
-
-public:
-    /**
-     * Create the connector for the given local client socket.
-     */
-    LocalConnector(ClientSocket* socket, const char* name);
-
-protected:
-    /**
-     * Get the address.
-     */
-    virtual const struct sockaddr* getAddress(size_t& addrlen);
-};
-
-//------------------------------------------------------------------------------
-
-inline LocalConnector::LocalConnector(ClientSocket* socket, const char* name) :
-    Connector(socket)
-{
-    address.sun_family = AF_UNIX;
-    LocalServerSocket::setupPath(address, name);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_LOCALCONNECTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalServerSocket.cc
===================================================================
--- src/xplcommon/posix/LocalServerSocket.cc	(revision 18)
+++ 	(revision )
@@ -1,110 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "LocalServerSocket.h"
-
-#include <cstdio>
-
-#include <pwd.h>
-#include <unistd.h>
-#include <poll.h>
-
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::LocalServerSocket;
-
-//------------------------------------------------------------------------------
-
-void LocalServerSocket::setupPath(struct sockaddr_un& addr, const char* name)
-{
-#ifndef P_tmpdir
-#define P_tmpdir "/tmp"
-#endif
-    struct passwd* passwd = getpwuid(geteuid());
-    const char* userName = (passwd==0) ? "unknown" : passwd->pw_name;
-    snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s-%s",
-             P_tmpdir, name, userName);
-}
-
-//------------------------------------------------------------------------------
-
-LocalServerSocket::LocalServerSocket(const char* name, Waiter* waiter) :
-    ServerSocket(AF_UNIX, SOCK_STREAM, waiter),
-    acceptor(this)
-{
-    sun.sun_family = AF_UNIX;
-    setupPath(sun, name);
-
-    unlink(sun.sun_path);
-
-    if (bind(reinterpret_cast<struct sockaddr*>(&sun), sizeof(sun), false)<0) {
-        setErrorCode(errno);
-        return;
-    }
-
-    if (listen()<0) {
-        setErrorCode(errno);
-        return;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-LocalServerSocket::~LocalServerSocket()
-{
-    unlink(sun.sun_path);
-}
-
-//------------------------------------------------------------------------------
-
-bool LocalServerSocket::isReady()
-{
-    return false;
-}
-
-//------------------------------------------------------------------------------
-
-void LocalServerSocket::handleEvents(short events)
-{
-    if ((events&POLLIN)==POLLIN) {
-        acceptor.accept();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalServerSocket.h
===================================================================
--- src/xplcommon/posix/LocalServerSocket.h	(revision 18)
+++ 	(revision )
@@ -1,131 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_LOCALSERVERSOCKET_H
-#define XPLCOMMON_POSIX_LOCALSERVERSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "ServerSocket.h"
-
-#include "LocalAcceptor.h"
-
-#include <sys/un.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A server socket that works locally, i.e. a Unix socket.
- *
- * It is identified by a name that should be unique for the user. The
- * actual socket will be created with the name /tmp/<name>-<username>.
- */
-class LocalServerSocket : public ServerSocket
-{
-public:
-    /**
-     * Fill in the path of the socket with the given name.
-     */
-    static void setupPath(struct sockaddr_un& addr, const char* name);
-
-private:
-    /**
-     * Our address (to be used when deleting the file in the
-     * destructor.
-     */
-    struct sockaddr_un sun;
-
-    /**
-     * The acceptor to use for accepting connections.
-     */
-    LocalAcceptor acceptor;
-
-public:
-    /**
-     * Construct the socket with the given name.
-     *
-     * It will be bound to the name and able to listen for incoming
-     * connections.
-     *
-     * @param waiter the waiter to use for waiting a possible event
-     * occuring on the socket. If given, the socket will be
-     * non-blocking. Otherwise, it will be blocking, and the accept()
-     * function of the Acceptor might block.
-     */
-    LocalServerSocket(const char* name, Waiter* waiter = 0);
-
-    /**
-     * Destroy the socket by deleting the file.
-     */
-    virtual ~LocalServerSocket();
-
-    /**
-     * Get the acceptor.
-     */
-    LocalAcceptor& getAcceptor();
-
-protected:
-    /**
-     * Indicate if the waitable is ready, i.e. there is no need to
-     * wait for it.
-     */
-    virtual bool isReady();
-
-    /**
-     * Handle the given events.
-     */
-    virtual void handleEvents(short events);
-
-    friend class LocalAcceptor;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalAcceptor& LocalServerSocket::getAcceptor()
-{
-    return acceptor;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_LOCALSERVERSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/LocalSocket.h
===================================================================
--- src/xplcommon/posix/LocalSocket.h	(revision 11)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_LOCALSOCKET_H
-#define XPLCOMMON_POSIX_LOCALSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "Socket.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A socket that works on a local (Unix) connection.
- */
-class LocalSocket : public Socket
-{
-private:
-    /**
-     * Construct the socket with the given parameters.
-     */
-    LocalSocket(int fd, Waiter* waiter = 0,
-                size_t readingCapacity = DEFAULT_CAPACITY,
-                size_t writingCapacity = DEFAULT_CAPACITY);
-
-    friend class LocalAcceptor;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalSocket::LocalSocket(int fd, Waiter* waiter,
-                                size_t readingCapacity,
-                                size_t writingCapacity) :
-    Socket(fd, waiter, readingCapacity, writingCapacity)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_LOCALSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Makefile.am
===================================================================
--- src/xplcommon/posix/Makefile.am	(revision 34)
+++ 	(revision )
@@ -1,42 +1,0 @@
-noinst_LTLIBRARIES=libxplcommon_posix.la
-
-libxplcommon_posix_la_SOURCES =	\
-	Thread.cc		\
-	CondVar.cc		\
-	Waitable.cc		\
-	Waiter.cc		\
-	WaitableEvent.cc	\
-	ReadingBuffer.cc	\
-	WritingBuffer.cc	\
-	BufferedStream.cc	\
-	Acceptor.cc		\
-	ServerSocket.cc		\
-	Socket.cc		\
-	Connector.cc		\
-	ClientSocket.cc		\
-	LocalServerSocket.cc	\
-	LocalConnector.cc	\
-	LocalClientSocket.cc
-
-include_xplcommon_posixdir=$(includedir)/xplcommon/posix
-include_xplcommon_posix_HEADERS=\
-	Thread.h		\
-	Mutex.h			\
-	CondVar.h		\
-	Waitable.h		\
-	Waiter.h		\
-	WaitableEvent.h		\
-	StreamBuffer.h		\
-	ReadingBuffer.h		\
-	WritingBuffer.h		\
-	BufferedStream.h	\
-	Acceptor.h		\
-	ServerSocket.h		\
-	Socket.h		\
-	Connector.h		\
-	ClientSocket.h		\
-	LocalSocket.h		\
-	LocalAcceptor.h		\
-	LocalServerSocket.h	\
-	LocalConnector.h	\
-	LocalClientSocket.h
Index: c/xplcommon/posix/Mutex.h
===================================================================
--- src/xplcommon/posix/Mutex.h	(revision 34)
+++ 	(revision )
@@ -1,133 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_MUTEX_H
-#define XPLCOMMON_POSIX_MUTEX_H
-//------------------------------------------------------------------------------
-
-#include <pthread.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * Mutual exclusion device for POSIX threads.
- */
-class Mutex
-{
-private:
-    /**
-     * The mutex structure.
-     */
-    pthread_mutex_t mutex;
-
-public:
-    /**
-     * Construct the mutex.
-     */
-    Mutex();
-
-    /**
-     * Destroy the mutex.
-     */
-    ~Mutex();
-
-    /**
-     * Lock the mutex. If the mutex is locked by another thread, the
-     * caller one waits until the other thread releases the mutex.
-     */
-    void lock();
-
-    /**
-     * Try to lock the mutex. If the mutex is locked by another
-     * thread, this function returns false immediately. Otherwise it
-     * locks the mutex and returns true.
-     */
-    bool tryLock();
-
-    /**
-     * Unlock the mutex.
-     */
-    void unlock();
-
-    friend class CondVar;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Mutex::Mutex()
-{
-    pthread_mutex_init(&mutex, 0);
-}
-
-//------------------------------------------------------------------------------
-
-inline Mutex::~Mutex()
-{
-    pthread_mutex_destroy(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline void Mutex::lock()
-{
-    pthread_mutex_lock(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Mutex::tryLock()
-{
-    return pthread_mutex_trylock(&mutex)==0;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Mutex::unlock()
-{
-    pthread_mutex_unlock(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_MUTEX_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/ReadingBuffer.cc
===================================================================
--- src/xplcommon/posix/ReadingBuffer.cc	(revision 29)
+++ 	(revision )
@@ -1,77 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ReadingBuffer.h"
-
-#include "BufferedStream.h"
-
-#include <cassert>
-
-#include <poll.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::ReadingBuffer;
-
-//------------------------------------------------------------------------------
-
-bool ReadingBuffer::read()
-{
-    if (failed()) return false;
-
-    if (getLength()>0) {
-        stream.events &= ~POLLIN;
-        return true;
-    }
-
-    ssize_t result = stream.read(getData(), getCapacity());
-    if (result<0) {
-        if (stream.failed()) {
-            stream.events &= ~POLLIN;
-        } else {
-            stream.events |= POLLIN;
-        }
-    } else {
-        stream.events &= ~POLLIN;
-        size_t added = addLength(result);
-        assert(static_cast<ssize_t>(added)==result);
-        assert(static_cast<ssize_t>(getLength())==result);
-    }
-    return result>=0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/ReadingBuffer.h
===================================================================
--- src/xplcommon/posix/ReadingBuffer.h	(revision 16)
+++ 	(revision )
@@ -1,101 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_READINGBUFFER_H
-#define XPLCOMMON_POSIX_READINGBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "StreamBuffer.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffer used for reading.
- *
- * It should be made empty, and then the function read() should be
- * called on it. If it returns true, some data could be read. If the
- * amount of data read is 0, that indicates and end-of-file condition.
- */
-class ReadingBuffer : public StreamBuffer
-{
-protected:
-    /**
-     * Construct the buffer.
-     */
-    ReadingBuffer(size_t capacity, BufferedStream* stream);
-
-public:
-    /**
-     * Read into the buffer using the buffered stream if possible.
-     *
-     * If the buffer contains data, this function returns immediately
-     * with success, so the buffer should be reset before reading.
-     *
-     * If some data can be read immediately, that is stored in the
-     * buffer, and success is indicated. Success is indicated even if
-     * the amount of data read is 0, allowing for signalling the
-     * end-of-file or end-of-connection condition.
-     *
-     * If the reading operation would block, the stream is set up so
-     * that it would read, and failure is returned.
-     *
-     * Otherwise, if the reading operation fails for some other
-     * reason, the buffer's error code is set, so it should always be
-     * checked on a failure!
-     */
-    bool read();
-
-    friend class BufferedStream;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ReadingBuffer::ReadingBuffer(size_t capacity, BufferedStream* stream) :
-    StreamBuffer(capacity, stream)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_READINGBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/ServerSocket.cc
===================================================================
--- src/xplcommon/posix/ServerSocket.cc	(revision 19)
+++ 	(revision )
@@ -1,113 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ServerSocket.h"
-
-#include "Socket.h"
-
-#include <unistd.h>
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::ServerSocket;
-using xplcommon::posix::Acceptor;
-
-//------------------------------------------------------------------------------
-
-ServerSocket::ServerSocket(int domain, int type, Waiter* waiter, int protocol) :
-    Waitable(waiter, Socket::socket(domain, type, protocol))
-{
-    if (fd<0) setErrorCodeFromErrno();
-    else if (waiter!=0) setNonBlocking(fd);
-}
-
-//------------------------------------------------------------------------------
-
-ServerSocket::~ServerSocket()
-{
-    if (fd>=0) ::close(fd);
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerSocket::bind(const struct sockaddr* addr, size_t addrlen,
-                        bool reuseaddr)
-{
-    if (reuseaddr) {
-        int reuse = 1;
-        if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse))<0) {
-            setErrorCodeFromErrno();
-            return false;
-        }
-    }
-
-    if (::bind(fd, addr, addrlen)<0) {
-        setErrorCodeFromErrno();
-        return false;
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-bool ServerSocket::listen(int backlog)
-{
-    if (::listen(fd, backlog)<0) {
-        setErrorCodeFromErrno();
-        return false;
-    } else {
-        return true;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-int ServerSocket::accept(struct sockaddr* addr, size_t* addrlen)
-{
-    socklen_t alen = (addrlen==0) ? 0 : *addrlen;
-    int result = ::accept(fd, addr, (addrlen==0) ? 0 : &alen);
-    if (result<0 && errno!=EAGAIN && errno!=EWOULDBLOCK) {
-        setErrorCodeFromErrno();
-    } else {
-        if (addrlen!=0) *addrlen = alen;
-    }
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/ServerSocket.h
===================================================================
--- src/xplcommon/posix/ServerSocket.h	(revision 14)
+++ 	(revision )
@@ -1,115 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_SERVERSOCKET_H
-#define XPLCOMMON_POSIX_SERVERSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "Waitable.h"
-
-#include <cstdlib>
-
-//------------------------------------------------------------------------------
-
-struct sockaddr;
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-class Acceptor;
-
-//------------------------------------------------------------------------------
-
-/**
- * A socket in a server role. It can only bind to a new address,
- * listen and accept connections. It cannot connect to other sockets
- * and cannot be read or written.
- */
-class ServerSocket : public Waitable
-{
-protected:
-    /**
-     * Construct the server socket.
-     */
-    ServerSocket(int domain, int type, Waiter* waiter = 0, int protocol = 0);
-
-public:
-    /**
-     * Destroy the server socket.
-     */
-    virtual ~ServerSocket();
-
-protected:
-    /**
-     * Bind the socket to the given address.
-     *
-     * @param reuseaddr if set to true, the SO_REUSEADDR socket option
-     * will be set.
-     *
-     * @return if the binding has succeeded. If it is false, the error
-     * code will be set accordingly.
-     */
-    bool bind(const struct sockaddr* addr, size_t addrlen,
-              bool reuseaddr = true);
-
-    /**
-     * Start listening on the socket.
-     *
-     * @return if the call has succeeded. If it is false, the error
-     * code will be set accordingly.
-     */
-    bool listen(int backlog = 5);
-
-    /**
-     * Accept a socket.
-     *
-     * @return the accepted socket. If may be -1, if the socket is
-     * non-blocking, and no connection is available yet, or if another
-     * error occured, in which case the error code will be set properly.
-     */
-    int accept(struct sockaddr* addr, size_t* addrlen);
-
-    friend class Acceptor;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_SERVERSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Socket.cc
===================================================================
--- src/xplcommon/posix/Socket.cc	(revision 14)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Socket.h"
-
-#include <unistd.h>
-#include <sys/socket.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::Socket;
-
-//------------------------------------------------------------------------------
-
-int Socket::socket(int domain, int type, int protocol)
-{
-    return ::socket(domain, type, protocol);
-}
-
-//------------------------------------------------------------------------------
-
-Socket::~Socket()
-{
-    if (fd>=0) ::close(fd);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Socket.h
===================================================================
--- src/xplcommon/posix/Socket.h	(revision 19)
+++ 	(revision )
@@ -1,114 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_SOCKET_H
-#define XPLCOMMON_POSIX_SOCKET_H
-//------------------------------------------------------------------------------
-
-#include "BufferedStream.h"
-
-//------------------------------------------------------------------------------
-
-struct sockaddr;
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffered, waitable socket implementation.
- */
-class Socket : public BufferedStream
-{
-private:
-    /**
-     * Construct a socket with the given parameters.
-     */
-    static int socket(int domain, int type, int protocol);
-
-protected:
-    /**
-     * Construct the socket with the given parameters.
-     */
-    Socket(int domain, int type, Waiter* waiter = 0, int protocol = 0,
-           size_t readingCapacity = DEFAULT_CAPACITY,
-           size_t writingCapacity = DEFAULT_CAPACITY);
-
-    /**
-     * Construct the socket with the given file descriptor.
-     */
-    Socket(int fd, Waiter* waiter = 0,
-           size_t readingCapacity = DEFAULT_CAPACITY,
-           size_t writingCapacity = DEFAULT_CAPACITY);
-
-public:
-    /**
-     * Destroy the socket by closing the file descriptor.
-     */
-    virtual ~Socket();
-
-    friend class ServerSocket;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Socket::Socket(int domain, int type, Waiter* waiter, int protocol,
-                      size_t readingCapacity, size_t writingCapacity) :
-    BufferedStream(waiter, socket(domain, type, protocol),
-                     readingCapacity, writingCapacity)
-{
-    if (fd<0) setErrorCodeFromErrno();
-    else if (waiter!=0) setNonBlocking(fd);
-}
-
-//------------------------------------------------------------------------------
-
-inline Socket::Socket(int fd, Waiter* waiter,
-                      size_t readingCapacity, size_t writingCapacity) :
-    BufferedStream(waiter, fd, readingCapacity, writingCapacity)
-{
-    if (waiter!=0) setNonBlocking(fd);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_SOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/StreamBuffer.h
===================================================================
--- src/xplcommon/posix/StreamBuffer.h	(revision 16)
+++ 	(revision )
@@ -1,112 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_STREAMBUFFER_H
-#define XPLCOMMON_POSIX_STREAMBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "../Buffer.h"
-#include "../Failable.h"
-
-#include "BufferedStream.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for buffers used by a BufferedStream.
- */
-class StreamBuffer : public ::xplcommon::Buffer,
-                     public ::xplcommon::FailableReference<StreamBuffer>
-{
-protected:
-    /**
-     * Our buffered stream.
-     */
-    BufferedStream& stream;
-
-protected:
-    /**
-     * Construct the buffer with the given waitable.
-     */
-    StreamBuffer(size_t capacity, BufferedStream* stream);
-
-private:
-    /**
-     * Get the failable object.
-     */
-    const ::xplcommon::Failable& getFailable() const;
-
-    /**
-     * Get the failable object.
-     */
-    ::xplcommon::Failable& getFailable();
-
-    friend class FailableReference<StreamBuffer>;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline StreamBuffer::StreamBuffer(size_t capacity, BufferedStream* stream) :
-    Buffer(capacity),
-    stream(*stream)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline const ::xplcommon::Failable& StreamBuffer::getFailable() const
-{
-    return stream;
-}
-
-//------------------------------------------------------------------------------
-
-inline ::xplcommon::Failable& StreamBuffer::getFailable()
-{
-    return stream;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_STREAMBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Thread.cc
===================================================================
--- src/xplcommon/posix/Thread.cc	(revision 35)
+++ 	(revision )
@@ -1,67 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Thread.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::Thread;
-
-//------------------------------------------------------------------------------
-
-void* Thread::threadFn(void* arg)
-{
-    Thread* thread = reinterpret_cast<Thread*>(arg);
-    thread->run();
-    if (thread->detached) delete thread;
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-bool Thread::start()
-{
-    pthread_attr_t attr;
-    pthread_attr_init(&attr);
-    pthread_attr_setdetachstate(&attr, detached ? PTHREAD_CREATE_DETACHED :
-                                PTHREAD_CREATE_JOINABLE);
-    bool isOK = pthread_create(&thread, &attr, &threadFn, this)>=0;
-    pthread_attr_destroy(&attr);
-    return isOK;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Thread.h
===================================================================
--- src/xplcommon/posix/Thread.h	(revision 35)
+++ 	(revision )
@@ -1,139 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_THREAD_H
-#define XPLCOMMON_POSIX_THREAD_H
-//------------------------------------------------------------------------------
-
-#include <pthread.h>
-#include <unistd.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A pthreads-based thread implementation.
- */
-class Thread
-{
-public:
-    /**
-     * Sleep for the given number of milliseconds.
-     */
-    static void sleep(unsigned millis);
-
-private:
-    /**
-     * The thread-runner function.
-     */
-    static void* threadFn(void* arg);
-
-    /**
-     * Indicate if the thread is detached or not.
-     */
-    bool detached;
-
-    /**
-     * The posix thread handle.
-     */
-    pthread_t thread;
-
-public:
-    /**
-     * Construct the thread
-     */
-    Thread(bool detached = false);
-
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Thread();
-
-    /**
-     * Start the thread.
-     *
-     * @return if the thread could be started
-     */
-    bool start();
-
-    /**
-     * Perform the thread's real operation.
-     */
-    virtual void run() = 0;
-
-    /**
-     * Wait for the thread to quit.
-     */
-    void join();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void Thread::sleep(unsigned millis)
-{
-    usleep(static_cast<useconds_t>(millis)*1000);
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::Thread(bool detached) :
-    detached(detached)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::~Thread()
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline void Thread::join()
-{
-    pthread_join(thread, 0);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_THREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Waitable.cc
===================================================================
--- src/xplcommon/posix/Waitable.cc	(revision 4)
+++ 	(revision )
@@ -1,72 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Waitable.h"
-
-#include "Waiter.h"
-
-#include <fcntl.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::Waitable;
-
-//------------------------------------------------------------------------------
-
-void Waitable::setNonBlocking(int fd)
-{
-    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
-}
-
-//------------------------------------------------------------------------------
-
-Waitable::Waitable(Waiter* waiter, int fd, short events) :
-    waiter(waiter),
-    fd(fd),
-    events(events)
-{
-    if (waiter!=0) waiter->add(this);
-}
-
-//------------------------------------------------------------------------------
-
-Waitable::~Waitable()
-{
-    if (waiter!=0) waiter->remove(this);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Waitable.h
===================================================================
--- src/xplcommon/posix/Waitable.h	(revision 21)
+++ 	(revision )
@@ -1,162 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_WAITABLE_H
-#define XPLCOMMON_POSIX_WAITABLE_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-#include <cerrno>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-class Waiter;
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class of objects for which one can wait in a Waiter.
- *
- * It is basically a file descriptor.
- */
-class Waitable : public Failable
-{
-public:
-    /**
-     * Set the given file descriptor to non-blocking.
-     */
-    static void setNonBlocking(int fd);
-
-protected:
-    /**
-     * The waiter this waitable belongs to, if any.
-     */
-    Waiter* waiter;
-
-    /**
-     * The file descriptor
-     */
-    int fd;
-
-    /**
-     * The events this waitable is interested in.
-     */
-    short events;
-
-protected:
-    /**
-     * Construct the waitable.
-     */
-    Waitable(Waiter* waiter, int fd = -1, short events = 0);
-
-public:
-    /**
-     * Destroy the waitable. It will be removed from the waiter.
-     */
-    virtual ~Waitable();
-
-    /**
-     * Get the waiter.
-     */
-    Waiter* getWaiter() const;
-
-    /**
-     * Determine if the waitable is ready or not, i.e. if there is no
-     * need to wait for it.
-     *
-     * It first checks the events. If they are 0, the waitable is
-     * ready. Then it calls isReady() and returns the result of that
-     * function.
-     */
-    bool ready();
-
-protected:
-    /**
-     * Indicate if the waitable is ready, i.e. there is no need to
-     * wait for it.
-     *
-     * Calling this function should not delete the ready
-     * indication. It should be deleted by actually processing the
-     * data.
-     */
-    virtual bool isReady() = 0;
-
-    /**
-     * Handle the given events.
-     */
-    virtual void handleEvents(short events) = 0;
-
-    /**
-     * Set the error code from errno.
-     */
-    void setErrorCodeFromErrno();
-
-    friend class Waiter;
-};
-
-//------------------------------------------------------------------------------
-// Inline defintions
-//------------------------------------------------------------------------------
-
-inline Waiter* Waitable::getWaiter() const
-{
-    return waiter;
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Waitable::ready()
-{
-    return (events==0) || isReady();
-}
-
-//------------------------------------------------------------------------------
-
-inline void Waitable::setErrorCodeFromErrno()
-{
-    setErrorCode(errno);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIXWAITABLE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/WaitableEvent.cc
===================================================================
--- src/xplcommon/posix/WaitableEvent.cc	(revision 14)
+++ 	(revision )
@@ -1,127 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "WaitableEvent.h"
-
-#include <poll.h>
-#include <unistd.h>
-
-#include <sys/eventfd.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::WaitableEvent;
-
-//------------------------------------------------------------------------------
-
-WaitableEvent::WaitableEvent(Waiter* waiter) :
-    Waitable(waiter, eventfd(0, (waiter==0) ? 0 : EFD_NONBLOCK), POLLIN),
-    fired(false)
-{
-    if (fd<0) {
-        setErrorCodeFromErrno();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-WaitableEvent::~WaitableEvent()
-{
-    close(fd);
-}
-
-//------------------------------------------------------------------------------
-
-void WaitableEvent::fire()
-{
-    static const uint64_t one = 1;
-    if (write(fd, &one, sizeof(one))<0) {
-        if (errno!=EAGAIN) {
-            setErrorCodeFromErrno();
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-
-bool WaitableEvent::check()
-{
-    if (doCheck()) {
-        fired = false;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-bool WaitableEvent::isReady()
-{
-    return fired;
-}
-
-//------------------------------------------------------------------------------
-
-void WaitableEvent::handleEvents(short events)
-{
-    if ((events&POLLIN)==POLLIN) {
-        doCheck();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-bool WaitableEvent::doCheck(bool fromHandleEvents)
-{
-    if (failed()) return false;
-    if (!fromHandleEvents && fired) return true;
-
-    uint64_t value = 0;
-    if (read(fd, &value, sizeof(value))<0) {
-        if (errno!=EAGAIN) {
-            setErrorCodeFromErrno();
-        }
-    } else {
-        fired = fired || value>0;
-    }
-
-    return fired;
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/WaitableEvent.h
===================================================================
--- src/xplcommon/posix/WaitableEvent.h	(revision 14)
+++ 	(revision )
@@ -1,107 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_WAITABLEEVENT_H
-#define XPLCOMMON_POSIX_WAITABLEEVENT_H
-//------------------------------------------------------------------------------
-
-#include "Waitable.h"
-
-#include "../Failable.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * An event on which one can wait with a waiter.
- */
-class WaitableEvent : public Waitable
-{
-private:
-    /**
-     * Indicate if the event is fired.
-     */
-    volatile bool fired;
-
-public:
-    /**
-     * Construct the event.
-     */
-    WaitableEvent(Waiter* waiter = 0);
-
-    /**
-     * Destroy the event.
-     */
-    virtual ~WaitableEvent();
-
-    /**
-     * Fire the event.
-     */
-    void fire();
-
-    /**
-     * Check if the event is fired or not. If so, the fired status
-     * will be cleared.
-     */
-    bool check();
-
-protected:
-    /**
-     * Check if the event is fired or not.
-     */
-    virtual bool isReady();
-
-    /**
-     * Handle the given events.
-     */
-    virtual void handleEvents(short events);
-
-private:
-    /**
-     * Perform the real check. If we already know that we are fired,
-     * just return true. Otherwise try to read from the event fd.
-     */
-    bool doCheck(bool fromHandleEvents = false);
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_WAITABLEEVENT_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Waiter.cc
===================================================================
--- src/xplcommon/posix/Waiter.cc	(revision 29)
+++ 	(revision )
@@ -1,155 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Waiter.h"
-
-#include "Waitable.h"
-
-#include <cassert>
-#include <cerrno>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::Waiter;
-
-//------------------------------------------------------------------------------
-
-inline bool Waiter::hasReady() const
-{
-    for(waitables_t::const_iterator i = waitables.begin(); i!=waitables.end();
-        ++i)
-    {
-        Waitable* waitable = i->second;
-        if (waitable->ready()) {
-            return true;
-        }
-    }
-    return false;
-}
-
-//------------------------------------------------------------------------------
-
-inline size_t Waiter::setupPollFDs(pollfd* pollFDs)
-{
-    size_t numValid = 0;
-
-    for(waitables_t::const_iterator i = waitables.begin(); i!=waitables.end();
-        ++i)
-    {
-        Waitable* waitable = i->second;
-        if (waitable->events==0) continue;
-
-        pollfd& pollFD = pollFDs[numValid++];
-
-        pollFD.fd = waitable->fd;
-        pollFD.events = waitable->events;
-        pollFD.revents = 0;
-    }
-
-    return numValid;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Waiter::processPollFDs(const pollfd* pollFDs, size_t size)
-{
-    for(size_t i = 0; i<size; ++i) {
-        const pollfd& pollFD = pollFDs[i];
-        if (pollFD.revents!=0) {
-            waitables_t::iterator j = waitables.find(pollFD.fd);
-            assert(j!=waitables.end());
-            Waitable* waitable = j->second;
-            waitable->handleEvents(pollFD.revents);
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-
-Waiter::~Waiter()
-{
-    for(waitables_t::iterator i = waitables.begin(); i!=waitables.end(); ++i)
-    {
-        Waitable* waitable = i->second;
-        waitable->waiter = 0;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-bool Waiter::wait(int timeout)
-{
-    if (hasReady()) return true;
-
-    pollfd pollFDs[numWaitables];
-    size_t numValid = setupPollFDs(pollFDs);
-
-    int result = poll(pollFDs, numValid, timeout);
-
-    if (result<0) {
-        setErrorCode(errno);
-        return false;
-    } else if (result>0) {
-        processPollFDs(pollFDs, numValid);
-    }
-
-    return hasReady();
-}
-
-//------------------------------------------------------------------------------
-
-void Waiter::add(Waitable* waitable)
-{
-    assert(waitable->fd>=0);
-    assert(waitables.find(waitable->fd)==waitables.end());
-    waitables[waitable->fd] = waitable;
-    ++numWaitables;
-}
-
-//------------------------------------------------------------------------------
-
-void Waiter::remove(Waitable* waitable)
-{
-    assert(numWaitables>0);
-    assert(waitables.find(waitable->fd)!=waitables.end());
-    assert(waitables[waitable->fd]==waitable);
-    waitables.erase(waitable->fd);
-    --numWaitables;
-}
-
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/Waiter.h
===================================================================
--- src/xplcommon/posix/Waiter.h	(revision 14)
+++ 	(revision )
@@ -1,155 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_WAITER_H
-#define XPLCOMMON_POSIX_WAITER_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-#include <map>
-
-#include <cstdlib>
-
-#include <poll.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-class Waitable;
-
-//------------------------------------------------------------------------------
-
-/**
- * Class that can be used to register waitable objects and then wait
- * for them.
- */
-class Waiter : public Failable
-{
-private:
-    /**
-     * Type for the set of waitables.
-     */
-    typedef std::map<int, Waitable*> waitables_t;
-
-    /**
-     * The set of waitables belonging to this waiter.
-     */
-    waitables_t waitables;
-
-    /**
-     * The number of waitables.
-     */
-    size_t numWaitables;
-
-public:
-    /**
-     * Construct the waiter.
-     */
-    Waiter();
-
-    /**
-     * Destroy the waiter. All waitables that still exists will be
-     * modified to point to no waiter.
-     */
-    ~Waiter();
-
-    /**
-     * Wait for any if the waitables to become ready or until a
-     * timeout expires.
-     *
-     * If any of the waitables are ready, the function returns immediately.
-     *
-     * @return true if any of the waitables has become ready, false if
-     * the timeout occurs.
-     */
-    bool wait(int timeout = -1);
-
-protected:
-    /**
-     * Add a waitable.
-     */
-    void add(Waitable* waitable);
-
-    /**
-     * Remove a waitable.
-     */
-    void remove(Waitable* waitable);
-
-private:
-    /**
-     * Determine if any of the waitables is ready.
-     */
-    bool hasReady() const;
-
-    /**
-     * Fill the given array of poll descriptors with those file
-     * descriptors that wait for an event.
-     *
-     * @param pollFDs the file descriptor array to fill. It should
-     * contain at least as many elements as the number of waitables.
-     *
-     * @return the number of valid poll file descriptors.
-     */
-    size_t setupPollFDs(pollfd* pollFDs);
-
-    /**
-     * Process the given array of poll descriptors. For each
-     * descriptor, if its events are not 0, the handleEvents()
-     * function of the corresponding waitable is called.
-     */
-    void processPollFDs(const pollfd* pollFDs, size_t size);
-
-    friend class Waitable;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Waiter::Waiter() :
-    numWaitables(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_WAITABLE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/WritingBuffer.cc
===================================================================
--- src/xplcommon/posix/WritingBuffer.cc	(revision 16)
+++ 	(revision )
@@ -1,85 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "WritingBuffer.h"
-
-#include "BufferedStream.h"
-
-#include <poll.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::posix::WritingBuffer;
-
-//------------------------------------------------------------------------------
-
-void WritingBuffer::reset()
-{
-    Buffer::reset();
-    offset = 0;
-    stream.events &= ~POLLOUT;
-}
-
-//------------------------------------------------------------------------------
-
-bool WritingBuffer::write()
-{
-    if (failed()) return false;
-
-    if (getLength()<=offset) {
-        reset();
-        return true;
-    }
-
-    size_t toWrite = getLength() - offset;
-
-    ssize_t result = stream.write(getData() + offset, toWrite);
-    if (result<static_cast<ssize_t>(toWrite)) {
-        if (result<0 && stream.failed()) {
-            stream.events &= ~POLLOUT;
-        } else {
-            stream.events |= POLLOUT;
-            if (result>0) offset += result;
-        }
-        return false;
-    } else {
-        reset();
-        return true;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/posix/WritingBuffer.h
===================================================================
--- src/xplcommon/posix/WritingBuffer.h	(revision 16)
+++ 	(revision )
@@ -1,114 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_POSIX_WRITINGBUFFER_H
-#define XPLCOMMON_POSIX_WRITINGBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "StreamBuffer.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace posix {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffer used for writing.
- *
- * The data to write should be stored in the buffer. Then write()
- * should be called. If it returns true, it indicates that all data
- * has been written. In that case the buffer is automatically emptied.
- */
-class WritingBuffer : public StreamBuffer
-{
-private:
-    /**
-     * The offset of the next byte to write.
-     */
-    size_t offset;
-
-protected:
-    /**
-     * Construct the buffer.
-     */
-    WritingBuffer(size_t capacity, BufferedStream* stream);
-
-public:
-    /**
-     * Reset the buffer. It resets the offset too.
-     */
-    void reset();
-
-    /**
-     * Write the contents of the buffer using the associated buffered
-     * stream.
-     *
-     * If the buffer is empty, the function returns indicating
-     * success.
-     *
-     * If the complete remaining contents could be written, it also indicates
-     * success, and the buffer is reset, ready to be used again.
-     *
-     * If not everything can be written and the write operation
-     * indicates that it would block, this function returns failure
-     * after the stream has been set up  to handle the corresponding
-     * poll events.
-     *
-     * Otherwise, if the writing operation fails for some other
-     * reason, the buffer's error code is set to the error's code and
-     * false is returned.
-     */
-    bool write();
-
-    friend class BufferedStream;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline WritingBuffer::WritingBuffer(size_t capacity, BufferedStream* stream):
-    StreamBuffer(capacity, stream),
-    offset(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::posix */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_POSIX_WRITINGBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/types.h
===================================================================
--- src/xplcommon/types.h	(revision 20)
+++ 	(revision )
@@ -1,77 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_TYPES_H
-#define XPLCOMMON_TYPES_H
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-#if TARGET_API_WIN32
-#include <windows.h>
-#endif
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-typedef DWORD errorCode_t;
-static const DWORD XPL_NO_ERROR = 0;
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-typedef int errorCode_t;
-static const int XPL_NO_ERROR = 0;
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_TYPES_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/.copyright
===================================================================
--- src/xplcommon/win32/.copyright	(revision 3)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
Index: c/xplcommon/win32/.namespace
===================================================================
--- src/xplcommon/win32/.namespace	(revision 3)
+++ 	(revision )
@@ -1,2 +1,0 @@
-xplcommon
-win32
Index: c/xplcommon/win32/.srcmessage
===================================================================
--- src/xplcommon/win32/.srcmessage	(revision 3)
+++ 	(revision )
@@ -1,2 +1,0 @@
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
Index: c/xplcommon/win32/BufferedStream.cc
===================================================================
--- src/xplcommon/win32/BufferedStream.cc	(revision 22)
+++ 	(revision )
@@ -1,113 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "BufferedStream.h"
-
-#include "ReadingBuffer.h"
-#include "WritingBuffer.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::BufferedStream;
-
-//------------------------------------------------------------------------------
-
-BufferedStream::BufferedStream(Waiter* waiter, HANDLE handle,
-                               size_t readingCapacity, size_t writingCapacity) :
-    Overlappable(waiter, handle),
-    readingBuffer( (readingCapacity==0) ? 0 :
-                   new ReadingBuffer(readingCapacity, this)),
-    writingBuffer( (writingCapacity==0) ? 0 :
-                   new WritingBuffer(writingCapacity, this))
-{
-}
-
-//------------------------------------------------------------------------------
-
-BufferedStream::~BufferedStream()
-{
-    delete writingBuffer;
-    delete readingBuffer;
-}
-
-//------------------------------------------------------------------------------
-
-ssize_t BufferedStream::read(void* dest, size_t length, Overlapped* overlapped)
-{
-    DWORD numRead = 0;
-    if (overlapped!=0) overlapped->reset();
-    bool result = ReadFile(handle, dest, length,
-                           (overlapped==0) ? &numRead : 0,
-                           (overlapped==0) ? 0 : overlapped->get());
-    DWORD error = GetLastError();
-    if (!result &&
-        (overlapped==0 ||
-         (error!=ERROR_IO_PENDING && error!=ERROR_IO_INCOMPLETE)))
-    {
-        setErrorCode(error);
-        return -1;
-    } else if (overlapped==0 || overlapped->getResult(numRead, handle)) {
-        return numRead;
-    } else {
-        return -1;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-bool BufferedStream::write(const void* src, size_t length,
-                           Overlapped* overlapped)
-{
-    if (overlapped!=0) overlapped->reset();
-    bool result = WriteFile(handle, src, length, 0,
-                            (overlapped==0) ? 0 : overlapped->get());
-    DWORD error = GetLastError();
-    if (!result &&
-        (overlapped==0 ||
-         (error!=ERROR_IO_PENDING && error!=ERROR_IO_INCOMPLETE)))
-    {
-        setErrorCode(error);
-        return false;
-    } else if (overlapped==0) {
-        return result;
-    } else {
-        DWORD numWritten = 0;
-        return overlapped->getResult(numWritten, handle);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/BufferedStream.h
===================================================================
--- src/xplcommon/win32/BufferedStream.h	(revision 21)
+++ 	(revision )
@@ -1,153 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_BUFFEREDSTREAM_H
-#define XPLCOMMON_WIN32_BUFFEREDSTREAM_H
-//------------------------------------------------------------------------------
-
-#include "Overlappable.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class ReadingBuffer;
-class WritingBuffer;
-class Overlapped;
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffered stream.
- *
- * It wraps a HANDLE which can be read and/or written with ReadFile or
- * WriteFile, respectively.
- */
-class BufferedStream : public Overlappable
-{
-public:
-    /**
-     * The default capacity.
-     */
-    static const size_t DEFAULT_CAPACITY = 4096;
-
-private:
-    /**
-     * The reading buffer. It may be 0, if no reading buffer is
-     * associated with this waitable.
-     */
-    ReadingBuffer* readingBuffer;
-
-    /**
-     * The writing buffer. It may be 0, if no writing buffer is
-     * associated with this waitable.
-     */
-    WritingBuffer* writingBuffer;
-
-protected:
-    /**
-     * Construct the buffered stream.
-     */
-    BufferedStream(Waiter* waiter = 0, HANDLE handle = 0,
-                   size_t readingCapacity = DEFAULT_CAPACITY,
-                   size_t writingCapacity = DEFAULT_CAPACITY);
-
-public:
-    /**
-     * Destroy the stream.
-     */
-    virtual ~BufferedStream();
-
-    /**
-     * Get the reference of the reading buffer. Note, that it can be a
-     * 0 reference, if the stream has no reading buffer.
-     */
-    ReadingBuffer& getReadingBuffer();
-
-    /**
-     * Get the reference of the writing buffer. Note, that it can be a
-     * 0 reference, if the stream has no writing buffer.
-     */
-    WritingBuffer& getWritingBuffer();
-
-protected:
-    /**
-     * Read using the handle at most the given number of bytes into
-     * the given buffer.
-     *
-     * @return the number of bytes read. If 0, it indicates the end of
-     * the file or connection. If negative, it means either a failure,
-     * or the fact that the operation cannot be completed at this time.
-     */
-    ssize_t read(void* dest, size_t length, Overlapped* overlapped);
-
-    /**
-     * Write using the handle the given number of bytes from the given
-     * buffer.
-     *
-     * @return whether the writing succeeded. If false, it is either a
-     * failure, or an inidication of the fact that the operation could
-     * not be completed.
-     */
-    bool write(const void* src, size_t length, Overlapped* overlapped);
-
-    friend class ReadingBuffer;
-    friend class WritingBuffer;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ReadingBuffer& BufferedStream::getReadingBuffer()
-{
-    return *readingBuffer;
-}
-
-//------------------------------------------------------------------------------
-
-inline WritingBuffer& BufferedStream::getWritingBuffer()
-{
-    return *writingBuffer;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_BUFFEREDSTREAM_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Completer.h
===================================================================
--- src/xplcommon/win32/Completer.h	(revision 24)
+++ 	(revision )
@@ -1,220 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_COMPLETER_H
-#define XPLCOMMON_WIN32_COMPLETER_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-#include "Overlapped.h"
-#include "Overlappable.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for objects that handle the completion of some
- * operation. They are associated with an Overlappable, and if that
- * overlappable is non-blocking (i.e. has a waiter), an Overlapped
- * object is created and stored in this object.
- */
-class Completer : public ::xplcommon::FailableReference<Completer>
-{
-protected:
-    /**
-     * The overlappable object this completer belongs to.
-     */
-    Overlappable& overlappable;
-
-    /**
-     * The overlapped object.
-     */
-    Overlapped* overlapped;
-
-protected:
-    /**
-     * Construct the completer for the given Overlappable.
-     */
-    Completer(Overlappable* overlappable);
-
-    /**
-     * Destroy the completer.
-     */
-    virtual ~Completer();
-
-    /**
-     * Add the overlapped object (if any) to the given waiter.
-     */
-    void addTo(Waiter* waiter);
-
-    /**
-     * Remove the overlapped object (if any) from the waiter it is
-     * associated with.
-     */
-    void removeFromWaiter();
-
-    /**
-     * Determine if there is an overlapped object and it is being
-     * waited for.
-     */
-    bool isWaited() const;
-
-    /**
-     * Get the result of the overlapped operation, if any.
-     *
-     * @see Overlapped::getResult
-     */
-    bool getResult(DWORD& size);
-
-    /**
-     * Check whether we are waiting for an overlapped result and if
-     * so, return that.
-     *
-     * @param result will contain the result to return if we are
-     * waiting for an overlapped result.
-     *
-     * @return whether we are waiting for an overlapped result
-     */
-    bool checkWaitedResult(bool& result);
-
-    /**
-     * Handle the given result coming from an overlapped object.
-     */
-    virtual void handleWaitedResult(DWORD size) = 0;
-
-private:
-    /**
-     * Get the failable object.
-     */
-    const ::xplcommon::Failable& getFailable() const;
-
-    /**
-     * Get the failable object.
-     */
-    ::xplcommon::Failable& getFailable();
-
-    friend class FailableReference<Completer>;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Completer::Completer(Overlappable* overlappable) :
-    overlappable(*overlappable),
-    overlapped((overlappable->waiter==0) ? 0 : new Overlapped(*overlappable))
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Completer::~Completer()
-{
-    delete overlapped;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Completer::addTo(Waiter* waiter)
-{
-    if (overlapped!=0 && waiter!=0) overlapped->addTo(*waiter);
-}
-
-//------------------------------------------------------------------------------
-
-inline void Completer::removeFromWaiter()
-{
-    if (overlapped!=0) overlapped->removeFromWaiter();
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Completer::isWaited() const
-{
-    return overlapped!=0 && overlapped->isWaited();
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Completer::getResult(DWORD& size)
-{
-    return overlapped!=0 && overlapped->getResult(size, overlappable.handle);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Completer::checkWaitedResult(bool& result)
-{
-    if (!isWaited()) {
-        return false;
-    }
-
-    DWORD size = 0;
-    result = getResult(size);
-
-    if (result) {
-        removeFromWaiter();
-        handleWaitedResult(size);
-    } else if (overlappable.failed()) {
-        removeFromWaiter();
-    }
-
-    return true;
-}
-
-//------------------------------------------------------------------------------
-
-inline const ::xplcommon::Failable& Completer::getFailable() const
-{
-    return overlappable;
-}
-
-//------------------------------------------------------------------------------
-
-inline ::xplcommon::Failable& Completer::getFailable()
-{
-    return overlappable;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_COMPLETER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/CondVar.cc
===================================================================
--- src/xplcommon/win32/CondVar.cc	(revision 34)
+++ 	(revision )
@@ -1,88 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "CondVar.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::CondVar;
-
-//------------------------------------------------------------------------------
-
-bool CondVar::wait(Mutex& inMutex, int timeout)
-{
-    mutex.lock();
-    ++numWaiters;
-    size_t generation = waitGeneration;
-    mutex.unlock();
-
-    inMutex.unlock();
-
-    bool lastWaiter = false;
-    bool wokenUp = false;
-    bool waitDone = false;
-    while (!waitDone) {
-        int result = WaitForSingleObject(event,
-                                         (timeout<0) ? INFINITE : timeout);
-        if (result==WAIT_OBJECT_0) {
-            mutex.lock();
-            waitDone = numToRelease>0 && generation!=waitGeneration;
-            if (waitDone) {
-                --numToRelease;
-                lastWaiter = numToRelease == 0;
-                wokenUp = true;
-            }
-            mutex.unlock();
-        } else {
-            waitDone = true;
-        }
-    }
-
-    inMutex.lock();
-
-    mutex.lock();
-    --numWaiters;
-    mutex.unlock();
-
-    if (lastWaiter) {
-        ResetEvent(event);
-    }
-
-    return wokenUp;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/CondVar.h
===================================================================
--- src/xplcommon/win32/CondVar.h	(revision 34)
+++ 	(revision )
@@ -1,168 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_CONDVAR_H
-#define XPLCOMMON_WIN32_CONDVAR_H
-//------------------------------------------------------------------------------
-
-#include "Mutex.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A condition variable for the Win32 API.
- *
- * Note: the CONDITION_VARIABLE structure and the associated functions
- * are available only starting with the Windows Vista API. However,
- * for the time being we also want to support Windows XP, hence this
- * rather fancy implementation.
- */
-class CondVar
-{
-private:
-    /**
-     * The mutex protecting the internal data structures.
-     */
-    Mutex mutex;
-
-    /**
-     * The number of waiters.
-     */
-    size_t numWaiters;
-
-    /**
-     * The wait generation.
-     */
-    size_t waitGeneration;
-
-    /**
-     * The number of waiters to release.
-     */
-    size_t numToRelease;
-
-    /**
-     * The event to use for waiting.
-     */
-    HANDLE event;
-
-public:
-    /**
-     * Construct the condition variable.
-     */
-    CondVar();
-
-    /**
-     * Destroy the condition variable.
-     */
-    ~CondVar();
-
-    /**
-     * Wait for the condition variable.
-     *
-     * @param mutex the mutex to unlock and re-lock.
-     * @param timeout the number of milliseconds to wait at most. If
-     * negative, the function will wait indefinitely.
-     *
-     * @return true, if the condition variable was signalled, false
-     * if a timeout occured
-     */
-    bool wait(Mutex& inMutex, int timeout = -1);
-
-    /**
-     * Signal the condition variable to wake up one thread.
-     */
-    void signal();
-
-    /**
-     * Signal all threads waiting on the condition variable.
-     */
-    void broadcast();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline CondVar::CondVar() :
-    numWaiters(0),
-    waitGeneration(0),
-    numToRelease(0)
-{
-    event  = CreateEvent(0, true, false, 0);
-}
-
-//------------------------------------------------------------------------------
-
-inline CondVar::~CondVar()
-{
-    CloseHandle(event);
-}
-
-//------------------------------------------------------------------------------
-
-inline void CondVar::signal()
-{
-    mutex.lock();
-    if (numWaiters>numToRelease) {
-        SetEvent(event);
-        ++numToRelease;
-        ++waitGeneration;
-    }
-    mutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-inline void CondVar::broadcast()
-{
-    mutex.lock();
-    if (numWaiters>0) {
-        SetEvent(event);
-        numToRelease = numWaiters;
-        ++waitGeneration;
-    }
-    mutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_CONDVAR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Event.cc
===================================================================
--- src/xplcommon/win32/Event.cc	(revision 21)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Event.h"
-
-#include "Waiter.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::Event;
-
-//------------------------------------------------------------------------------
-
-bool Event::isFired() const
-{
-    DWORD result = WaitForSingleObject(handle, (waiter==0) ? INFINITE : 0);
-    if (result==WAIT_FAILED) {
-        eventFailable.setErrorCode(GetLastError());
-        return false;
-    } else if (result==WAIT_OBJECT_0) {
-        return true;
-    } else {
-        return false;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-void Event::addTo(Waiter& w)
-{
-    removeFromWaiter();
-    w.add(this);
-    waiter = &w;
-}
-
-//------------------------------------------------------------------------------
-
-void Event::removeFromWaiter()
-{
-    if (waiter!=0) {
-        waiter->remove(this);
-        waiter = 0;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Event.h
===================================================================
--- src/xplcommon/win32/Event.h	(revision 21)
+++ 	(revision )
@@ -1,212 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_EVENT_H
-#define XPLCOMMON_WIN32_EVENT_H
-//------------------------------------------------------------------------------
-
-#include "EventFailable.h"
-
-#include <windows.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class Waiter;
-
-//------------------------------------------------------------------------------
-
-/**
- * Wrapper for an event.
- */
-class Event
-{
-private:
-    /**
-     * The object receiving the failure codes.
-     */
-    EventFailable& eventFailable;
-
-    /**
-     * The handle of the event.
-     */
-    HANDLE handle;
-
-    /**
-     * The object waiting for the event.
-     */
-    Waiter* waiter;
-
-public:
-    /**
-     * Construct the event.
-     */
-    Event(EventFailable& eventFailable);
-
-    /**
-     * Destroy the event. It will be removed from the waiter if it is
-     * in one.
-     */
-    ~Event();
-
-    /**
-     * Get the handle of the event.
-     */
-    HANDLE getHandle() const;
-
-    /**
-     * Get the waiter.
-     */
-    Waiter* getWaiter() const;
-
-    /**
-     * Register the event with the given waiter. If it is already
-     * registered with a waiter, it will be removed from that.
-     */
-    void addTo(Waiter& w);
-
-    /**
-     * Remove the object from the waiter it is registered with.
-     */
-    void removeFromWaiter();
-
-    /**
-     * Determine if the event is being waited for, i.e. it is
-     * associated with a waiter.
-     */
-    bool isWaited() const;
-
-    /**
-     * Set the event.
-     */
-    void fire();
-
-    /**
-     * Determine if the event is fired or not.
-     */
-    bool isFired() const;
-
-    /**
-     * Clear the event.
-     *
-     * @return if clearing succeeded.
-     */
-    bool clear();
-
-protected:
-    /**
-     * Set the error code on the failable object.
-     */
-    void setErrorCode(errorCode_t errorCode);
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Event::Event(EventFailable& eventFailable) :
-    eventFailable(eventFailable),
-    handle(CreateEvent(0, true, false, 0)),
-    waiter(0)
-{
-    if (handle==0) eventFailable.setErrorCode(GetLastError());
-}
-
-//------------------------------------------------------------------------------
-
-inline Event::~Event()
-{
-    removeFromWaiter();
-    CloseHandle(handle);
-}
-
-//------------------------------------------------------------------------------
-
-inline HANDLE Event::getHandle() const
-{
-    return handle;
-}
-
-//------------------------------------------------------------------------------
-
-inline Waiter* Event::getWaiter() const
-{
-    return waiter;
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Event::isWaited() const
-{
-    return waiter!=0;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Event::fire()
-{
-    if (!SetEvent(handle)) {
-        eventFailable.setErrorCode(GetLastError());
-    }
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Event::clear()
-{
-    if (!ResetEvent(handle)) {
-        eventFailable.setErrorCode(GetLastError());
-        return false;
-    } else {
-        return true;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-inline void Event::setErrorCode(errorCode_t errorCode)
-{
-    eventFailable.setErrorCode(errorCode);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_EVENT_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/EventFailable.h
===================================================================
--- src/xplcommon/win32/EventFailable.h	(revision 21)
+++ 	(revision )
@@ -1,68 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_EVENTFAILABLE_H
-#define XPLCOMMON_WIN32_EVENTFAILABLE_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class Event;
-
-//------------------------------------------------------------------------------
-
-/**
- * A special subclass of Failable, the instances of which can be given
- * as a Failable target object to events. If some operation on an
- * event fails, the error code will be set on such an instance,
- * associated with the event.
- */
-class EventFailable : public ::xplcommon::Failable
-{
-    friend class Event;
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_EVENTFAILABLE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalAcceptor.cc
===================================================================
--- src/xplcommon/win32/LocalAcceptor.cc	(revision 23)
+++ 	(revision )
@@ -1,87 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "LocalAcceptor.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::LocalAcceptor;
-
-//------------------------------------------------------------------------------
-
-LocalAcceptor::LocalAcceptor(LocalServerSocketBase* socket, const char* name) :
-    Completer(socket),
-    accepted(false)
-{
-    LocalSocket::setupPath(path, name);
-}
-
-//------------------------------------------------------------------------------
-
-bool LocalAcceptor::accept()
-{
-    if (failed()) return false;
-    if (accepted) return true;
-
-    bool result = false;
-    if (checkWaitedResult(result)) {
-        return result;
-    }
-
-    LocalServerSocketBase& socket = getServerSocket();
-    if (!socket.createNamedPipe(path)) {
-        return false;
-    }
-
-    result = socket.connectNamedPipe(overlapped);
-    if (result) {
-        accepted = true;
-    } else if (!socket.failed()) {
-        addTo(socket.waiter);
-    }
-
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-void LocalAcceptor::handleWaitedResult(DWORD /*size*/)
-{
-    accepted = true;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalAcceptor.h
===================================================================
--- src/xplcommon/win32/LocalAcceptor.h	(revision 25)
+++ 	(revision )
@@ -1,161 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_LOCALACCEPTOR_H
-#define XPLCOMMON_WIN32_LOCALACCEPTOR_H
-//------------------------------------------------------------------------------
-
-#include "Completer.h"
-
-#include "LocalServerSocketBase.h"
-#include "LocalSocket.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * Instances of this class are used to accept connection requests to a
- * local server socket, i.e. named pipe.
- */
-class LocalAcceptor : public Completer
-{
-private:
-    /**
-     * The path of the pipe to accept.
-     */
-    char path[256];
-
-    /**
-     * Indicate if the connection has been accepted.
-     */
-    bool accepted;
-
-protected:
-    /**
-     * Construct the acceptor.
-     */
-    LocalAcceptor(LocalServerSocketBase* socket, const char* name);
-
-    /**
-     * Get the socket.
-     *
-     * It returns the overlappable from the Completer part, knowing
-     * that it must be a LocalServerSocketBase.
-     */
-    LocalServerSocketBase& getServerSocket() const;
-
-public:
-    /**
-     * Try to accept a connection.
-     *
-     * If one is already accepted, but not retrieved yet, return true.
-     *
-     * If a new connection becomes immediately available, return true.
-     *
-     * If a new connection is not yet available, returns false.
-     *
-     * If some error occurs, the acceptor is marked failed and false
-     * is returned.
-     */
-    bool accept();
-
-    /**
-     * Get the local socket accepted last. If no socket was accepted,
-     * return 0. The local socket's waiter will be the given one.
-     */
-    LocalSocket* getSocket(Waiter* waiter,
-                           size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY,
-                           size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY);
-    /**
-     * Get the local socket accepted last. If no socket was accepted,
-     * return 0. The local socket's waiter will be the same as that of
-     * the associated server socket.
-     */
-    LocalSocket* getSocket(size_t readingCapacity = LocalSocket::DEFAULT_CAPACITY,
-                           size_t writingCapacity = LocalSocket::DEFAULT_CAPACITY);
-
-
-protected:
-    /**
-     * Set the indicator of an accepted connection to true.
-     *
-     * @see Completer::handleWaitedResult
-     */
-    virtual void handleWaitedResult(DWORD size);
-
-    friend class LocalServerSocket;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalServerSocketBase& LocalAcceptor::getServerSocket() const
-{
-    return static_cast<LocalServerSocketBase&>(overlappable);
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalSocket* LocalAcceptor::getSocket(Waiter* waiter,
-                                             size_t readingCapacity,
-                                             size_t writingCapacity)
-{
-    if (!accepted) return 0;
-
-    LocalSocket* s = new LocalSocket(waiter, overlappable.releaseHandle(),
-                                     readingCapacity, writingCapacity);
-    accepted = false;
-    return s;
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalSocket* LocalAcceptor::getSocket(size_t readingCapacity,
-                                             size_t writingCapacity)
-{
-    return getSocket(overlappable.getWaiter(),
-                     readingCapacity, writingCapacity);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_LOCALACCEPTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalClientSocket.h
===================================================================
--- src/xplcommon/win32/LocalClientSocket.h	(revision 22)
+++ 	(revision )
@@ -1,101 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_LOCALCLIENTSOCKET_H
-#define XPLCOMMON_WIN32_LOCALCLIENTSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "LocalConnector.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A client socket that connects to a named server socket locally,
- * i.e. a named pipe.
- *
- * The server socket's name should be given. The name will be used as
- * described for LocalServerSocket.
- */
-class LocalClientSocket : public LocalSocket
-{
-private:
-    /**
-     * The local connector.
-     */
-    LocalConnector connector;
-
-public:
-    /**
-     * Construct the client socket with the given name.
-     */
-    LocalClientSocket(const char* name, Waiter* waiter = 0,
-                      size_t readingCapacity = DEFAULT_CAPACITY,
-                      size_t writingCapacity = DEFAULT_CAPACITY);
-
-    /**
-     * Get the connector.
-     */
-    LocalConnector& getConnector();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalClientSocket::LocalClientSocket(const char* name, Waiter* waiter,
-                                            size_t readingCapacity,
-                                            size_t writingCapacity) :
-    LocalSocket(waiter, 0, readingCapacity, writingCapacity),
-    connector(this, name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalConnector& LocalClientSocket::getConnector()
-{
-    return connector;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_LOCALCLIENTSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalConnector.cc
===================================================================
--- src/xplcommon/win32/LocalConnector.cc	(revision 22)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "LocalConnector.h"
-
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::LocalConnector;
-
-//------------------------------------------------------------------------------
-
-bool LocalConnector::connect()
-{
-    if (connected) return true;
-    if (failed()) return false;
-
-    if (socket.connect(path)) {
-        connected = true;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalConnector.h
===================================================================
--- src/xplcommon/win32/LocalConnector.h	(revision 22)
+++ 	(revision )
@@ -1,135 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_LOCALCONNECTOR_H
-#define XPLCOMMON_WIN32_LOCALCONNECTOR_H
-//------------------------------------------------------------------------------
-
-#include "Completer.h"
-
-#include "LocalSocket.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class LocalConnector : public FailableReference<LocalConnector>
-{
-private:
-    /**
-     * The local socket to connect on behalf of which (it should
-     * actually be a LocalClientSocket.
-     */
-    LocalSocket& socket;
-
-    /**
-     * The path of the pipe to connect to.
-     */
-    char path[256];
-
-    /**
-     * Indicate if we are connected.
-     */
-    bool connected;
-
-protected:
-    /**
-     * Construct the connector.
-     */
-    LocalConnector(LocalSocket* socket, const char* name);
-
-public:
-    /**
-     * Connect to an address properly set up.
-     *
-     * If the connection succeeds immediately, it indicates success.
-     *
-     * If the connection does not succeed, because it would block, it
-     * sets up the socket to wait for the connection to succeed, and
-     * returns failure.
-     *
-     * If the connection fails for another reason, the error code is
-     * set, and false is returned.
-     */
-    bool connect();
-
-private:
-    /**
-     * Get the failable object.
-     */
-    const ::xplcommon::Failable& getFailable() const;
-
-    /**
-     * Get the failable object.
-     */
-    ::xplcommon::Failable& getFailable();
-
-    friend class FailableReference<LocalConnector>;
-    friend class LocalClientSocket;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalConnector::LocalConnector(LocalSocket* socket, const char* name) :
-    socket(*socket),
-    connected(false)
-{
-    LocalSocket::setupPath(path, name);
-}
-
-//------------------------------------------------------------------------------
-
-inline const ::xplcommon::Failable& LocalConnector::getFailable() const
-{
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-inline ::xplcommon::Failable& LocalConnector::getFailable()
-{
-    return socket;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_LOCALCONNECTOR_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalServerSocket.h
===================================================================
--- src/xplcommon/win32/LocalServerSocket.h	(revision 21)
+++ 	(revision )
@@ -1,98 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_LOCALSERVERSOCKET_H
-#define XPLCOMMON_WIN32_LOCALSERVERSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "LocalServerSocketBase.h"
-
-#include "LocalAcceptor.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A server socket that works locally, i.e. a named pipe.
- *
- * It is identified by a name that should be unique for a user. The
- * actual pipe will be created with the name \\.\pipe\<name>.
- */
-class LocalServerSocket : public LocalServerSocketBase
-{
-private:
-    /**
-     * The acceptor to use.
-     */
-    LocalAcceptor acceptor;
-
-public:
-    /**
-     * Construct the socket.
-     */
-    LocalServerSocket(const char* name, Waiter* waiter = 0);
-
-    /**
-     * Get the acceptor.
-     */
-    LocalAcceptor& getAcceptor();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalServerSocket::LocalServerSocket(const char* name, Waiter* waiter) :
-    LocalServerSocketBase(waiter),
-    acceptor(this, name)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalAcceptor& LocalServerSocket::getAcceptor()
-{
-    return acceptor;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_LOCALSERVERSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalServerSocketBase.cc
===================================================================
--- src/xplcommon/win32/LocalServerSocketBase.cc	(revision 26)
+++ 	(revision )
@@ -1,85 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "LocalServerSocketBase.h"
-
-#include "LocalSocket.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::LocalServerSocketBase;
-
-//------------------------------------------------------------------------------
-
-bool LocalServerSocketBase::createNamedPipe(const char* path)
-{
-    handle = CreateNamedPipe(path, PIPE_ACCESS_DUPLEX |
-                             ((waiter==0) ? 0 : FILE_FLAG_OVERLAPPED),
-                             PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
-                             PIPE_UNLIMITED_INSTANCES,
-                             BufferedStream::DEFAULT_CAPACITY,
-                             BufferedStream::DEFAULT_CAPACITY,
-                             0, 0);
-    if (handle==0) {
-        setErrorCode(GetLastError());
-    }
-    return handle!=0;
-}
-
-//------------------------------------------------------------------------------
-
-bool LocalServerSocketBase::connectNamedPipe(Overlapped* overlapped)
-{
-    if (overlapped!=0) overlapped->reset();
-    bool result = ConnectNamedPipe(handle,
-                                   (overlapped==0) ? 0 : overlapped->get());
-    DWORD error = GetLastError();
-    if (!result &&
-        (overlapped==0 ||
-         (error!=ERROR_IO_PENDING && error!=ERROR_IO_INCOMPLETE)))
-    {
-        setErrorCode(error);
-        return false;
-    } else if (overlapped==0) {
-        return result;
-    } else {
-        DWORD dummy = 0;
-        return overlapped->getResult(dummy, handle);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalServerSocketBase.h
===================================================================
--- src/xplcommon/win32/LocalServerSocketBase.h	(revision 25)
+++ 	(revision )
@@ -1,101 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_LOCALSERVERSOCKETBASE_H
-#define XPLCOMMON_WIN32_LOCALSERVERSOCKETBASE_H
-//------------------------------------------------------------------------------
-
-#include "Overlappable.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class Overlapped;
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for a local server socket. This is here only to allow
- * for a more efficient implementation of LocalAcceptor.
- */
-class LocalServerSocketBase : public Overlappable
-{
-protected:
-    /**
-     * Construct the server socket base.
-     */
-    LocalServerSocketBase(Waiter* waiter);
-
-    /**
-     * Create a new named pipe with the proper settings. The handle of
-     * this object will be set to the created handle.
-     *
-     * @param path the path of the pipe to create. It should be the
-     * final path, not the user-given name.
-     *
-     * @return whether the pipe could be created
-     */
-    bool createNamedPipe(const char* path);
-
-    /**
-     * Connect the named pipe with the current handle of this object.
-     *
-     * @return whether the connection succeeded. If not, it may be a
-     * failure, which is then indicated, or it may be an overlapped
-     * operation which needs to wait.
-     */
-    bool connectNamedPipe(Overlapped* overlapped);
-
-    friend class LocalAcceptor;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline LocalServerSocketBase::LocalServerSocketBase(Waiter* waiter) :
-    Overlappable(waiter)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_LOCALSERVERSOCKETBASE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/LocalSocket.h
===================================================================
--- src/xplcommon/win32/LocalSocket.h	(revision 26)
+++ 	(revision )
@@ -1,121 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_LOCALSOCKET_H
-#define XPLCOMMON_WIN32_LOCALSOCKET_H
-//------------------------------------------------------------------------------
-
-#include "BufferedStream.h"
-
-#include "Overlapped.h"
-
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * Basically a different name for a buffered stream.
- */
-class LocalSocket : public BufferedStream
-{
-public:
-    /**
-     * Create a concrete pipe path from the given user-specified name.
-     *
-     * @param dest the destination buffer, which should be at least
-     * 256 bytes long.
-     */
-    static void setupPath(char* dest, const char* name);
-
-protected:
-    /**
-     * Construct the local socket
-     */
-    LocalSocket(Waiter* waiter = 0, HANDLE handle = 0,
-                size_t readingCapacity = DEFAULT_CAPACITY,
-                size_t writingCapacity = DEFAULT_CAPACITY);
-
-
-protected:
-    /**
-     * Connect the client socket to the server.
-     */
-    bool connect(const char* path);
-
-    friend class LocalAcceptor;
-    friend class LocalConnector;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void LocalSocket::setupPath(char* dest, const char* name)
-{
-    snprintf(dest, 256, "\\\\.\\pipe\\%s", name);
-}
-
-//------------------------------------------------------------------------------
-
-inline LocalSocket::LocalSocket(Waiter* waiter, HANDLE handle,
-                                size_t readingCapacity, size_t writingCapacity):
-    BufferedStream(waiter, handle, readingCapacity, writingCapacity)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool LocalSocket::connect(const char* path)
-{
-    handle = CreateFile(path, GENERIC_READ|GENERIC_WRITE,
-                        0, 0, OPEN_EXISTING,
-                        FILE_FLAG_NO_BUFFERING | FILE_FLAG_OVERLAPPED, 0);
-    if (handle==0) {
-        setErrorCode(GetLastError());
-    }
-
-    return handle!=0;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_LOCALSOCKET_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Makefile.am
===================================================================
--- src/xplcommon/win32/Makefile.am	(revision 34)
+++ 	(revision )
@@ -1,37 +1,0 @@
-noinst_LTLIBRARIES=libxplcommon_win32.la
-
-libxplcommon_win32_la_SOURCES =	\
-	Thread.cc		\
-	CondVar.cc		\
-	Event.cc		\
-	Overlapped.cc		\
-	Waiter.cc		\
-	BufferedStream.cc	\
-	ReadingBuffer.cc	\
-	WritingBuffer.cc	\
-	LocalAcceptor.cc	\
-	LocalServerSocketBase.cc\
-	LocalConnector.cc
-
-include_xplcommon_win32dir=$(includedir)/xplcommon/win32
-include_xplcommon_win32_HEADERS=\
-	Thread.h		\
-	Mutex.h			\
-	CondVar.h		\
-	EventFailable.h		\
-	Event.h			\
-	Overlapped.h		\
-	Waiter.h		\
-	WaitableEvent.h		\
-	Overlappable.h		\
-	Completer.h		\
-	StreamBuffer.h		\
-	BufferedStream.h	\
-	ReadingBuffer.h		\
-	WritingBuffer.h		\
-	LocalSocket.h		\
-	LocalAcceptor.h		\
-	LocalServerSocketBase.h	\
-	LocalServerSocket.h	\
-	LocalConnector.h	\
-	LocalClientSocket.h
Index: c/xplcommon/win32/Mutex.h
===================================================================
--- src/xplcommon/win32/Mutex.h	(revision 34)
+++ 	(revision )
@@ -1,133 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_MUTEX_H
-#define XPLCOMMON_WIN32_MUTEX_H
-//------------------------------------------------------------------------------
-
-#include <windows.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * Mutual exclusion device implementation for Windows.
- */
-class Mutex
-{
-private:
-    /**
-     * The handle of the mutex.
-     */
-    CRITICAL_SECTION mutex;
-
-public:
-    /**
-     * Construct the mutex.
-     */
-    Mutex();
-
-    /**
-     * Destroy the mutex.
-     */
-    ~Mutex();
-
-    /**
-     * Lock the mutex. If the mutex is locked by another thread, the
-     * caller one waits until the other thread releases the mutex.
-     */
-    void lock();
-
-    /**
-     * Try to lock the mutex. If the mutex is locked by another
-     * thread, this function returns false immediately. Otherwise it
-     * locks the mutex and returns true.
-     */
-    bool tryLock();
-
-    /**
-     * Unlock the mutex.
-     */
-    void unlock();
-
-    friend class CondVar;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Mutex::Mutex()
-{
-    InitializeCriticalSection(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline Mutex::~Mutex()
-{
-    DeleteCriticalSection(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline void Mutex::lock()
-{
-    EnterCriticalSection(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Mutex::tryLock()
-{
-    return TryEnterCriticalSection(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline void Mutex::unlock()
-{
-    LeaveCriticalSection(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_MUTEX_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Overlappable.h
===================================================================
--- src/xplcommon/win32/Overlappable.h	(revision 25)
+++ 	(revision )
@@ -1,147 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_OVERLAPPABLE_H
-#define XPLCOMMON_WIN32_OVERLAPPABLE_H
-//------------------------------------------------------------------------------
-
-#include "EventFailable.h"
-
-#include <windows.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class Waiter;
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for classes that maintain a handle and may be subject to
- * overlapped I/O operations whose completion is waited for in a
- * Waiter.
- */
-class Overlappable : public EventFailable
-{
-protected:
-    /**
-     * The waiter to be used for waiting for events.
-     */
-    Waiter* waiter;
-
-    /**
-     * The handle to use.
-     */
-    HANDLE handle;
-
-protected:
-    /**
-     * Construct the object.
-     */
-    Overlappable(Waiter* waiter = 0, HANDLE handle = 0);
-
-public:
-    /**
-     * Destroy the object.
-     */
-    virtual ~Overlappable();
-
-    /**
-     * Get the waiter.
-     */
-    Waiter* getWaiter();
-
-    /**
-     * Determine if the overlappable has a waiter.
-     */
-    bool hasWaiter() const;
-
-    /**
-     * Get the handle and clear it.
-     */
-    HANDLE releaseHandle();
-
-    friend class Completer;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Overlappable::Overlappable(Waiter* waiter, HANDLE handle) :
-    waiter(waiter),
-    handle(handle)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Overlappable::~Overlappable()
-{
-    if (handle!=0) CloseHandle(handle);
-}
-
-//------------------------------------------------------------------------------
-
-inline Waiter* Overlappable::getWaiter()
-{
-    return waiter;
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Overlappable::hasWaiter() const
-{
-    return waiter != 0;
-}
-
-//------------------------------------------------------------------------------
-
-inline HANDLE Overlappable::releaseHandle()
-{
-    HANDLE h = handle;
-    handle = 0;
-    return h;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_OVERLAPPABLE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Overlapped.cc
===================================================================
--- src/xplcommon/win32/Overlapped.cc	(revision 22)
+++ 	(revision )
@@ -1,67 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Overlapped.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::Overlapped;
-
-//------------------------------------------------------------------------------
-
-void Overlapped::reset()
-{
-    memset(&overlapped, 0, sizeof(overlapped));
-    overlapped.hEvent = getHandle();
-    clear();
-}
-
-//------------------------------------------------------------------------------
-
-bool Overlapped::getResult(DWORD& size, HANDLE file)
-{
-    bool result = GetOverlappedResult(file, &overlapped, &size, FALSE);
-    if (!result) {
-        DWORD error = GetLastError();
-        if (error!=ERROR_IO_PENDING && error!=ERROR_IO_INCOMPLETE) {
-            setErrorCode(error);
-        }
-    }
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Overlapped.h
===================================================================
--- src/xplcommon/win32/Overlapped.h	(revision 26)
+++ 	(revision )
@@ -1,130 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_OVERLAPPED_H
-#define XPLCOMMON_WIN32_OVERLAPPED_H
-//------------------------------------------------------------------------------
-
-#include "Event.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A wrapper for an OVERLAPPED structure which also has an event
- * associated with it. Instances of this class can be registered into and
- * unregistered from a Waiter. The destructor removes the object from
- * the waiter, if it is registered.
- */
-class Overlapped : public Event
-{
-private:
-    /**
-     * The Windows OVERLAPPED structure.
-     */
-    OVERLAPPED overlapped;
-
-public:
-    /**
-     * Construct the object. The overlapped structure will be reset to
-     * 0, and the event handle will be set.
-     */
-    Overlapped(EventFailable& eventFailable);
-
-    /**
-     * Reset the overlapped structure and set its event handle. The
-     * event is also cleared.
-     */
-    void reset();
-
-    /**
-     * Get the pointer to the overlapped structure.
-     */
-    OVERLAPPED* get();
-
-    /**
-     * Get the pointer to the overlapped structure.
-     */
-    const OVERLAPPED* get() const;
-
-    /**
-     * Get the result of the overlapped operation.
-     *
-     * If the operation has completed, the event will be cleared.
-     *
-     * @param size on successful return, it will contain the number of
-     * bytes read or written, which may be 0 for an end-of-file
-     * condition
-     * @param file the handle of the object on which the operation in
-     * question was performed
-     *
-     * @return true if the operation has completed, or false if it has
-     * not, or a failure has occured.
-     */
-    bool getResult(DWORD& size, HANDLE file);
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Overlapped::Overlapped(EventFailable& eventFailable) :
-    Event(eventFailable)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline OVERLAPPED* Overlapped::get()
-{
-    return &overlapped;
-}
-
-//------------------------------------------------------------------------------
-
-inline const OVERLAPPED* Overlapped::get() const
-{
-    return &overlapped;
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_OVERLAPPED_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/ReadingBuffer.cc
===================================================================
--- src/xplcommon/win32/ReadingBuffer.cc	(revision 23)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "ReadingBuffer.h"
-
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::ReadingBuffer;
-
-//------------------------------------------------------------------------------
-
-bool ReadingBuffer::read()
-{
-    if (failed()) return false;
-
-    if (getLength()>0) {
-        return true;
-    }
-
-    bool result = false;
-    if (checkWaitedResult(result)) {
-        return result;
-    }
-
-    BufferedStream& stream = getStream();
-    ssize_t numRead = stream.read(getData(), getCapacity(), overlapped);
-    if (numRead<0) {
-        if (!stream.failed()) {
-            addTo(stream.getWaiter());
-        }
-    } else {
-        addLength(numRead);
-    }
-    return numRead>=0;
-}
-
-//------------------------------------------------------------------------------
-
-void ReadingBuffer::handleWaitedResult(DWORD size)
-{
-    addLength(size);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/ReadingBuffer.h
===================================================================
--- src/xplcommon/win32/ReadingBuffer.h	(revision 22)
+++ 	(revision )
@@ -1,110 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_READINGBUFFER_H
-#define XPLCOMMON_WIN32_READINGBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "StreamBuffer.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffer used for reading from a stream buffer.
- *
- * It should be made empty, and then the function read() should be
- * called on it. If it returns true, some data could be read. If the
- * amount of data in the buffer is then 0, that indicates and
- * end-of-file condition.
- */
-class ReadingBuffer : public StreamBuffer
-{
-protected:
-    /**
-     * Construct the buffer.
-     */
-    ReadingBuffer(size_t capacity, BufferedStream* stream);
-
-public:
-    /**
-     * Read into the buffer using the buffered stream if possible.
-     *
-     * If the buffer contains data, this function returns immediately
-     * with success, so the buffer should be reset before reading.
-     *
-     * If some data can be read immediately, that is stored in the
-     * buffer, and success is indicated. Success is indicated even if
-     * the amount of data read is 0, allowing for signalling the
-     * end-of-file or end-of-connection condition.
-     *
-     * If the reading operation would block, the stream is set up so
-     * that it would read, and failure is returned.
-     *
-     * Otherwise, if the reading operation fails for some other
-     * reason, the buffer's error code is set, so it should always be
-     * checked on a failure!
-     */
-    bool read();
-
-protected:
-    /**
-     * Set the buffer's length to the given value.
-     *
-     * @see Completer::handleWaitedResult
-     */
-    virtual void handleWaitedResult(DWORD size);
-
-    friend class BufferedStream;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline ReadingBuffer::ReadingBuffer(size_t capacity, BufferedStream* stream) :
-    StreamBuffer(capacity, stream)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_READINGBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/StreamBuffer.h
===================================================================
--- src/xplcommon/win32/StreamBuffer.h	(revision 24)
+++ 	(revision )
@@ -1,95 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_STREAMBUFFER_H
-#define XPLCOMMON_WIN32_STREAMBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "../Buffer.h"
-#include "Completer.h"
-#include "../Failable.h"
-
-#include "BufferedStream.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * Base class for stream reading and writing buffers.
- */
-class StreamBuffer : public ::xplcommon::Buffer, public Completer
-{
-protected:
-    /**
-     * Construct the stream buffer with the given capacity and for the
-     * given stream.
-     */
-    StreamBuffer(size_t capacity, BufferedStream* stream);
-
-    /**
-     * Get the stream.
-     *
-     * This just casts the overlappable of the Completer part knowing
-     * that it must be a BufferedStream
-     */
-    BufferedStream& getStream() const;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline StreamBuffer::StreamBuffer(size_t capacity, BufferedStream* stream) :
-    Buffer(capacity),
-    Completer(stream)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline BufferedStream& StreamBuffer::getStream() const
-{
-    return static_cast<BufferedStream&>(overlappable);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_STREAMBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Thread.cc
===================================================================
--- src/xplcommon/win32/Thread.cc	(revision 35)
+++ 	(revision )
@@ -1,57 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Thread.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::Thread;
-
-//------------------------------------------------------------------------------
-
-DWORD Thread::threadFn(LPVOID arg)
-{
-    Thread* thread = reinterpret_cast<Thread*>(arg);
-
-    thread->run();
-
-    if (thread->detached) delete thread;
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Thread.h
===================================================================
--- src/xplcommon/win32/Thread.h	(revision 35)
+++ 	(revision )
@@ -1,157 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_THREAD_H
-#define XPLCOMMON_WIN32_THREAD_H
-//------------------------------------------------------------------------------
-
-#include <windows.h>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A Win32 API thread implementation.
- */
-class Thread
-{
-public:
-    /**
-     * Sleep for the given number of milliseconds.
-     */
-    static void sleep(unsigned millis);
-
-private:
-    /**
-     * The thread-runner function.
-     */
-    static DWORD WINAPI threadFn(LPVOID arg);
-
-    /**
-     * Indicate if the thread is detached.
-     */
-    bool detached;
-
-    /**
-     * The thread handle.
-     */
-    HANDLE handle;
-
-public:
-    /**
-     * Construct the thread object.
-     */
-    Thread(bool detached = false);
-
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Thread();
-
-    /**
-     * Start the thread.
-     *
-     * @return if the thread could be started
-     */
-    bool start();
-
-    /**
-     * Perform the thread's real operation.
-     */
-    virtual void run() = 0;
-
-    /**
-     * Wait for the thread to quit.
-     */
-    void join();
-
-    void release();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void Thread::sleep(unsigned millis)
-{
-    Sleep(millis);
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::Thread(bool detached) :
-    detached(detached),
-    handle(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::~Thread()
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Thread::start()
-{
-    handle = CreateThread(0, 0, &threadFn, this, 0, 0);
-    bool isOK = handle!=0;
-    if (detached && handle!=0) {
-        CloseHandle(handle);
-        handle = 0;
-    }
-    return isOK;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Thread::join()
-{
-    if (handle!=0) {
-        WaitForSingleObject(handle, INFINITE);
-        CloseHandle(handle);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_THREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/WaitableEvent.h
===================================================================
--- src/xplcommon/win32/WaitableEvent.h	(revision 21)
+++ 	(revision )
@@ -1,94 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_WAITABLEEVENT_H
-#define XPLCOMMON_WIN32_WAITABLEEVENT_H
-//------------------------------------------------------------------------------
-
-#include "Event.h"
-#include "EventFailable.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * An event which can be waited for.
- */
-class WaitableEvent : public Event, public EventFailable
-{
-public:
-    /**
-     * Construct the event.
-     */
-    WaitableEvent(Waiter* waiter = 0);
-
-    /**
-     * Check if the event is fired or not. If so, the fired status
-     * will be cleared.
-     */
-    bool check();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline WaitableEvent::WaitableEvent(Waiter* waiter) :
-    Event(static_cast<EventFailable&>(*this))
-{
-    if (waiter!=0) addTo(*waiter);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool WaitableEvent::check()
-{
-    if (isFired()) {
-        clear();
-        return true;
-    } else {
-        return false;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_WAITABLEEVENT_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Waiter.cc
===================================================================
--- src/xplcommon/win32/Waiter.cc	(revision 20)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Waiter.h"
-
-#include "Event.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::Waiter;
-
-//------------------------------------------------------------------------------
-
-Waiter::~Waiter()
-{
-    while(!events.empty()) {
-        Event* event = *events.begin();
-        event->removeFromWaiter();
-    }
-}
-
-//------------------------------------------------------------------------------
-
-bool Waiter::wait(int timeout)
-{
-    if (numEvents==0) return true;
-
-    HANDLE handles[numEvents];
-    size_t j = 0;
-    for(events_t::const_iterator i = events.begin();
-        i!=events.end(); ++i, ++j)
-    {
-        handles[j] = (*i)->getHandle();
-    }
-
-    DWORD result = WaitForMultipleObjects(numEvents, handles, false,
-                                          (timeout<0) ? INFINITE : timeout);
-    if (result==WAIT_FAILED) {
-        setErrorCode(GetLastError());
-        return false;
-    } else {
-        return result!=WAIT_TIMEOUT;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/Waiter.h
===================================================================
--- src/xplcommon/win32/Waiter.h	(revision 20)
+++ 	(revision )
@@ -1,143 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_WAITER_H
-#define XPLCOMMON_WIN32_WAITER_H
-//------------------------------------------------------------------------------
-
-#include "../Failable.h"
-
-#include <set>
-
-#include <cassert>
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-class Event;
-
-//------------------------------------------------------------------------------
-
-/**
- * Class that can be used to register OVERLAPPED structures and then
- * wait for their events.
- */
-class Waiter : public ::xplcommon::Failable
-{
-private:
-    /**
-     * Type for the mapping of events to overlapped objects.
-     */
-    typedef std::set<Event*> events_t;
-
-    /**
-     * The events to be handled.
-     */
-    events_t events;
-
-    /**
-     * The number of events.
-     */
-    size_t numEvents;
-
-public:
-    /**
-     * Construct the waiter.
-     */
-    Waiter();
-
-    /**
-     * Destroy the waiter. It will be removed from any Event
-     * objects it may be related to.
-     */
-    ~Waiter();
-
-    /**
-     * Wait for an event to occur with the given timeout.
-     *
-     * @return true if any of the events belonging to the Overlapped
-     * objects become ready, false if the timeout occurs.
-     */
-    bool wait(int timeout = -1);
-
-protected:
-    /**
-     * Add the given event to the set of those to be waited for.
-     */
-    void add(Event* event);
-
-    /**
-     * Remove the given event from the set of those to be waited for.
-     */
-    void remove(Event* event);
-
-    friend class Event;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline Waiter::Waiter() :
-    numEvents(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline void Waiter::add(Event* event)
-{
-    events.insert(event);
-    ++numEvents;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Waiter::remove(Event* event)
-{
-    assert(numEvents>0);
-    --numEvents;
-    events.erase(event);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_WAITER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/WritingBuffer.cc
===================================================================
--- src/xplcommon/win32/WritingBuffer.cc	(revision 23)
+++ 	(revision )
@@ -1,77 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "WritingBuffer.h"
-
-//------------------------------------------------------------------------------
-
-using xplcommon::win32::WritingBuffer;
-
-//------------------------------------------------------------------------------
-
-bool WritingBuffer::write()
-{
-    if (failed()) return false;
-
-    if (getLength()==0) {
-        return true;
-    }
-
-    bool result;
-    if (checkWaitedResult(result)) {
-        return result;
-    }
-
-    BufferedStream& stream = getStream();
-    result = stream.write(getData(), getLength(), overlapped);
-    if (result) {
-        reset();
-    } else if (!stream.failed()) {
-        addTo(stream.getWaiter());
-    }
-
-    return result;
-}
-
-//------------------------------------------------------------------------------
-
-void WritingBuffer::handleWaitedResult(DWORD /*size*/)
-{
-    reset();
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: c/xplcommon/win32/WritingBuffer.h
===================================================================
--- src/xplcommon/win32/WritingBuffer.h	(revision 22)
+++ 	(revision )
@@ -1,110 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef XPLCOMMON_WIN32_WRITINGBUFFER_H
-#define XPLCOMMON_WIN32_WRITINGBUFFER_H
-//------------------------------------------------------------------------------
-
-#include "StreamBuffer.h"
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon { namespace win32 {
-
-//------------------------------------------------------------------------------
-
-/**
- * A buffer used for writing into a buffered stream.
- *
- * The data to write should be stored in the buffer. Then write()
- * should be called. If it returns true, it indicates that all data
- * has been written. In that case the buffer is automatically emptied.
- */
-class WritingBuffer : public StreamBuffer
-{
-protected:
-    /**
-     * Construct the buffer.
-     */
-    WritingBuffer(size_t capacity, BufferedStream* stream);
-
-public:
-    /**
-     * Write the contents of the buffer using the associated buffered
-     * stream.
-     *
-     * If the buffer is empty, the function returns indicating
-     * success.
-     *
-     * If the complete remaining contents could be written, it also indicates
-     * success, and the buffer is reset, ready to be used again.
-     *
-     * If not everything can be written and the write operation
-     * indicates that it would block, this function returns failure
-     * after the stream has been set up  to handle the corresponding
-     * poll events.
-     *
-     * Otherwise, if the writing operation fails for some other
-     * reason, the buffer's error code is set to the error's code and
-     * false is returned.
-     */
-    bool write();
-
-protected:
-    /**
-     * Reset the buffer to signify that its contents have been written.
-     *
-     * @see Completer::handleWaitedResult
-     */
-    virtual void handleWaitedResult(DWORD size);
-
-    friend class BufferedStream;
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline WritingBuffer::WritingBuffer(size_t capacity, BufferedStream* stream) :
-    StreamBuffer(capacity, stream)
-{
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon::win32 */ } /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_WIN32_WRITINGBUFFER_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/.copyright
===================================================================
--- test/.copyright	(revision 4)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
Index: st/.srcmessage
===================================================================
--- test/.srcmessage	(revision 4)
+++ 	(revision )
@@ -1,2 +1,0 @@
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
Index: st/Makefile.am
===================================================================
--- test/Makefile.am	(revision 35)
+++ 	(revision )
@@ -1,63 +1,0 @@
-INCLUDES=-I$(top_srcdir)/src
-
-noinst_PROGRAMS=testthread testevent testlocsock testblkstream testmutex testcondvar
-if TARGET_API_POSIX
-noinst_PROGRAMS+=testrandom
-endif
-
-testthread_SOURCES=testthread.cc
-testthread_LDADD=../src/xplcommon/libxplcommon.la
-if TARGET_API_POSIX
-testthread_LDADD+=-lpthread
-endif
-if TARGET_API_WIN32
-testthread_LDFLAGS=-static-libgcc -static-libstdc++
-endif
-
-testevent_SOURCES=testevent.cc
-testevent_LDADD=../src/xplcommon/libxplcommon.la
-if TARGET_API_POSIX
-testevent_LDADD+=-lpthread
-endif
-if TARGET_API_WIN32
-testevent_LDFLAGS=-static-libgcc -static-libstdc++
-endif
-
-testlocsock_SOURCES=testlocsock.cc
-testlocsock_LDADD=../src/xplcommon/libxplcommon.la
-if TARGET_API_POSIX
-testlocsock_LDADD+=-lpthread
-endif
-if TARGET_API_WIN32
-testlocsock_LDFLAGS=-static-libgcc -static-libstdc++
-endif
-
-testblkstream_SOURCES=testblkstream.cc
-testblkstream_LDADD=../src/xplcommon/libxplcommon.la
-if TARGET_API_POSIX
-testblkstream_LDADD+=-lpthread
-endif
-if TARGET_API_WIN32
-testblkstream_LDFLAGS=-static-libgcc -static-libstdc++
-endif
-
-testmutex_SOURCES=testmutex.cc
-testmutex_LDADD=../src/xplcommon/libxplcommon.la
-if TARGET_API_POSIX
-testmutex_LDADD+=-lpthread
-endif
-if TARGET_API_WIN32
-testmutex_LDFLAGS=-static-libgcc -static-libstdc++
-endif
-
-testcondvar_SOURCES=testcondvar.cc
-testcondvar_LDADD=../src/xplcommon/libxplcommon.la
-if TARGET_API_POSIX
-testcondvar_LDADD+=-lpthread
-endif
-if TARGET_API_WIN32
-testcondvar_LDFLAGS=-static-libgcc -static-libstdc++
-endif
-
-testrandom_SOURCES=testrandom.cc
-testrandom_LDADD=../src/xplcommon/libxplcommon.la
Index: st/testblkstream.cc
===================================================================
--- test/testblkstream.cc	(revision 35)
+++ 	(revision )
@@ -1,339 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Waiter.h>
-#include <xplcommon/LocalServerSocket.h>
-#include <xplcommon/LocalAcceptor.h>
-#include <xplcommon/LocalSocket.h>
-#include <xplcommon/LocalClientSocket.h>
-#include <xplcommon/LocalConnector.h>
-#include <xplcommon/DataStream.h>
-#include <xplcommon/WaitableEvent.h>
-#include <xplcommon/PseudoRandom.h>
-
-#include <cstdlib>
-#include <cstdio>
-#include <cassert>
-
-#include <signal.h>
-
-#include <sys/time.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::Thread;
-using xplcommon::Waiter;
-using xplcommon::LocalServerSocket;
-using xplcommon::LocalAcceptor;
-using xplcommon::LocalSocket;
-using xplcommon::LocalClientSocket;
-using xplcommon::LocalConnector;
-using xplcommon::BufferedStream;
-using xplcommon::DataStream;
-using xplcommon::PseudoRandom;
-
-using std::min;
-
-//------------------------------------------------------------------------------
-
-class TestThread : public Thread
-{
-private:
-    static const uint8_t OP_ADD = 1;
-
-    static const uint8_t OP_SUB = 2;
-
-    static const uint8_t OP_MUL = 3;
-
-    static const uint8_t OP_DIV = 4;
-
-private:
-    static int32_t perform(int32_t value, uint8_t operation, int32_t x);
-
-    DataStream* dataStream;
-
-protected:
-    TestThread();
-
-public:
-    void interrupt();
-
-protected:
-    void communicate(BufferedStream& stream, unsigned seed, bool isClient);
-};
-
-//------------------------------------------------------------------------------
-
-inline int32_t TestThread::perform(int32_t value, uint8_t operation, int32_t x)
-{
-    switch (operation) {
-      case OP_ADD:
-        return value + x;
-      case OP_SUB:
-        return value - x;
-      case OP_MUL:
-        return value * x;
-      case OP_DIV:
-        return value / x;
-      default:
-        return value;
-    }
-}
-
-//------------------------------------------------------------------------------
-
-inline TestThread::TestThread() :
-    dataStream(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline void TestThread::interrupt()
-{
-    if (dataStream!=0) dataStream->interrupt();
-}
-
-//------------------------------------------------------------------------------
-
-void TestThread::communicate(BufferedStream& stream, unsigned seed, bool isClient)
-{
-    static const size_t reportInterval = 100000;
-
-    const char* prefix = isClient ? "Client" : "Server";
-
-    dataStream = new DataStream(stream);
-    PseudoRandom random(seed);
-
-    bool first = true;
-
-    size_t numRequests = 0;
-    size_t nextReportRequests = reportInterval;
-
-    int32_t value = 0;
-    if (isClient) {
-        value = random.next();
-        dataStream->writeS32(value);
-    } else {
-        value = dataStream->readS32();
-    }
-
-    int32_t newValue = value;
-
-    while(*dataStream) {
-        if (!first || isClient) {
-            unsigned numOperations = random.nextUnsigned(20, 1);
-            dataStream->writeU16(numOperations);
-            //printf("%s: numOperations=%u\n", prefix, numOperations);
-            for(unsigned i = 0; i<numOperations; ++i) {
-                double r = random.nextDouble();
-                uint8_t operation =
-                    (r<0.4) ? OP_ADD : ((r<0.8) ? OP_SUB :
-                                        ((r<0.98) ? OP_MUL : OP_DIV));
-                int32_t x = random.next();
-
-                dataStream->writeU8(operation);
-                dataStream->writeS32(x);
-
-                newValue = perform(newValue, operation, x);
-            }
-            if (!dataStream->flush()) break;
-
-            if (isClient) {
-                value = newValue;
-                ++numRequests;
-                if (numRequests>=nextReportRequests) {
-                    printf("%s: after %lu requests, value=%d\n",
-                           prefix, static_cast<unsigned long>(numRequests),
-                           value);
-                    nextReportRequests += reportInterval;
-                }
-            }
-        }
-
-        unsigned numOperations = dataStream->readU16();
-        for (unsigned i = 0; *dataStream && i<numOperations; ++i) {
-            uint8_t operation = dataStream->readU8();
-            int32_t x = dataStream->readS32();
-            newValue = perform(newValue, operation, x);
-        }
-
-        if (*dataStream) {
-            if (!isClient) {
-                value = newValue;
-                ++numRequests;
-                if (numRequests>=nextReportRequests) {
-                    printf("%s: after %lu requests, value=%d\n",
-                           prefix, static_cast<unsigned long>(numRequests),
-                           value);
-                    nextReportRequests += reportInterval;
-                }
-            }
-        }
-
-
-        first = false;
-    }
-
-    if (dataStream->failed()) {
-        printf("%s: data stream failed with error code: %lu\n", prefix,
-               static_cast<unsigned long>(dataStream->getErrorCode()));
-    } else if (dataStream->isInterrupted()) {
-        printf("%s: data stream was interrupted\n", prefix);
-    }
-
-    printf("%s: value=%d, %lu requests\n", prefix, value,
-           static_cast<unsigned long>(numRequests));
-}
-
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class ServerThread : public TestThread
-{
-public:
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-void ServerThread::run()
-{
-    Waiter waiter;
-
-    unsigned seed = static_cast<unsigned>(time(0)*1.2);
-    printf("ServerThread::run: seed=%u\n", seed);
-
-    LocalServerSocket serverSocket("test", &waiter);
-    LocalAcceptor& acceptor = serverSocket.getAcceptor();
-
-    while(!acceptor.accept()) {
-        if (acceptor.failed()) {
-            printf("ServerThread::run: acceptor failed...: %lu\n",
-                   (unsigned long)acceptor.getErrorCode());
-            return;
-        }
-        printf("ServerThread::run: waiting...\n");
-        waiter.wait();
-    }
-
-    printf("ServerThread::run: waiting done, received connection\n");
-    LocalSocket* socket = acceptor.getSocket();
-
-    acceptor.accept();
-
-    communicate(*socket, seed, false);
-
-    delete socket;
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class ClientThread : public TestThread
-{
-public:
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-void ClientThread::run()
-{
-    Waiter waiter;
-
-    unsigned seed = static_cast<unsigned>(time(0)*1.8);
-    printf("ClientThread::run: seed=%u\n", seed);
-
-    printf("ClientThread::run: sleeping\n");
-    sleep(500);
-    printf("ClientThread::run: connecting\n");
-
-    LocalClientSocket socket("test", &waiter);
-
-    LocalConnector& connector = socket.getConnector();
-
-    while(!connector.connect()) {
-        if (connector.failed()) {
-            printf("ClientThread::run: connector failed...\n");
-            return;
-        }
-        printf("ClientThread::run: waiting...\n");
-        waiter.wait();
-    }
-
-    printf("ClientThread::run: connected\n");
-
-    communicate(socket, seed, true);
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int main()
-{
-#if TARGET_API_POSIX
-    signal(SIGPIPE, SIG_IGN);
-#endif
-
-    ServerThread serverThread;
-    ClientThread clientThread;
-
-    printf("Starting threads\n");
-    serverThread.start();
-    clientThread.start();
-
-
-    Thread::sleep(60000);
-    //Thread::sleep(1000);
-    printf("Signalling the client thread\n");
-    //serverThread.interrupt();
-    clientThread.interrupt();
-    printf("Signalled the client thread\n");
-
-    printf("Waiting for the client thread\n");
-    clientThread.join();
-    printf("Waiting for the server thread\n");
-    serverThread.join();
-    printf("Both threads returned\n");
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/testcondvar.cc
===================================================================
--- test/testcondvar.cc	(revision 34)
+++ 	(revision )
@@ -1,184 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Mutex.h>
-#include <xplcommon/CondVar.h>
-
-#include <cstdlib>
-#include <cstdio>
-#include <cassert>
-
-#include <signal.h>
-
-#include <sys/time.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::Thread;
-using xplcommon::Mutex;
-using xplcommon::CondVar;
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class Thread1 : public Thread
-{
-private:
-    char id;
-
-    Mutex& mutex;
-
-    CondVar& condVar;
-
-public:
-    Thread1(char id, Mutex& mutex, CondVar& condVar);
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline Thread1::Thread1(char id, Mutex& mutex, CondVar& condVar) :
-    id(id),
-    mutex(mutex),
-    condVar(condVar)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Thread1::run()
-{
-    printf("Thread1[%c]::run: locking, and waiting on the condition\n", id);
-    mutex.lock();
-    condVar.wait(mutex);
-    printf("Thread1[%c]::run: condition received, waiting again\n", id);
-    condVar.wait(mutex);
-    printf("Thread1[%c]::run: condition received again, waiting with timeout\n", id);
-
-    bool result = condVar.wait(mutex, 5000);
-    printf("Thread1[%c]::run: waiting finished, %s\n", id,
-           result ? "received condition" : "timed out");
-    mutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class Thread2 : public Thread
-{
-private:
-    Mutex& mutex;
-
-    CondVar& condVar;
-
-public:
-    Thread2(Mutex& mutex, CondVar& condVar);
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline Thread2::Thread2(Mutex& mutex, CondVar& condVar) :
-    mutex(mutex),
-    condVar(condVar)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Thread2::run()
-{
-    printf("Thread2::run: sleeping\n");
-    sleep(2000);
-    printf("------------------------------------------------------------\n");
-
-    printf("Thread2::run: woke up, signalling condition variable\n");
-    condVar.signal();
-
-    printf("Thread2::run: sleeping...\n");
-    sleep(2000);
-    printf("------------------------------------------------------------\n");
-
-    printf("Thread2::run: woke up, broadcasting condition variable\n");
-    condVar.broadcast();
-
-    printf("Thread2::run: sleeping...\n");
-    sleep(2000);
-    printf("------------------------------------------------------------\n");
-
-    printf("Thread2::run: woke up, signalling condition variable\n");
-    condVar.signal();
-
-    printf("Thread2::run: sleeping...\n");
-    sleep(2000);
-    printf("------------------------------------------------------------\n");
-
-    printf("Thread2::run: woke up, signalling condition variable\n");
-    condVar.signal();
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int main()
-{
-    Mutex mutex;
-    CondVar condVar;
-
-    Thread1 thread1('A', mutex, condVar);
-    Thread1 thread1a('B', mutex, condVar);
-    Thread2 thread2(mutex, condVar);
-
-    printf("Starting threads\n");
-    thread1.start();
-    thread1a.start();
-    thread2.start();
-
-    printf("Waiting for thread1\n");
-    thread1.join();
-    thread1a.join();
-    printf("Waiting for thread2\n");
-    thread2.join();
-    printf("Both threads returned\n");
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/testevent.cc
===================================================================
--- test/testevent.cc	(revision 8)
+++ 	(revision )
@@ -1,193 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Waiter.h>
-#include <xplcommon/WaitableEvent.h>
-
-#include <cstdio>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::Thread;
-using xplcommon::Waiter;
-using xplcommon::WaitableEvent;
-
-//------------------------------------------------------------------------------
-
-class ServerThread : public Thread
-{
-private:
-    Waiter waiter;
-
-    WaitableEvent event;
-
-public:
-    ServerThread();
-
-    WaitableEvent& getEvent();
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline ServerThread::ServerThread() :
-    event(&waiter)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline WaitableEvent& ServerThread::getEvent()
-{
-    return event;
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::run()
-{
-    printf("ServerThread::run\n");
-    while(!event.check()) {
-        printf("ServerThread::run: waiting...\n");
-        waiter.wait();
-        printf("ServerThread::run: waiting done\n");
-    }
-    printf("ServerThread::run: finished\n");
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class BlockingServerThread : public Thread
-{
-private:
-    WaitableEvent event;
-
-public:
-    WaitableEvent& getEvent();
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline WaitableEvent& BlockingServerThread::getEvent()
-{
-    return event;
-}
-
-//------------------------------------------------------------------------------
-
-void BlockingServerThread::run()
-{
-    printf("BlockingServerThread::run: waiting...\n");
-    if (event.check()) {
-        printf("BlockingServerThread::run: waiting done\n");
-    } else {
-        printf("BlockingServerThread::run: waiting failed\n");
-    }
-    printf("BlockingServerThread::run: finished\n");
-}
-
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class ClientThread : public Thread
-{
-private:
-    WaitableEvent& event;
-
-public:
-    ClientThread(WaitableEvent& event);
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline ClientThread::ClientThread(WaitableEvent& event) :
-    event(event)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void ClientThread::run()
-{
-    printf("ClientThread::run: sleeping\n");
-    sleep(2000);
-    printf("ClientThread::run: firing event\n");
-    event.fire();
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-template <class Server> void runTest()
-{
-    Server serverThread;
-    ClientThread clientThread(serverThread.getEvent());
-
-    printf("Starting threads\n");
-    serverThread.start();
-    clientThread.start();
-
-    printf("Waiting for the client thread\n");
-    clientThread.join();
-    printf("Waiting for the server thread\n");
-    serverThread.join();
-    printf("Both threads returned\n");
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int main()
-{
-    printf("Running the event test with a non-blocking WaitableEvent\n\n");
-    runTest<ServerThread>();
-
-    printf("\n\nRunning the event test with a blocking WaitableEvent\n\n");
-    runTest<BlockingServerThread>();
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/testlocsock.cc
===================================================================
--- test/testlocsock.cc	(revision 28)
+++ 	(revision )
@@ -1,405 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Waiter.h>
-#include <xplcommon/LocalServerSocket.h>
-#include <xplcommon/LocalAcceptor.h>
-#include <xplcommon/LocalSocket.h>
-#include <xplcommon/LocalClientSocket.h>
-#include <xplcommon/LocalConnector.h>
-#include <xplcommon/ReadingBuffer.h>
-#include <xplcommon/WritingBuffer.h>
-#include <xplcommon/WaitableEvent.h>
-#include <xplcommon/PseudoRandom.h>
-
-#include <cstdlib>
-#include <cstdio>
-#include <cassert>
-
-#include <signal.h>
-
-#include <sys/time.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::Thread;
-using xplcommon::Waiter;
-using xplcommon::LocalServerSocket;
-using xplcommon::LocalAcceptor;
-using xplcommon::LocalSocket;
-using xplcommon::LocalClientSocket;
-using xplcommon::LocalConnector;
-using xplcommon::ReadingBuffer;
-using xplcommon::WritingBuffer;
-using xplcommon::WaitableEvent;
-using xplcommon::PseudoRandom;
-
-using std::min;
-
-//------------------------------------------------------------------------------
-
-void communicate(ReadingBuffer* readingBuffer, WritingBuffer* writingBuffer,
-                 Waiter& waiter, unsigned seed, const char* prefix,
-                 WaitableEvent* quitEvent = 0)
-{
-    static const size_t minToWrite = 2076;
-    static const size_t maxToWrite = 1345670;
-
-    static const size_t reportingInterval = 10000;
-
-    static const int sleepThreshold = static_cast<int>(PseudoRandom::MAX * 0.99);
-    static const int sleepRemainder = PseudoRandom::MAX - sleepThreshold;
-    static const unsigned minSleep = 10;
-    static const unsigned maxSleep = 250;
-    static const unsigned sleepRange = maxSleep - minSleep;
-
-    size_t numBytesRead = 0;
-    size_t nextReportRead = reportingInterval;
-    size_t numWriteBlocked = 0;
-    size_t numBytesWritten = 0;
-    size_t nextReportWritten = reportingInterval;
-    size_t numReadBlocked = 0;
-    size_t numMillisSlept = 0;
-
-    bool toQuit = false;
-
-    PseudoRandom random(seed);
-    while(!toQuit) {
-        size_t toWrite = random.nextUnsigned(maxToWrite, minToWrite);
-
-        size_t lastWriteLength = 0;
-        if (writingBuffer!=0) {
-            lastWriteLength = min(writingBuffer->getCapacity(), toWrite);
-            writingBuffer->reset();
-            writingBuffer->addLength(lastWriteLength);
-        }
-
-        while(toWrite>0) {
-            if (quitEvent!=0 && quitEvent->check()) {
-                toQuit = true;
-                break;
-            }
-
-            bool hasPending = false;
-
-            if (writingBuffer!=0) {
-                size_t loopCount = 0;
-                while(toWrite>0) {
-                    ++loopCount;
-                    if (writingBuffer->write()) {
-                        numBytesWritten += lastWriteLength;
-                        toWrite -= lastWriteLength;
-
-                        if (numBytesWritten>=nextReportWritten) {
-                            printf("%s: written %lu bytes with %lu blocking and %lu ms sleeping\n",
-                                   prefix,
-                                   static_cast<unsigned long>(numBytesWritten),
-                                   static_cast<unsigned long>(numWriteBlocked),
-                                   static_cast<unsigned long>(numMillisSlept));
-                            nextReportWritten += reportingInterval;
-                        }
-
-                        if (toWrite>0) {
-                            if (quitEvent!=0 && quitEvent->check()) {
-                                toQuit = true;
-                                break;
-                            } else {
-                                lastWriteLength = min(writingBuffer->getCapacity(), toWrite);
-                                writingBuffer->addLength(lastWriteLength);
-                                if (loopCount>10) {
-                                    break;
-                                }
-                            }
-                        }
-                    } else if (writingBuffer->failed()) {
-                        printf("%s: writing failed with error: %lu\n",
-                               prefix,
-                               static_cast<unsigned long>(writingBuffer->getErrorCode()));
-                        toQuit = true;
-                        break;
-                    } else {
-                        ++numWriteBlocked;
-                        hasPending = true;
-                        break;
-                    }
-                }
-                if (toQuit) break;
-            }
-
-            if (readingBuffer!=0) {
-                size_t loopCount = 0;
-                while(true) {
-                    ++loopCount;
-                    if (readingBuffer->read()) {
-                        size_t l = readingBuffer->getLength();
-                        if (l==0) {
-                            printf("%s: reading encountered end of file\n", prefix);
-                            toQuit = true;
-                            break;
-                        }
-                        numBytesRead += l;
-                        if (numBytesRead>=nextReportRead) {
-                            printf("%s: read %lu bytes with %lu blocking and %lu ms sleeping\n",
-                                   prefix,
-                                   static_cast<unsigned long>(numBytesRead),
-                                   static_cast<unsigned long>(numReadBlocked),
-                                   static_cast<unsigned long>(numMillisSlept));
-                            nextReportRead += reportingInterval;
-                        }
-                        readingBuffer->reset();
-                        if (quitEvent!=0 && quitEvent->check()) {
-                            toQuit = true;
-                            break;
-                        } else if (loopCount>10) {
-                            break;
-                        }
-                    } else if (readingBuffer->failed()) {
-                        printf("%s: reading failed with error: %lu\n",
-                               prefix,
-                               static_cast<unsigned long>(readingBuffer->getErrorCode()));
-                        toQuit = true;
-                        break;
-                    } else {
-                        ++numReadBlocked;
-                        hasPending = true;
-                        break;
-                    }
-                }
-                if (toQuit) break;
-            }
-
-            int r = random.next();
-            if (r>=sleepThreshold) {
-                unsigned toSleep = minSleep +
-                    static_cast<unsigned>(static_cast<double>(r - sleepThreshold) *
-                                          sleepRange / sleepRemainder);
-                assert(toSleep>=minSleep);
-                assert(toSleep<maxSleep);
-                Thread::sleep(toSleep);
-                numMillisSlept += toSleep;
-            }
-
-            if (toWrite>0 && hasPending) {
-                waiter.wait();
-                if (waiter.failed()) {
-                    printf("%s: waiting failed with error: %lu\n",
-                           prefix,
-                           static_cast<unsigned long>(waiter.getErrorCode()));
-                    toQuit = true;
-                    break;
-                }
-            }
-        }
-    }
-
-    printf("%s: written %lu bytes with %lu blocking\n",
-           prefix,
-           static_cast<unsigned long>(numBytesWritten),
-           static_cast<unsigned long>(numWriteBlocked));
-    printf("%s: read %lu bytes with %lu blocking\n",
-           prefix,
-           static_cast<unsigned long>(numBytesRead),
-           static_cast<unsigned long>(numReadBlocked));
-    printf("%s: slept %lu ms\n", prefix,
-           static_cast<unsigned long>(numMillisSlept));
-}
-
-//------------------------------------------------------------------------------
-
-class ServerThread : public Thread
-{
-private:
-    Waiter waiter;
-
-    WaitableEvent event;
-
-public:
-    ServerThread();
-
-    void signal();
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-ServerThread::ServerThread() :
-    event(&waiter)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::signal()
-{
-    event.fire();
-}
-
-//------------------------------------------------------------------------------
-
-void ServerThread::run()
-{
-    unsigned seed = static_cast<unsigned>(time(0)*1.2);
-    printf("ServerThread::run: seed=%u\n", seed);
-
-    LocalServerSocket serverSocket("test", &waiter);
-    LocalAcceptor& acceptor = serverSocket.getAcceptor();
-
-    bool eventFired = false;
-    while(!acceptor.accept()) {
-        eventFired = event.check();
-        if (eventFired) break;
-        if (acceptor.failed()) {
-            printf("ServerThread::run: acceptor failed...: %lu\n",
-                   (unsigned long)acceptor.getErrorCode());
-            return;
-        }
-        printf("ServerThread::run: waiting...\n");
-        waiter.wait();
-    }
-
-    if (eventFired) {
-        printf("ServerThread::run: waiting done, quitting\n");
-        return;
-    }
-
-    printf("ServerThread::run: waiting done, received connection\n");
-    LocalSocket* socket = acceptor.getSocket();
-
-    communicate(&socket->getReadingBuffer(), &socket->getWritingBuffer(),
-                waiter, seed, "ServerThread", &event);
-
-
-    delete socket;
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class ClientThread : public Thread
-{
-private:
-    Waiter waiter;
-
-    WaitableEvent event;
-
-public:
-    ClientThread();
-
-    void signal();
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-ClientThread::ClientThread() :
-    event(&waiter)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void ClientThread::signal()
-{
-    event.fire();
-}
-
-//------------------------------------------------------------------------------
-
-void ClientThread::run()
-{
-    unsigned seed = static_cast<unsigned>(time(0)*1.8);
-    printf("ClientThread::run: seed=%u\n", seed);
-
-    printf("ClientThread::run: sleeping\n");
-    sleep(500);
-    printf("ClientThread::run: connecting\n");
-
-    LocalClientSocket socket("test", &waiter);
-
-    LocalConnector& connector = socket.getConnector();
-
-    while(!connector.connect()) {
-        if (connector.failed()) {
-            printf("ClientThread::run: connector failed...\n");
-            return;
-        }
-        printf("ClientThread::run: waiting...\n");
-        waiter.wait();
-    }
-
-    printf("ClientThread::run: connected\n");
-
-    communicate(&socket.getReadingBuffer(), &socket.getWritingBuffer(),
-                waiter, seed, "ClientThread", &event);
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int main()
-{
-#if TARGET_API_POSIX
-    signal(SIGPIPE, SIG_IGN);
-#endif
-
-    ServerThread serverThread;
-    ClientThread clientThread;
-
-    printf("Starting threads\n");
-    serverThread.start();
-    clientThread.start();
-
-    Thread::sleep(60000);
-    //Thread::sleep(5000);
-    printf("Signalling the server thread\n");
-    //serverThread.signal();
-    clientThread.signal();
-    printf("Signalled the server thread\n");
-
-    printf("Waiting for the client thread\n");
-    clientThread.join();
-    printf("Waiting for the server thread\n");
-    serverThread.join();
-    printf("Both threads returned\n");
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/testmutex.cc
===================================================================
--- test/testmutex.cc	(revision 32)
+++ 	(revision )
@@ -1,163 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Mutex.h>
-
-#include <cstdlib>
-#include <cstdio>
-#include <cassert>
-
-#include <signal.h>
-
-#include <sys/time.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::Thread;
-using xplcommon::Mutex;
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class Thread1 : public Thread
-{
-private:
-    Mutex& mutex;
-
-public:
-    Thread1(Mutex& mutex);
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline Thread1::Thread1(Mutex& mutex) :
-    mutex(mutex)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Thread1::run()
-{
-    printf("Thread1::run: locking mutex\n");
-    mutex.lock();
-    printf("Thread1::run: locked mutex, sleeping...\n");
-
-    sleep(5000);
-
-    printf("Thread1::run: woke up, releasing mutex\n");
-    mutex.unlock();
-
-    printf("Thread1::run: released mutex, sleeping\n");
-
-    sleep(1000);
-
-    printf("Thread1::run: woke up, locking mutex\n");
-    mutex.lock();
-    printf("Thread1::run: locked mutex, releasing\n");
-    mutex.unlock();
-
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-class Thread2 : public Thread
-{
-private:
-    Mutex& mutex;
-
-public:
-    Thread2(Mutex& mutex);
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline Thread2::Thread2(Mutex& mutex) :
-    mutex(mutex)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void Thread2::run()
-{
-    printf("Thread2::run: sleeping\n");
-    sleep(1000);
-
-    printf("Thread2::run: woke up, trying to lock mutex...\n");
-
-    while(!mutex.tryLock()) {
-        sleep(200);
-    }
-
-    printf("Thread2::run: locked mutex, sleeping...\n");
-    sleep(5000);
-    printf("Thread2::run: woke up, releasing mutex\n");
-    mutex.unlock();
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int main()
-{
-    Mutex mutex;
-
-    Thread1 thread1(mutex);
-    Thread2 thread2(mutex);
-
-    printf("Starting threads\n");
-    thread1.start();
-    thread2.start();
-
-
-    printf("Waiting for thread1\n");
-    thread1.join();
-    printf("Waiting for thread2\n");
-    thread2.join();
-    printf("Both threads returned\n");
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/testrandom.cc
===================================================================
--- test/testrandom.cc	(revision 27)
+++ 	(revision )
@@ -1,69 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/PseudoRandom.h>
-
-#include <cstdio>
-#include <ctime>
-#include <cstdlib>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::PseudoRandom;
-
-//------------------------------------------------------------------------------
-
-int main(int argc, char* argv[])
-{
-    unsigned int seed = (argc>1) ? atoi(argv[1]) : time(0);
-
-    printf("seed=%u\n", seed);
-
-    srand(seed);
-    PseudoRandom pr(seed);
-    for(size_t i = 0; i<10000; ++i) {
-        int r1 = rand();
-        int r2 = pr.next();
-        if (r1!=r2) {
-            printf("values at i=%zu differ: rand(): %d, PseudoRandom: %d\n",
-                   i, r1, r2);
-            break;
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: st/testthread.cc
===================================================================
--- test/testthread.cc	(revision 35)
+++ 	(revision )
@@ -1,126 +1,0 @@
-// Copyright (c) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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.
-
-// 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.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include <xplcommon/Thread.h>
-#include <xplcommon/Waiter.h>
-#include <xplcommon/LocalServerSocket.h>
-#include <xplcommon/LocalAcceptor.h>
-#include <xplcommon/LocalSocket.h>
-#include <xplcommon/LocalClientSocket.h>
-#include <xplcommon/LocalConnector.h>
-#include <xplcommon/DataStream.h>
-#include <xplcommon/WaitableEvent.h>
-#include <xplcommon/PseudoRandom.h>
-
-#include <cstdlib>
-#include <cstdio>
-#include <cassert>
-
-#include <signal.h>
-
-#include <sys/time.h>
-
-//------------------------------------------------------------------------------
-
-using xplcommon::Thread;
-using xplcommon::Waiter;
-using xplcommon::LocalServerSocket;
-using xplcommon::LocalAcceptor;
-using xplcommon::LocalSocket;
-using xplcommon::LocalClientSocket;
-using xplcommon::LocalConnector;
-using xplcommon::BufferedStream;
-using xplcommon::DataStream;
-using xplcommon::PseudoRandom;
-
-using std::min;
-
-//------------------------------------------------------------------------------
-
-class TestThread : public Thread
-{
-private:
-    unsigned long id;
-
-public:
-    TestThread(unsigned long id);
-
-    virtual void run();
-};
-
-//------------------------------------------------------------------------------
-
-inline TestThread::TestThread(unsigned long id) :
-    Thread(true),
-    id(id)
-{
-}
-
-//------------------------------------------------------------------------------
-
-void TestThread::run()
-{
-    printf("TestThread: id=%lu\n", id);
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-int main()
-{
-    static const size_t numThreads = 1000;
-
-    TestThread** threads = new TestThread*[numThreads];
-
-    unsigned long id = 1;
-    while(true) {
-        for(size_t i = 0; i<numThreads; ++i) {
-            threads[i] = new TestThread(id++);
-            threads[i]->start();
-        }
-
-        Thread::sleep(2000);
-
-        // for(size_t i = 0; i<numThreads; ++i) {
-        //     delete threads[i];
-        // }
-    }
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
