* wxSocket fixes

* wxStream: - new inheritance, new stream buffer, nearly the same API for the
              end user
            - updated other streams consequently
* wxGTK: some change to make it compile on GTK 1.0 and GTK 1.1
* small changes on wxThread to prepare a more reentrant lib
* wxVariant works with wxStream too now


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@829 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux 1998-10-14 17:36:50 +00:00
parent 1b19f0560f
commit 75ed1d15d0
30 changed files with 706 additions and 731 deletions

View File

@ -18,7 +18,7 @@
#include <wx/stream.h> #include <wx/stream.h>
class wxDataInputStream: public virtual wxFilterInputStream { class wxDataInputStream: public wxFilterInputStream {
public: public:
wxDataInputStream(wxInputStream& s); wxDataInputStream(wxInputStream& s);
virtual ~wxDataInputStream(); virtual ~wxDataInputStream();
@ -31,7 +31,7 @@ public:
wxString ReadString(); wxString ReadString();
}; };
class wxDataOutputStream: public virtual wxFilterOutputStream { class wxDataOutputStream: public wxFilterOutputStream {
public: public:
wxDataOutputStream(wxOutputStream& s); wxDataOutputStream(wxOutputStream& s);
virtual ~wxDataOutputStream(); virtual ~wxDataOutputStream();
@ -44,11 +44,5 @@ class wxDataOutputStream: public virtual wxFilterOutputStream {
void WriteString(const wxString& string); void WriteString(const wxString& string);
}; };
class wxDataStream: public wxDataInputStream, public wxDataOutputStream,
public wxFilterStream {
public:
wxDataStream(wxStream& stream);
};
#endif #endif
// _WX_DATSTREAM_H_ // _WX_DATSTREAM_H_

View File

@ -21,23 +21,11 @@
#include <wx/stream.h> #include <wx/stream.h>
#include <wx/file.h> #include <wx/file.h>
// Disable warnings such as class wxFileInputStream: public wxInputStream {
// 'wxFileStream' : inherits 'wxFileInputStream::Peek' via dominance
#ifdef _MSC_VER
#pragma warning(disable:4250)
#endif
class wxFileStreamBase {
protected:
wxFile *m_file;
bool m_file_destroy;
};
class wxFileInputStream: public virtual wxInputStream,
public virtual wxFileStreamBase {
public: public:
wxFileInputStream(const wxString& fileName); wxFileInputStream(const wxString& ifileName);
wxFileInputStream(wxFile& file);
wxFileInputStream(int fd);
virtual ~wxFileInputStream(); virtual ~wxFileInputStream();
virtual char Peek(); virtual char Peek();
@ -47,15 +35,20 @@ class wxFileInputStream: public virtual wxInputStream,
protected: protected:
wxFileInputStream(); wxFileInputStream();
size_t DoRead(void *buffer, size_t size); size_t OnSysRead(void *buffer, size_t size);
off_t DoSeekInput(off_t pos, wxSeekMode mode); off_t OnSysSeek(off_t pos, wxSeekMode mode);
off_t DoTellInput() const; off_t OnSysTell() const;
protected:
wxFile *m_file;
bool m_file_destroy;
}; };
class wxFileOutputStream: public virtual wxOutputStream, class wxFileOutputStream: public wxOutputStream {
public virtual wxFileStreamBase {
public: public:
wxFileOutputStream(const wxString& fileName); wxFileOutputStream(const wxString& fileName);
wxFileOutputStream(wxFile& file);
wxFileOutputStream(int fd);
virtual ~wxFileOutputStream(); virtual ~wxFileOutputStream();
// To solve an ambiguity on GCC // To solve an ambiguity on GCC
@ -69,20 +62,13 @@ class wxFileOutputStream: public virtual wxOutputStream,
protected: protected:
wxFileOutputStream(); wxFileOutputStream();
size_t DoWrite(const void *buffer, size_t size); size_t OnSysWrite(const void *buffer, size_t size);
off_t DoSeekOutput(off_t pos, wxSeekMode mode); off_t OnSysSeek(off_t pos, wxSeekMode mode);
off_t DoTellOutput() const; off_t OnSysTell() const;
protected:
wxFile *m_file;
bool m_file_destroy;
}; };
class wxFileStream: public wxStream,
public wxFileInputStream, public wxFileOutputStream {
public:
wxFileStream(const wxString& fileName);
virtual ~wxFileStream();
};
#ifdef _MSC_VER
#pragma warning(default:4250)
#endif
#endif #endif

View File

@ -13,53 +13,18 @@
#include <wx/stream.h> #include <wx/stream.h>
class wxMemoryStreamBase { class wxMemoryInputStream: public wxInputStream {
protected:
wxMemoryStreamBase();
virtual ~wxMemoryStreamBase();
bool ChangeBufferSize(size_t new_length);
protected:
bool m_persistent;
size_t m_length;
char *m_buffer;
int m_iolimit;
};
class wxMemoryInputStream: public virtual wxMemoryStreamBase, public wxInputStream {
public: public:
wxMemoryInputStream(const char *data, size_t length); wxMemoryInputStream(const char *data, size_t length);
virtual ~wxMemoryInputStream(); virtual ~wxMemoryInputStream();
char Peek(); char Peek();
protected:
size_t DoRead(void *buffer, size_t size);
off_t DoSeekInput(off_t pos, wxSeekMode mode);
off_t DoTellInput() const { return m_position_i; }
protected:
off_t m_position_i;
}; };
class wxMemoryOutputStream: public virtual wxMemoryStreamBase, public wxOutputStream { class wxMemoryOutputStream: public wxOutputStream {
public: public:
wxMemoryOutputStream(char *data = NULL, size_t length = 0); wxMemoryOutputStream(char *data = NULL, size_t length = 0);
virtual ~wxMemoryOutputStream(); virtual ~wxMemoryOutputStream();
char *GetData() { Sync(); return m_buffer; }
size_t GetLength() { Sync(); return m_length; }
protected:
size_t DoWrite(const void *buffer, size_t size);
off_t DoSeekOutput(off_t pos, wxSeekMode mode);
off_t DoTellOutput() const { return m_position_o; }
protected:
off_t m_position_o;
}; };
class wxMemoryStream: public wxMemoryInputStream, public wxMemoryOutputStream { class wxMemoryStream: public wxMemoryInputStream, public wxMemoryOutputStream {

View File

@ -56,7 +56,8 @@ class wxTCPConnection: public wxConnectionBase
protected: protected:
wxSocketBase *m_sock; wxSocketBase *m_sock;
wxSocketStream *m_sockstrm; wxSocketStream *m_sockstrm;
wxDataStream *m_codec; wxDataInputStream *m_codeci;
wxDataOutputStream *m_codeco;
wxString m_topic; wxString m_topic;
friend class wxTCPServer; friend class wxTCPServer;

View File

@ -18,11 +18,11 @@
#include "wx/stream.h" #include "wx/stream.h"
#include "wx/socket.h" #include "wx/socket.h"
class WXDLLEXPORT wxSocketOutputStream : public virtual wxOutputStream class WXDLLEXPORT wxSocketOutputStream : public wxOutputStream
{ {
public: public:
wxSocketOutputStream(wxSocketBase& s); wxSocketOutputStream(wxSocketBase& s);
virtual ~wxSocketOutputStream(); ~wxSocketOutputStream();
wxOutputStream& Write(const void *buffer, size_t size); wxOutputStream& Write(const void *buffer, size_t size);
off_t SeekO( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) off_t SeekO( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
@ -30,13 +30,11 @@ class WXDLLEXPORT wxSocketOutputStream : public virtual wxOutputStream
off_t TellO() off_t TellO()
{ return -1; } { return -1; }
bool Bad() { return m_o_socket->IsDisconnected(); }
size_t LastWrite() { return m_o_socket->LastCount(); }
protected: protected:
wxSocketBase *m_o_socket; wxSocketBase *m_o_socket;
}; };
class WXDLLEXPORT wxSocketInputStream : public virtual wxInputStream class WXDLLEXPORT wxSocketInputStream : public wxInputStream
{ {
public: public:
wxSocketInputStream(wxSocketBase& s); wxSocketInputStream(wxSocketBase& s);
@ -48,19 +46,16 @@ class WXDLLEXPORT wxSocketInputStream : public virtual wxInputStream
off_t TellI() off_t TellI()
{ return -1; } { return -1; }
bool Eof() { return m_i_socket->IsDisconnected(); }
size_t LastRead() { return m_i_socket->LastCount(); }
protected: protected:
wxSocketBase *m_i_socket; wxSocketBase *m_i_socket;
}; };
class WXDLLEXPORT wxSocketStream : public wxSocketInputStream, class WXDLLEXPORT wxSocketStream : public wxSocketInputStream,
public wxSocketOutputStream, public wxSocketOutputStream
public wxStream { {
public: public:
wxSocketStream(wxSocketBase& i_s, wxSocketBase& o_s);
wxSocketStream(wxSocketBase& s); wxSocketStream(wxSocketBase& s);
~wxSocketStream();
}; };
#endif #endif

View File

@ -259,7 +259,7 @@ public:
virtual bool Connect(wxSockAddress& addr_man, bool wait = TRUE); virtual bool Connect(wxSockAddress& addr_man, bool wait = TRUE);
bool WaitOnConnect(long seconds = -1); bool WaitOnConnect(long seconds = -1, long microseconds = 0);
virtual void OnRequest(wxRequestEvent flags); virtual void OnRequest(wxRequestEvent flags);
}; };

View File

@ -21,6 +21,7 @@
#include "wx/string.h" #include "wx/string.h"
#include "wx/filefn.h" // for off_t, wxInvalidOffset and wxSeekMode #include "wx/filefn.h" // for off_t, wxInvalidOffset and wxSeekMode
class WXDLLEXPORT wxStreamBase;
class WXDLLEXPORT wxInputStream; class WXDLLEXPORT wxInputStream;
class WXDLLEXPORT wxOutputStream; class WXDLLEXPORT wxOutputStream;
@ -29,74 +30,118 @@ typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&);
wxOutputStream& WXDLLEXPORT wxEndL(wxOutputStream& o_stream); wxOutputStream& WXDLLEXPORT wxEndL(wxOutputStream& o_stream);
// Disable warnings such as
// 'wxFilterStream' : inherits 'wxFilterInputStream::Peek' via dominance
#ifdef _MSC_VER
#pragma warning(disable:4250)
#endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Stream buffer // Stream buffer
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class WXDLLEXPORT wxStreamBuffer { class WXDLLEXPORT wxStreamBuffer {
public: public:
wxStreamBuffer(wxInputStream& stream); typedef enum {
wxStreamBuffer(wxOutputStream& stream); read, write
} BufMode;
// -----------
// ctor & dtor
// -----------
wxStreamBuffer(wxStreamBase& stream, BufMode mode);
~wxStreamBuffer(); ~wxStreamBuffer();
// -----------
// Filtered IO
// -----------
void Read(void *buffer, size_t size); void Read(void *buffer, size_t size);
void Write(const void *buffer, size_t size); void Write(const void *buffer, size_t size);
void WriteBack(char c); bool WriteBack(const char *buffer, size_t size);
bool WriteBack(char c);
off_t Tell() const;
off_t Seek(off_t pos, wxSeekMode mode);
// --------------
// Buffer control
// --------------
void ResetBuffer();
void SetBufferIO(char *buffer_start, char *buffer_end); void SetBufferIO(char *buffer_start, char *buffer_end);
void SetBufferIO(size_t bufsize); void SetBufferIO(size_t bufsize);
void ResetBuffer();
void SetBufferPosition(char *buffer_position)
{ m_buffer_pos = buffer_position; }
void SetIntPosition(size_t pos)
{ m_buffer_pos = m_buffer_start + pos; }
char *GetBufferPosition() const { return m_buffer_pos; }
size_t GetIntPosition() const { return m_buffer_pos - m_buffer_start; }
char *GetBufferStart() const { return m_buffer_start; } char *GetBufferStart() const { return m_buffer_start; }
char *GetBufferEnd() const { return m_buffer_end; } char *GetBufferEnd() const { return m_buffer_end; }
size_t GetBufferSize() const { return m_buffer_size; } char *GetBufferPos() const { return m_buffer_pos; }
size_t GetLastAccess() const { return m_buffer_end - m_buffer_start; } off_t GetIntPosition() const { return m_buffer_pos-m_buffer_start; }
void SetIntPosition(off_t pos) { m_buffer_pos = m_buffer_start+pos; }
size_t GetLastAccess() const { return m_buffer_end-m_buffer_start; }
void Fixed(bool fixed) { m_fixed = fixed; }
bool FlushBuffer();
bool FillBuffer();
size_t GetDataLeft() const;
protected:
char *AllocSpaceWBack(size_t needed_size);
size_t GetWBack(char *buf, size_t bsize);
void GetFromBuffer(void *buffer, size_t size);
void PutToBuffer(const void *buffer, size_t size);
protected: protected:
char *m_buffer_start, *m_buffer_end, *m_buffer_pos; char *m_buffer_start, *m_buffer_end, *m_buffer_pos;
size_t m_buffer_size; size_t m_buffer_size;
wxInputStream *m_istream; char *m_wback;
wxOutputStream *m_ostream; size_t m_wbacksize, m_wbackcur;
bool m_fixed;
wxStreamBase *m_stream;
BufMode m_mode;
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxStream: base classes // wxStream: base classes
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class WXDLLEXPORT wxInputStream { typedef enum {
wxStream_NOERROR,
wxStream_EOF
} wxStreamError;
class WXDLLEXPORT wxStreamBase {
public:
wxStreamBase();
virtual ~wxStreamBase();
wxStreamError LastError() { return m_lasterror; }
protected:
friend class wxStreamBuffer;
virtual size_t OnSysRead(void *buffer, size_t bufsize);
virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
virtual off_t OnSysTell();
protected:
size_t m_lastcount;
wxStreamError m_lasterror;
};
class WXDLLEXPORT wxInputStream: public wxStreamBase {
public: public:
wxInputStream(); wxInputStream();
wxInputStream(wxStreamBuffer *sbuf);
virtual ~wxInputStream(); virtual ~wxInputStream();
// IO functions // IO functions
virtual char Peek() { return 0; } virtual char Peek();
virtual char GetC(); char GetC();
virtual wxInputStream& Read(void *buffer, size_t size); wxInputStream& Read(void *buffer, size_t size);
wxInputStream& Read(wxOutputStream& stream_out); wxInputStream& Read(wxOutputStream& stream_out);
// Position functions // Position functions
virtual off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart); off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
virtual off_t TellI() const; off_t TellI() const;
// State functions // State functions
bool Eof() const { return m_eof; }
size_t LastRead() { return m_lastread; }
wxStreamBuffer *InputStreamBuffer() { return m_i_streambuf; } wxStreamBuffer *InputStreamBuffer() { return m_i_streambuf; }
size_t LastRead() { return wxStreamBase::m_lastcount; }
// Operators // Operators
wxInputStream& operator>>(wxOutputStream& out) { return Read(out); } wxInputStream& operator>>(wxOutputStream& out) { return Read(out); }
@ -105,11 +150,12 @@ class WXDLLEXPORT wxInputStream {
wxInputStream& operator>>(short& i); wxInputStream& operator>>(short& i);
wxInputStream& operator>>(int& i); wxInputStream& operator>>(int& i);
wxInputStream& operator>>(long& i); wxInputStream& operator>>(long& i);
wxInputStream& operator>>(float& i); wxInputStream& operator>>(double& i);
#if wxUSE_SERIAL #if wxUSE_SERIAL
wxInputStream& operator>>(wxObject *& obj); wxInputStream& operator>>(wxObject *& obj);
#endif #endif
wxInputStream& operator>>(float& f) { double d; operator>>((double&)d); f = (float)d; return *this; }
wxInputStream& operator>>(unsigned char& c) { return operator>>((char&)c); } wxInputStream& operator>>(unsigned char& c) { return operator>>((char&)c); }
wxInputStream& operator>>(unsigned short& i) { return operator>>((short&)i); } wxInputStream& operator>>(unsigned short& i) { return operator>>((short&)i); }
wxInputStream& operator>>(unsigned int& i) { return operator>>((int&)i); } wxInputStream& operator>>(unsigned int& i) { return operator>>((int&)i); }
@ -117,40 +163,26 @@ class WXDLLEXPORT wxInputStream {
wxInputStream& operator>>( __wxInputManip func) { return func(*this); } wxInputStream& operator>>( __wxInputManip func) { return func(*this); }
protected: protected:
friend class wxStreamBuffer; bool m_i_destroybuf;
friend class wxFilterInputStream;
wxInputStream(wxStreamBuffer *buffer);
virtual size_t DoRead(void *WXUNUSED(buffer), size_t WXUNUSED(size) )
{ return 0; }
virtual off_t DoSeekInput( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
{ return wxInvalidOffset; }
virtual off_t DoTellInput() const
{ return wxInvalidOffset; }
protected:
bool m_eof, m_i_destroybuf;
size_t m_lastread;
wxStreamBuffer *m_i_streambuf; wxStreamBuffer *m_i_streambuf;
}; };
class WXDLLEXPORT wxOutputStream { class WXDLLEXPORT wxOutputStream: public wxStreamBase {
public: public:
wxOutputStream(); wxOutputStream();
wxOutputStream(wxStreamBuffer *sbuf);
virtual ~wxOutputStream(); virtual ~wxOutputStream();
virtual wxOutputStream& Write(const void *buffer, size_t size); wxOutputStream& Write(const void *buffer, size_t size);
wxOutputStream& Write(wxInputStream& stream_in); wxOutputStream& Write(wxInputStream& stream_in);
virtual off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart); off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
virtual off_t TellO() const; off_t TellO() const;
virtual bool Bad() const { return m_bad; } size_t LastWrite() const { return wxStreamBase::m_lastcount; }
virtual size_t LastWrite() const { return m_lastwrite; }
wxStreamBuffer *OutputStreamBuffer() { return m_o_streambuf; } wxStreamBuffer *OutputStreamBuffer() { return m_o_streambuf; }
virtual void Sync(); void Sync();
wxOutputStream& operator<<(wxInputStream& out) { return Write(out); } wxOutputStream& operator<<(wxInputStream& out) { return Write(out); }
wxOutputStream& operator<<(const char *string); wxOutputStream& operator<<(const char *string);
@ -172,36 +204,15 @@ class WXDLLEXPORT wxOutputStream {
wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); }
protected: protected:
friend class wxStreamBuffer; bool m_o_destroybuf;
friend class wxFilterOutputStream;
wxOutputStream(wxStreamBuffer *buffer);
virtual size_t DoWrite( const void *WXUNUSED(buffer), size_t WXUNUSED(size) )
{ return 0; }
virtual off_t DoSeekOutput( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) )
{ return wxInvalidOffset; }
virtual off_t DoTellOutput() const
{ return wxInvalidOffset; }
protected:
bool m_bad, m_o_destroybuf;
size_t m_lastwrite;
wxStreamBuffer *m_o_streambuf; wxStreamBuffer *m_o_streambuf;
}; };
class WXDLLEXPORT wxStream: public virtual wxInputStream,
public virtual wxOutputStream
{
public:
wxStream();
};
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// "Filter" streams // "Filter" streams
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
class WXDLLEXPORT wxFilterInputStream: public virtual wxInputStream { class WXDLLEXPORT wxFilterInputStream: public wxInputStream {
public: public:
wxFilterInputStream(); wxFilterInputStream();
wxFilterInputStream(wxInputStream& stream); wxFilterInputStream(wxInputStream& stream);
@ -209,50 +220,18 @@ class WXDLLEXPORT wxFilterInputStream: public virtual wxInputStream {
char Peek() { return m_parent_i_stream->Peek(); } char Peek() { return m_parent_i_stream->Peek(); }
bool Eof() const { return m_parent_i_stream->Eof(); }
size_t LastRead() const { return m_parent_i_stream->LastRead(); }
off_t TellI() const { return m_parent_i_stream->TellI(); }
protected:
size_t DoRead(void *buffer, size_t size);
off_t DoSeekInput(off_t pos, wxSeekMode mode);
off_t DoTellInput() const;
protected: protected:
wxInputStream *m_parent_i_stream; wxInputStream *m_parent_i_stream;
}; };
class WXDLLEXPORT wxFilterOutputStream: public virtual wxOutputStream { class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream {
public: public:
wxFilterOutputStream(); wxFilterOutputStream();
wxFilterOutputStream(wxOutputStream& stream); wxFilterOutputStream(wxOutputStream& stream);
virtual ~wxFilterOutputStream(); ~wxFilterOutputStream();
bool Bad() const { return m_parent_o_stream->Bad(); }
size_t LastWrite() const { return m_parent_o_stream->LastWrite(); }
off_t TellO() const { return m_parent_o_stream->TellO(); }
protected:
// The forward is implicitely done by wxStreamBuffer.
size_t DoWrite(const void *buffer, size_t size);
off_t DoSeekOutput(off_t pos, wxSeekMode mode);
off_t DoTellOutput() const;
protected: protected:
wxOutputStream *m_parent_o_stream; wxOutputStream *m_parent_o_stream;
}; };
class WXDLLEXPORT wxFilterStream: public wxStream,
public virtual wxFilterInputStream,
public virtual wxFilterOutputStream {
public:
wxFilterStream(wxStream& stream);
wxFilterStream();
};
#ifdef _MSC_VER
#pragma warning(default:4250)
#endif
#endif #endif

View File

@ -152,7 +152,8 @@ private:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Global variables // Global variables
// GUI mutex. // GUI mutex handling.
WXDLLEXPORT_DATA(extern wxMutex) wxMainMutex; void WXDLLEXPORT wxMutexGuiEnter();
void WXDLLEXPORT wxMutexGuiLeave();
#endif #endif

View File

@ -22,12 +22,8 @@ class wxZlibInputStream: public wxFilterInputStream {
wxZlibInputStream(wxInputStream& stream); wxZlibInputStream(wxInputStream& stream);
virtual ~wxZlibInputStream(); virtual ~wxZlibInputStream();
bool Eof() const;
protected: protected:
size_t DoRead(void *buffer, size_t size); size_t OnSysRead(void *buffer, size_t size);
off_t DoSeekInput(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; }
off_t DoTellInput() const { return wxInvalidOffset; }
protected: protected:
size_t m_z_size; size_t m_z_size;
@ -42,12 +38,8 @@ class wxZlibOutputStream: public wxFilterOutputStream {
void Sync(); void Sync();
bool Bad() const;
protected: protected:
size_t DoWrite(const void *buffer, size_t size); size_t OnSysWrite(const void *buffer, size_t size);
off_t DoSeekOutput(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; }
off_t DoTellOutput() const { return wxInvalidOffset; }
protected: protected:
size_t m_z_size; size_t m_z_size;

View File

@ -200,12 +200,3 @@ void wxDataOutputStream::WriteDouble(double d)
#endif #endif
Write(buf, 10); Write(buf, 10);
} }
// ---------------------------------------------------------------------------
// wxDataStream
// ---------------------------------------------------------------------------
wxDataStream::wxDataStream(wxStream& stream)
: wxDataInputStream(stream), wxDataOutputStream(stream)
{
}

View File

@ -53,17 +53,17 @@ char wxFileInputStream::Peek()
return 0; return 0;
} }
size_t wxFileInputStream::DoRead(void *buffer, size_t size) size_t wxFileInputStream::OnSysRead(void *buffer, size_t size)
{ {
return m_file->Read(buffer, size); return m_file->Read(buffer, size);
} }
off_t wxFileInputStream::DoSeekInput(off_t pos, wxSeekMode mode) off_t wxFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
{ {
return m_file->Seek(pos, mode); return m_file->Seek(pos, mode);
} }
off_t wxFileInputStream::DoTellInput() const off_t wxFileInputStream::OnSysTell() const
{ {
return m_file->Tell(); return m_file->Tell();
} }
@ -95,19 +95,19 @@ wxFileOutputStream::~wxFileOutputStream()
} }
} }
size_t wxFileOutputStream::DoWrite(const void *buffer, size_t size) size_t wxFileOutputStream::OnSysWrite(const void *buffer, size_t size)
{ {
size_t ret = m_file->Write(buffer, size); size_t ret = m_file->Write(buffer, size);
m_bad = m_file->Error(); m_lasterror = wxStream_EOF; // TODO
return ret; return ret;
} }
off_t wxFileOutputStream::DoTellOutput() const off_t wxFileOutputStream::OnSysTell() const
{ {
return m_file->Tell(); return m_file->Tell();
} }
off_t wxFileOutputStream::DoSeekOutput(off_t pos, wxSeekMode mode) off_t wxFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
{ {
return m_file->Seek(pos, mode); return m_file->Seek(pos, mode);
} }
@ -117,21 +117,3 @@ void wxFileOutputStream::Sync()
wxOutputStream::Sync(); wxOutputStream::Sync();
m_file->Flush(); m_file->Flush();
} }
// ----------------------------------------------------------------------------
// wxFileStream
// ----------------------------------------------------------------------------
wxFileStream::wxFileStream(const wxString& fileName)
: wxFileInputStream(), wxFileOutputStream()
{
m_file = new wxFile(fileName, wxFile::read_write);
// Reread the initial buffer.
m_i_streambuf->SetBufferIO(1024);
}
wxFileStream::~wxFileStream()
{
Sync();
delete m_file;
}

View File

@ -240,7 +240,7 @@ public:
: wxSocketInputStream(*sock), m_ftp(ftp_clt) {} : wxSocketInputStream(*sock), m_ftp(ftp_clt) {}
virtual ~wxInputFTPStream(void) virtual ~wxInputFTPStream(void)
{ {
if (Eof()) if (LastError() != wxStream_NOERROR)
m_ftp->GetResult('2'); m_ftp->GetResult('2');
else else
m_ftp->Abort(); m_ftp->Abort();
@ -256,7 +256,7 @@ public:
: wxSocketOutputStream(*sock), m_ftp(ftp_clt) {} : wxSocketOutputStream(*sock), m_ftp(ftp_clt) {}
virtual ~wxOutputFTPStream(void) virtual ~wxOutputFTPStream(void)
{ {
if (Bad()) if (LastError() != wxStream_NOERROR)
m_ftp->GetResult('2'); m_ftp->GetResult('2');
else else
m_ftp->Abort(); m_ftp->Abort();

View File

@ -23,52 +23,15 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
// ----------------------------------------------------------------------------
// wxMemoryStreamBase
// ----------------------------------------------------------------------------
wxMemoryStreamBase::wxMemoryStreamBase()
{
m_buffer = NULL;
m_iolimit = 0;
m_persistent = FALSE;
m_length = 0;
}
wxMemoryStreamBase::~wxMemoryStreamBase()
{
if (!m_persistent && m_buffer)
free(m_buffer);
}
bool wxMemoryStreamBase::ChangeBufferSize(size_t new_size)
{
if (m_iolimit == 1)
return FALSE;
m_length = new_size;
if (!m_buffer)
m_buffer = (char *)malloc(m_length);
else
m_buffer = (char *)realloc(m_buffer, m_length);
return (m_buffer != NULL);
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxMemoryInputStream // wxMemoryInputStream
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len) wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
: wxInputStream()
{ {
m_persistent = TRUE; m_i_streambuf->SetBufferIO((char *)data, data+len);
m_length = len; m_i_streambuf->Fixed(TRUE);
m_buffer = (char *)data; // It's bad.
m_position_i = 0;
m_lastread = 0;
m_eof = FALSE;
m_iolimit = 1;
m_i_streambuf->SetBufferIO(0);
} }
wxMemoryInputStream::~wxMemoryInputStream() wxMemoryInputStream::~wxMemoryInputStream()
@ -77,51 +40,7 @@ wxMemoryInputStream::~wxMemoryInputStream()
char wxMemoryInputStream::Peek() char wxMemoryInputStream::Peek()
{ {
// wxStreamBuffer is disabled so just peek the current character. return m_i_streambuf->GetBufferStart()[m_i_streambuf->GetIntPosition()];
return m_buffer[m_position_i];
}
size_t wxMemoryInputStream::DoRead(void *buffer, size_t size)
{
if (m_iolimit == 2) {
m_eof = TRUE;
return 0;
}
if (m_position_i+size > m_length)
size = m_length-m_position_i;
memcpy((void *)((unsigned long)buffer+m_position_i), m_buffer, size);
m_position_i += size;
return size;
}
off_t wxMemoryInputStream::DoSeekInput(off_t pos, wxSeekMode mode)
{
if (m_iolimit == 2)
return 0;
switch (mode) {
case wxFromStart:
if ((size_t)pos > m_length)
return m_position_i;
return (m_position_i = pos);
case wxFromCurrent:
if ((size_t)(m_position_i+pos) > m_length)
return m_position_i;
return (m_position_i += pos);
case wxFromEnd:
if ((size_t)(m_length-pos) > m_length)
return m_position_i;
return (m_position_i = m_length-pos);
}
return m_position_i;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -129,82 +48,13 @@ off_t wxMemoryInputStream::DoSeekInput(off_t pos, wxSeekMode mode)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len) wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
: wxOutputStream()
{ {
m_persistent = FALSE; if (data)
m_buffer = data; m_o_streambuf->SetBufferIO(data, data+len);
m_length = len; m_o_streambuf->Fixed(TRUE);
m_position_o = 0;
m_lastwrite = 0;
m_bad = FALSE;
m_iolimit = 2;
m_o_streambuf->SetBufferIO(0);
} }
wxMemoryOutputStream::~wxMemoryOutputStream() wxMemoryOutputStream::~wxMemoryOutputStream()
{
Sync();
}
size_t wxMemoryOutputStream::DoWrite(const void *buffer, size_t size)
{
if (m_iolimit == 1) {
m_bad = TRUE;
return 0;
}
if (m_position_o+size > m_length)
if (!ChangeBufferSize(m_position_o+size)) {
m_bad = TRUE;
return 0;
}
memcpy(m_buffer+m_position_o, buffer, size);
m_position_o += size;
return size;
}
off_t wxMemoryOutputStream::DoSeekOutput(off_t pos, wxSeekMode mode)
{
if (m_iolimit == 1)
return 0;
switch (mode) {
case wxFromStart:
if ((size_t)pos > m_length)
return m_position_o;
return (m_position_o = pos);
case wxFromCurrent:
if ((size_t)(m_position_o+pos) > m_length)
return m_position_o;
return (m_position_o += pos);
case wxFromEnd:
if ((size_t)(m_length-pos) > m_length)
return m_position_o;
return (m_position_o = m_length-pos);
}
return m_position_o;
}
// ----------------------------------------------------------------------------
// wxMemoryStream
// ----------------------------------------------------------------------------
wxMemoryStream::wxMemoryStream(char *data, size_t len)
: wxMemoryInputStream(NULL, 0), wxMemoryOutputStream(NULL, 0)
{
m_persistent = FALSE;
m_buffer = data;
m_length = len;
m_iolimit = 0;
}
wxMemoryStream::~wxMemoryStream()
{ {
} }

View File

@ -36,6 +36,7 @@
#include "wx/listbox.h" #include "wx/listbox.h"
#include "wx/choice.h" #include "wx/choice.h"
#include "wx/checkbox.h" #include "wx/checkbox.h"
#include "wx/settings.h"
#include "wx/slider.h" #include "wx/slider.h"
#include "wx/statbox.h" #include "wx/statbox.h"
#if wxUSE_GAUGE #if wxUSE_GAUGE

View File

@ -92,7 +92,8 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host,
wxSocketHandler *hsock = &wxSocketHandler::Master(); wxSocketHandler *hsock = &wxSocketHandler::Master();
wxSocketClient *client = hsock->CreateClient(); wxSocketClient *client = hsock->CreateClient();
wxSocketStream *stream = new wxSocketStream(*client); wxSocketStream *stream = new wxSocketStream(*client);
wxDataStream data_s(*stream); wxDataInputStream data_is(*stream);
wxDataOutputStream data_os(*stream);
client->SetNotify(wxSocketBase::REQ_READ | wxSocketBase::REQ_LOST); client->SetNotify(wxSocketBase::REQ_READ | wxSocketBase::REQ_LOST);
addr.Service(server_name); addr.Service(server_name);
@ -107,10 +108,10 @@ wxConnectionBase *wxTCPClient::MakeConnection (const wxString& host,
// Send topic name, and enquire whether this has succeeded // Send topic name, and enquire whether this has succeeded
unsigned char msg; unsigned char msg;
data_s.Write8(IPC_CONNECT); data_os.Write8(IPC_CONNECT);
data_s.WriteString(topic); data_os.WriteString(topic);
msg = data_s.Read8(); msg = data_is.Read8();
// OK! Confirmation. // OK! Confirmation.
if (msg == IPC_CONNECT) { if (msg == IPC_CONNECT) {
@ -183,14 +184,15 @@ wxConnectionBase *wxTCPServer::OnAcceptConnection( const wxString& WXUNUSED(topi
wxTCPConnection::wxTCPConnection (void) wxTCPConnection::wxTCPConnection (void)
: wxConnectionBase(), : wxConnectionBase(),
m_sock(NULL), m_sockstrm(NULL), m_codec(NULL) m_sock(NULL), m_sockstrm(NULL), m_codeci(NULL), m_codeco(NULL)
{ {
} }
wxTCPConnection::~wxTCPConnection (void) wxTCPConnection::~wxTCPConnection (void)
{ {
wxDELETE(m_sock); wxDELETE(m_sock);
wxDELETE(m_codec); wxDELETE(m_codeci);
wxDELETE(m_codeco);
wxDELETE(m_sockstrm); wxDELETE(m_sockstrm);
} }
@ -203,7 +205,7 @@ void wxTCPConnection::Compress(bool WXUNUSED(on))
bool wxTCPConnection::Disconnect (void) bool wxTCPConnection::Disconnect (void)
{ {
// Send the the disconnect message to the peer. // Send the the disconnect message to the peer.
m_codec->Write8(IPC_DISCONNECT); m_codeco->Write8(IPC_DISCONNECT);
m_sock->Close(); m_sock->Close();
return TRUE; return TRUE;
@ -215,13 +217,13 @@ bool wxTCPConnection::Execute (char *data, int size, wxDataFormat format)
return FALSE; return FALSE;
// Prepare EXECUTE message // Prepare EXECUTE message
m_codec->Write8(IPC_EXECUTE); m_codeco->Write8(IPC_EXECUTE);
m_codec->Write8(format); m_codeco->Write8(format);
if (size < 0) if (size < 0)
m_codec->WriteString(data); m_codeco->WriteString(data);
else { else {
m_codec->Write32(size); m_codeco->Write32(size);
m_codec->Write(data, size); m_codeco->Write(data, size);
} }
return TRUE; return TRUE;
@ -232,23 +234,23 @@ char *wxTCPConnection::Request (const wxString& item, int *size, wxDataFormat fo
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return NULL; return NULL;
m_codec->Write8(IPC_REQUEST); m_codeco->Write8(IPC_REQUEST);
m_codec->WriteString(item); m_codeco->WriteString(item);
m_codec->Write8(format); m_codeco->Write8(format);
// If Unpack doesn't initialize it. // If Unpack doesn't initialize it.
int ret; int ret;
ret = m_codec->Read8(); ret = m_codeci->Read8();
if (ret == IPC_FAIL) if (ret == IPC_FAIL)
return NULL; return NULL;
else { else {
size_t s; size_t s;
char *data = NULL; char *data = NULL;
s = m_codec->Read32(); s = m_codeci->Read32();
data = new char[s]; data = new char[s];
m_codec->Read(data, s); m_codeci->Read(data, s);
if (size) if (size)
*size = s; *size = s;
@ -261,14 +263,14 @@ bool wxTCPConnection::Poke (const wxString& item, char *data, int size, wxDataFo
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return FALSE;
m_codec->Write8(IPC_POKE); m_codeco->Write8(IPC_POKE);
m_codec->WriteString(item); m_codeco->WriteString(item);
m_codec->Write8(format); m_codeco->Write8(format);
if (size < 0) if (size < 0)
m_codec->WriteString(data); m_codeco->WriteString(data);
else { else {
m_codec->Write32(size); m_codeco->Write32(size);
m_codec->Write(data, size); m_codeco->Write(data, size);
} }
return TRUE; return TRUE;
@ -281,10 +283,10 @@ bool wxTCPConnection::StartAdvise (const wxString& item)
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return FALSE;
m_codec->Write8(IPC_ADVISE_START); m_codeco->Write8(IPC_ADVISE_START);
m_codec->WriteString(item); m_codeco->WriteString(item);
ret = m_codec->Read8(); ret = m_codeci->Read8();
if (ret != IPC_FAIL) if (ret != IPC_FAIL)
return TRUE; return TRUE;
@ -299,10 +301,10 @@ bool wxTCPConnection::StopAdvise (const wxString& item)
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return FALSE;
m_codec->Write8(IPC_ADVISE_STOP); m_codeco->Write8(IPC_ADVISE_STOP);
m_codec->WriteString(item); m_codeco->WriteString(item);
msg = m_codec->Read8(); msg = m_codeci->Read8();
if (msg != IPC_FAIL) if (msg != IPC_FAIL)
return TRUE; return TRUE;
@ -317,14 +319,14 @@ bool wxTCPConnection::Advise (const wxString& item,
if (!m_sock->IsConnected()) if (!m_sock->IsConnected())
return FALSE; return FALSE;
m_codec->Write8(IPC_ADVISE); m_codeco->Write8(IPC_ADVISE);
m_codec->WriteString(item); m_codeco->WriteString(item);
m_codec->Write8(format); m_codeco->Write8(format);
if (size < 0) if (size < 0)
m_codec->WriteString(data); m_codeco->WriteString(data);
else { else {
m_codec->Write32(size); m_codeco->Write32(size);
m_codec->Write(data, size); m_codeco->Write(data, size);
} }
return TRUE; return TRUE;
@ -335,7 +337,8 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
{ {
int msg = 0; int msg = 0;
wxTCPConnection *connection = (wxTCPConnection *)cdata; wxTCPConnection *connection = (wxTCPConnection *)cdata;
wxDataStream *codec; wxDataInputStream *codeci;
wxDataOutputStream *codeco;
wxString topic_name = connection->m_topic; wxString topic_name = connection->m_topic;
wxString item; wxString item;
@ -347,8 +350,9 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
} }
// Receive message number. // Receive message number.
codec = connection->m_codec; codeci = connection->m_codeci;
msg = codec->Read8(); codeco = connection->m_codeco;
msg = codeci->Read8();
switch (msg) { switch (msg) {
case IPC_EXECUTE: { case IPC_EXECUTE: {
@ -356,10 +360,10 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
size_t size; size_t size;
wxDataFormat format; wxDataFormat format;
format = (wxDataFormat)codec->Read8(); format = (wxDataFormat)codeci->Read8();
size = codec->Read32(); size = codeci->Read32();
data = new char[size]; data = new char[size];
codec->Read(data, size); codeci->Read(data, size);
connection->OnExecute (topic_name, data, size, format); connection->OnExecute (topic_name, data, size, format);
@ -371,11 +375,11 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
size_t size; size_t size;
wxDataFormat format; wxDataFormat format;
item = codec->ReadString(); item = codeci->ReadString();
format = (wxDataFormat)codec->Read8(); format = (wxDataFormat)codeci->Read8();
size = codec->Read32(); size = codeci->Read32();
data = new char[size]; data = new char[size];
codec->Read(data, size); codeci->Read(data, size);
connection->OnAdvise (topic_name, item, data, size, format); connection->OnAdvise (topic_name, item, data, size, format);
@ -383,24 +387,24 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
break; break;
} }
case IPC_ADVISE_START: { case IPC_ADVISE_START: {
item = codec->ReadString(); item = codeci->ReadString();
bool ok = connection->OnStartAdvise (topic_name, item); bool ok = connection->OnStartAdvise (topic_name, item);
if (ok) if (ok)
codec->Write8(IPC_ADVISE_START); codeco->Write8(IPC_ADVISE_START);
else else
codec->Write8(IPC_FAIL); codeco->Write8(IPC_FAIL);
break; break;
} }
case IPC_ADVISE_STOP: { case IPC_ADVISE_STOP: {
item = codec->ReadString(); item = codeci->ReadString();
bool ok = connection->OnStopAdvise (topic_name, item); bool ok = connection->OnStopAdvise (topic_name, item);
if (ok) if (ok)
codec->Write8(IPC_ADVISE_STOP); codeco->Write8(IPC_ADVISE_STOP);
else else
codec->Write8(IPC_FAIL); codeco->Write8(IPC_FAIL);
break; break;
} }
@ -409,11 +413,11 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
size_t size; size_t size;
char *data; char *data;
item = codec->ReadString(); item = codeci->ReadString();
format = (wxDataFormat)codec->Read8(); format = (wxDataFormat)codeci->Read8();
size = codec->Read32(); size = codeci->Read32();
data = new char[size]; data = new char[size];
codec->Read(data, size); codeci->Read(data, size);
connection->OnPoke (topic_name, item, data, size, format); connection->OnPoke (topic_name, item, data, size, format);
@ -424,21 +428,21 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
case IPC_REQUEST: { case IPC_REQUEST: {
wxDataFormat format; wxDataFormat format;
item = codec->ReadString(); item = codeci->ReadString();
format = (wxDataFormat)codec->Read8(); format = (wxDataFormat)codeci->Read8();
int user_size = -1; int user_size = -1;
char *user_data = connection->OnRequest (topic_name, item, &user_size, format); char *user_data = connection->OnRequest (topic_name, item, &user_size, format);
if (user_data) { if (user_data) {
codec->Write8(IPC_REQUEST_REPLY); codeco->Write8(IPC_REQUEST_REPLY);
if (user_size != -1) { if (user_size != -1) {
codec->Write32(user_size); codeco->Write32(user_size);
codec->Write(user_data, user_size); codeco->Write(user_data, user_size);
} else } else
codec->WriteString(user_data); codeco->WriteString(user_data);
} else } else
codec->Write8(IPC_FAIL); codeco->Write8(IPC_FAIL);
break; break;
} }
@ -448,7 +452,7 @@ void Client_OnRequest(wxSocketBase& sock, wxSocketBase::wxRequestEvent evt,
break; break;
} }
default: default:
codec->Write8(IPC_FAIL); codeco->Write8(IPC_FAIL);
break; break;
} }
} }
@ -458,7 +462,8 @@ void Server_OnRequest(wxSocketServer& server,
{ {
wxTCPServer *ipcserv = (wxTCPServer *)cdata; wxTCPServer *ipcserv = (wxTCPServer *)cdata;
wxSocketStream *stream; wxSocketStream *stream;
wxDataStream *codec; wxDataInputStream *codeci;
wxDataOutputStream *codeco;
if (evt != wxSocketBase::EVT_ACCEPT) if (evt != wxSocketBase::EVT_ACCEPT)
return; return;
@ -469,17 +474,18 @@ void Server_OnRequest(wxSocketServer& server,
sock->SetNotify(wxSocketBase::REQ_READ | wxSocketBase::REQ_LOST); sock->SetNotify(wxSocketBase::REQ_READ | wxSocketBase::REQ_LOST);
stream = new wxSocketStream(*sock); stream = new wxSocketStream(*sock);
codec = new wxDataStream(*stream); codeci = new wxDataInputStream(*stream);
codeco = new wxDataOutputStream(*stream);
if (!sock->Ok()) if (!sock->Ok())
return; return;
int msg; int msg;
msg = codec->Read8(); msg = codeci->Read8();
if (msg == IPC_CONNECT) { if (msg == IPC_CONNECT) {
wxString topic_name; wxString topic_name;
topic_name = codec->ReadString(); topic_name = codeci->ReadString();
/* Register new socket with the notifier */ /* Register new socket with the notifier */
wxTCPConnection *new_connection = wxTCPConnection *new_connection =
@ -487,21 +493,22 @@ void Server_OnRequest(wxSocketServer& server,
if (new_connection) { if (new_connection) {
if (!new_connection->IsKindOf(CLASSINFO(wxTCPConnection))) { if (!new_connection->IsKindOf(CLASSINFO(wxTCPConnection))) {
delete new_connection; delete new_connection;
codec->Write8(IPC_FAIL); codeco->Write8(IPC_FAIL);
return; return;
} }
// Acknowledge success // Acknowledge success
codec->Write8(IPC_CONNECT); codeco->Write8(IPC_CONNECT);
new_connection->m_topic = topic_name; new_connection->m_topic = topic_name;
new_connection->m_sockstrm = stream; new_connection->m_sockstrm = stream;
new_connection->m_codec = codec; new_connection->m_codeci = codeci;
new_connection->m_codeco = codeco;
sock->Callback(Client_OnRequest); sock->Callback(Client_OnRequest);
sock->CallbackData((char *)new_connection); sock->CallbackData((char *)new_connection);
sock->Notify(TRUE); sock->Notify(TRUE);
} else { } else {
// Send failure message // Send failure message
codec->Write8(IPC_FAIL); codeco->Write8(IPC_FAIL);
} }
} }
} }

View File

@ -41,7 +41,7 @@ wxSocketOutputStream::~wxSocketOutputStream()
wxOutputStream& wxSocketOutputStream::Write(const void *buffer, size_t size) wxOutputStream& wxSocketOutputStream::Write(const void *buffer, size_t size)
{ {
m_o_socket->Write((const char *)buffer, size); m_lastcount = m_o_socket->Write((const char *)buffer, size).LastCount();
return *this; return *this;
} }
@ -60,19 +60,19 @@ wxSocketInputStream::~wxSocketInputStream()
wxInputStream& wxSocketInputStream::Read(void *buffer, size_t size) wxInputStream& wxSocketInputStream::Read(void *buffer, size_t size)
{ {
m_i_socket->Read((char *)buffer, size); m_lastcount = m_i_socket->Read((char *)buffer, size).LastCount();
return *this; return *this;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxSocketStream (IO) // wxSocketStream
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
wxSocketStream::wxSocketStream(wxSocketBase& i_s, wxSocketBase& o_s)
: wxSocketInputStream(i_s), wxSocketOutputStream(o_s)
{
}
wxSocketStream::wxSocketStream(wxSocketBase& s) wxSocketStream::wxSocketStream(wxSocketBase& s)
: wxSocketInputStream(s), wxSocketOutputStream(s) : wxSocketInputStream(s), wxSocketOutputStream(s)
{ {
} }
wxSocketStream::~wxSocketStream()
{
}

View File

@ -1246,9 +1246,9 @@ bool wxSocketClient::Connect(wxSockAddress& addr_man, bool WXUNUSED(wait) )
return TRUE; return TRUE;
} }
bool wxSocketClient::WaitOnConnect(long seconds) bool wxSocketClient::WaitOnConnect(long seconds, long microseconds)
{ {
int ret = _Wait(seconds, 0, REQ_CONNECT | REQ_LOST); int ret = _Wait(seconds, microseconds, REQ_CONNECT | REQ_LOST);
if (ret) if (ret)
m_connected = TRUE; m_connected = TRUE;

View File

@ -28,15 +28,9 @@
// wxStreamBuffer // wxStreamBuffer
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxStreamBuffer::wxStreamBuffer(wxInputStream& i_stream) wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode)
: m_buffer_start(NULL), m_buffer_end(NULL), m_buffer_pos(NULL), : m_buffer_start(NULL), m_buffer_end(NULL), m_buffer_pos(NULL),
m_buffer_size(0), m_istream(&i_stream), m_ostream(NULL) m_buffer_size(0), m_stream(&stream), m_mode(mode)
{
}
wxStreamBuffer::wxStreamBuffer(wxOutputStream& o_stream)
: m_buffer_start(NULL), m_buffer_end(NULL), m_buffer_pos(NULL),
m_buffer_size(0), m_istream(NULL), m_ostream(&o_stream)
{ {
} }
@ -45,34 +39,37 @@ wxStreamBuffer::~wxStreamBuffer()
wxDELETEA(m_buffer_start); wxDELETEA(m_buffer_start);
} }
void wxStreamBuffer::WriteBack(char c) bool wxStreamBuffer::WriteBack(const char *buf, size_t bufsize)
{ {
if (m_ostream) char *ptrback;
return;
// Assume that if we write "back" we have read a few bytes: so we have some ptrback = AllocSpaceWBack(bufsize);
// space. if (!ptrback)
if (m_buffer_pos == m_buffer_start) return FALSE;
return;
m_buffer_pos--; memcpy(ptrback, buf, bufsize);
*m_buffer_pos = c; return TRUE;
}
bool wxStreamBuffer::WriteBack(char c)
{
char *ptrback;
ptrback = AllocSpaceWBack(1);
if (!ptrback)
return FALSE;
*ptrback = c;
return TRUE;
} }
void wxStreamBuffer::SetBufferIO(char *buffer_start, char *buffer_end) void wxStreamBuffer::SetBufferIO(char *buffer_start, char *buffer_end)
{ {
size_t ret;
m_buffer_start = buffer_start; m_buffer_start = buffer_start;
m_buffer_end = buffer_end; m_buffer_end = buffer_end;
m_buffer_size = m_buffer_end-m_buffer_start; m_buffer_size = m_buffer_end-m_buffer_start;
ResetBuffer();
if (m_istream) {
ret = m_istream->DoRead(m_buffer_start, m_buffer_size);
m_buffer_end = m_buffer_start + ret;
}
m_buffer_pos = m_buffer_start;
} }
void wxStreamBuffer::SetBufferIO(size_t bufsize) void wxStreamBuffer::SetBufferIO(size_t bufsize)
@ -96,22 +93,121 @@ void wxStreamBuffer::SetBufferIO(size_t bufsize)
void wxStreamBuffer::ResetBuffer() void wxStreamBuffer::ResetBuffer()
{ {
if (m_istream) if (m_mode == read)
m_buffer_pos = m_buffer_end; m_buffer_pos = m_buffer_end;
else else
m_buffer_pos = m_buffer_start; m_buffer_pos = m_buffer_start;
} }
char *wxStreamBuffer::AllocSpaceWBack(size_t needed_size)
{
char *temp_b;
m_wbacksize += needed_size;
if (!m_wback)
temp_b = (char *)malloc(m_wbacksize);
else
temp_b = (char *)realloc(m_wback, m_wbacksize);
if (!temp_b)
return NULL;
return (char *)((size_t)m_wback+(m_wbacksize-needed_size));
}
size_t wxStreamBuffer::GetWBack(char *buf, size_t bsize)
{
size_t s_toget = m_wbacksize-m_wbackcur;
if (bsize < s_toget)
s_toget = bsize;
memcpy(buf, (m_wback+m_wbackcur), s_toget);
m_wbackcur += s_toget;
if (m_wbackcur == m_wbacksize) {
free(m_wback);
m_wback = (char *)NULL;
m_wbacksize = 0;
m_wbackcur = 0;
}
return s_toget;
}
bool wxStreamBuffer::FillBuffer()
{
size_t count;
count = m_stream->OnSysRead(m_buffer_start, m_buffer_size);
m_buffer_end = m_buffer_start+count;
m_buffer_pos = m_buffer_start;
if (count == 0)
return FALSE;
return TRUE;
}
bool wxStreamBuffer::FlushBuffer()
{
size_t count, current;
if (m_buffer_pos == m_buffer_start)
return FALSE;
current = m_buffer_pos-m_buffer_start;
count = m_stream->OnSysWrite(m_buffer_start, current);
if (count != current)
return FALSE;
m_buffer_pos = m_buffer_start;
return TRUE;
}
void wxStreamBuffer::GetFromBuffer(void *buffer, size_t size)
{
size_t s_toget = m_buffer_end-m_buffer_pos;
if (size < s_toget)
s_toget = size;
memcpy(buffer, m_buffer_pos, s_toget);
m_buffer_pos += s_toget;
}
void wxStreamBuffer::PutToBuffer(const void *buffer, size_t size)
{
size_t s_toput = m_buffer_end-m_buffer_pos;
if (s_toput < size && !m_fixed) {
m_buffer_start = (char *)realloc(m_buffer_start, m_buffer_size+size);
// I round a bit
m_buffer_end = m_buffer_start+m_buffer_size;
s_toput = size;
}
if (s_toput > size)
s_toput = size;
memcpy(m_buffer_pos, buffer, s_toput);
m_buffer_pos += s_toput;
}
void wxStreamBuffer::Read(void *buffer, size_t size) void wxStreamBuffer::Read(void *buffer, size_t size)
{ {
wxASSERT(m_istream != NULL); wxASSERT(m_stream != NULL);
// ------------------ // ------------------
// Buffering disabled // Buffering disabled
// ------------------ // ------------------
m_stream->m_lastcount = GetWBack((char *)buffer, size);
size -= m_stream->m_lastcount;
if (size == 0)
return;
buffer = (void *)((char *)buffer+m_stream->m_lastcount);
if (!m_buffer_size) { if (!m_buffer_size) {
m_istream->m_lastread = m_istream->DoRead(buffer, size); m_stream->m_lastcount += m_stream->OnSysRead(buffer, size);
return; return;
} }
@ -119,51 +215,41 @@ void wxStreamBuffer::Read(void *buffer, size_t size)
// Buffering enabled // Buffering enabled
// ----------------- // -----------------
size_t buf_left, orig_size = size; size_t buf_left, orig_size = size;
size_t read_ret;
while (size > 0) { while (size > 0) {
buf_left = m_buffer_end - m_buffer_pos; buf_left = GetDataLeft();
// First case: the requested buffer is larger than the stream buffer, // First case: the requested buffer is larger than the stream buffer,
// we split // we split
if (size > buf_left) { if (size > buf_left) {
memcpy(buffer, m_buffer_pos, buf_left); GetFromBuffer(buffer, buf_left);
size -= buf_left; size -= buf_left;
buffer = (char *)buffer + buf_left; // ANSI C++ violation. buffer = (char *)buffer + buf_left; // ANSI C++ violation.
read_ret = m_istream->DoRead(m_buffer_start, m_buffer_size); if (!FillBuffer()) {
m_stream->m_lastcount = orig_size-size;
// Read failed: EOF
if (read_ret == 0) {
m_istream->m_lastread = orig_size-size;
m_istream->m_eof = TRUE;
m_buffer_pos = m_buffer_end = m_buffer_start;
return; return;
} else {
m_buffer_end = m_buffer_start+read_ret;
m_buffer_pos = m_buffer_start;
} }
} else { } else {
// Second case: we just copy from the stream buffer. // Second case: we just copy from the stream buffer.
memcpy(buffer, m_buffer_pos, size); GetFromBuffer(buffer, size);
m_buffer_pos += size;
break; break;
} }
} }
m_istream->m_lastread = orig_size; m_stream->m_lastcount += orig_size;
} }
void wxStreamBuffer::Write(const void *buffer, size_t size) void wxStreamBuffer::Write(const void *buffer, size_t size)
{ {
wxASSERT(m_ostream != NULL); wxASSERT(m_stream != NULL);
// ------------------ // ------------------
// Buffering disabled // Buffering disabled
// ------------------ // ------------------
if (!m_buffer_size) { if (!m_buffer_size) {
m_ostream->m_lastwrite = m_ostream->DoWrite(buffer, size); m_stream->m_lastcount = m_stream->OnSysWrite(buffer, size);
return; return;
} }
@ -172,7 +258,6 @@ void wxStreamBuffer::Write(const void *buffer, size_t size)
// ------------------ // ------------------
size_t buf_left, orig_size = size; size_t buf_left, orig_size = size;
size_t write_ret;
while (size > 0) { while (size > 0) {
buf_left = m_buffer_end - m_buffer_pos; buf_left = m_buffer_end - m_buffer_pos;
@ -180,15 +265,12 @@ void wxStreamBuffer::Write(const void *buffer, size_t size)
// First case: the buffer to write is larger than the stream buffer, // First case: the buffer to write is larger than the stream buffer,
// we split it // we split it
if (size > buf_left) { if (size > buf_left) {
memcpy(m_buffer_pos, buffer, buf_left); PutToBuffer(buffer, buf_left);
size -= buf_left; size -= buf_left;
buffer = (char *)buffer + buf_left; // ANSI C++ violation. buffer = (char *)buffer + buf_left; // ANSI C++ violation.
write_ret = m_ostream->DoWrite(m_buffer_start, m_buffer_size); if (!FlushBuffer()) {
if (write_ret != m_buffer_size) { m_stream->m_lastcount = orig_size-size;
m_ostream->m_bad = TRUE;
m_ostream->m_lastwrite = orig_size-size;
m_buffer_pos = m_buffer_end = m_buffer_start;
return; return;
} }
m_buffer_pos = m_buffer_start; m_buffer_pos = m_buffer_start;
@ -196,13 +278,95 @@ void wxStreamBuffer::Write(const void *buffer, size_t size)
} else { } else {
// Second case: just copy it in the stream buffer. // Second case: just copy it in the stream buffer.
PutToBuffer(buffer, size);
memcpy(m_buffer_pos, buffer, size);
m_buffer_pos += size;
break; break;
} }
} }
m_ostream->m_lastwrite = orig_size; m_stream->m_lastcount = orig_size;
}
off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
{
off_t ret_off, diff, last_access;
last_access = GetLastAccess();
switch (mode) {
case wxFromStart: {
// We'll try to compute an internal position later ...
ret_off = m_stream->OnSysSeek(pos, wxFromStart);
ResetBuffer();
return ret_off;
}
case wxFromCurrent: {
diff = pos + GetIntPosition();
if ( (diff > last_access) || (diff < 0) ) {
ret_off = m_stream->OnSysSeek(pos, wxFromCurrent);
ResetBuffer();
return ret_off;
} else {
SetIntPosition(diff);
return pos;
}
}
case wxFromEnd:
// Hard to compute: always seek to the requested position.
ret_off = m_stream->OnSysSeek(pos, wxFromEnd);
ResetBuffer();
return ret_off;
}
return wxInvalidOffset;
}
off_t wxStreamBuffer::Tell() const
{
off_t pos;
pos = m_stream->OnSysTell();
if (pos == wxInvalidOffset)
return wxInvalidOffset;
return pos - GetLastAccess() + GetIntPosition();
}
size_t wxStreamBuffer::GetDataLeft() const
{
return m_buffer_end-m_buffer_pos;
}
// ----------------------------------------------------------------------------
// wxStreamBase
// ----------------------------------------------------------------------------
wxStreamBase::wxStreamBase()
{
m_lasterror = wxStream_NOERROR;
m_lastcount = 0;
}
wxStreamBase::~wxStreamBase()
{
}
size_t wxStreamBase::OnSysRead(void *buffer, size_t size)
{
return 0;
}
size_t wxStreamBase::OnSysWrite(const void *buffer, size_t bufsize)
{
return 0;
}
off_t wxStreamBase::OnSysSeek(off_t seek, wxSeekMode mode)
{
return wxInvalidOffset;
}
off_t wxStreamBase::OnSysTell()
{
return wxInvalidOffset;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -210,19 +374,17 @@ void wxStreamBuffer::Write(const void *buffer, size_t size)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxInputStream::wxInputStream() wxInputStream::wxInputStream()
: wxStreamBase()
{ {
m_i_destroybuf = TRUE; m_i_destroybuf = TRUE;
m_i_streambuf = new wxStreamBuffer(*this); m_i_streambuf = new wxStreamBuffer(*this, wxStreamBuffer::read);
m_eof = FALSE;
m_lastread = 0;
} }
wxInputStream::wxInputStream(wxStreamBuffer *buffer) wxInputStream::wxInputStream(wxStreamBuffer *buffer)
: wxStreamBase()
{ {
m_i_destroybuf = FALSE; m_i_destroybuf = FALSE;
m_i_streambuf = buffer; m_i_streambuf = buffer;
m_eof = FALSE;
m_lastread = 0;
} }
wxInputStream::~wxInputStream() wxInputStream::~wxInputStream()
@ -245,6 +407,14 @@ wxInputStream& wxInputStream::Read(void *buffer, size_t size)
return *this; return *this;
} }
char wxInputStream::Peek()
{
if (!m_i_streambuf->GetDataLeft())
m_i_streambuf->FillBuffer();
return *(m_i_streambuf->GetBufferPos());
}
#define BUF_TEMP_SIZE 10000 #define BUF_TEMP_SIZE 10000
wxInputStream& wxInputStream::Read(wxOutputStream& stream_out) wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
@ -252,7 +422,7 @@ wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
char buf[BUF_TEMP_SIZE]; char buf[BUF_TEMP_SIZE];
size_t bytes_read = BUF_TEMP_SIZE; size_t bytes_read = BUF_TEMP_SIZE;
while (bytes_read == BUF_TEMP_SIZE && !stream_out.Bad()) { while (bytes_read == BUF_TEMP_SIZE && stream_out.LastError() != wxStream_NOERROR) {
bytes_read = Read(buf, bytes_read).LastRead(); bytes_read = Read(buf, bytes_read).LastRead();
stream_out.Write(buf, bytes_read); stream_out.Write(buf, bytes_read);
@ -260,6 +430,20 @@ wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
return *this; return *this;
} }
off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
{
return m_i_streambuf->Seek(pos, mode);
}
off_t wxInputStream::TellI() const
{
return m_i_streambuf->Tell();
}
// --------------------
// Overloaded operators
// --------------------
wxInputStream& wxInputStream::operator>>(wxString& line) wxInputStream& wxInputStream::operator>>(wxString& line)
{ {
wxDataInputStream s(*this); wxDataInputStream s(*this);
@ -322,7 +506,7 @@ wxInputStream& wxInputStream::operator>>(long& i)
return *this; return *this;
} }
wxInputStream& wxInputStream::operator>>(float& f) wxInputStream& wxInputStream::operator>>(double& f)
{ {
/* I only implemented a simple float parser */ /* I only implemented a simple float parser */
int c, sign; int c, sign;
@ -343,16 +527,16 @@ wxInputStream& wxInputStream::operator>>(float& f)
sign = 1; sign = 1;
while (isdigit(c)) { while (isdigit(c)) {
f = f*10 + c; f = f*10 + (c - '0');
c = GetC(); c = GetC();
} }
if (c == '.') { if (c == '.') {
float f_multiplicator = (float) 0.1; double f_multiplicator = (double) 0.1;
c = GetC(); c = GetC();
while (isdigit(c)) { while (isdigit(c)) {
f += c*f_multiplicator; f += (c-'0')*f_multiplicator;
f_multiplicator /= 10; f_multiplicator /= 10;
c = GetC(); c = GetC();
} }
@ -372,66 +556,22 @@ wxInputStream& wxInputStream::operator>>(wxObject *& obj)
} }
#endif #endif
off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
{
off_t ret_off, diff, last_access;
last_access = m_i_streambuf->GetLastAccess();
switch (mode) {
case wxFromStart:
diff = DoTellInput() - pos;
if ( diff < 0 || diff > last_access ) {
ret_off = DoSeekInput(pos, wxFromStart);
m_i_streambuf->ResetBuffer();
return ret_off;
} else {
m_i_streambuf->SetIntPosition(last_access - diff);
return pos;
}
case wxFromCurrent:
diff = pos + m_i_streambuf->GetIntPosition();
if ( (diff > last_access) || (diff < 0) ) {
ret_off = DoSeekInput(pos, wxFromCurrent);
m_i_streambuf->ResetBuffer();
return ret_off;
} else {
m_i_streambuf->SetIntPosition(diff);
return pos;
}
case wxFromEnd:
// Hard to compute: always seek to the requested position.
ret_off = DoSeekInput(pos, wxFromEnd);
m_i_streambuf->ResetBuffer();
return ret_off;
}
return wxInvalidOffset;
}
off_t wxInputStream::TellI() const
{
return DoTellInput() - m_i_streambuf->GetLastAccess() +
m_i_streambuf->GetIntPosition();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxOutputStream // wxOutputStream
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxOutputStream::wxOutputStream() wxOutputStream::wxOutputStream()
: wxStreamBase()
{ {
m_o_destroybuf = TRUE; m_o_destroybuf = TRUE;
m_o_streambuf = new wxStreamBuffer(*this); m_o_streambuf = new wxStreamBuffer(*this, wxStreamBuffer::write);
m_bad = FALSE;
m_lastwrite = 0;
} }
wxOutputStream::wxOutputStream(wxStreamBuffer *buffer) wxOutputStream::wxOutputStream(wxStreamBuffer *buffer)
: wxStreamBase()
{ {
m_o_destroybuf = FALSE; m_o_destroybuf = FALSE;
m_o_streambuf = buffer; m_o_streambuf = buffer;
m_bad = FALSE;
m_lastwrite = 0;
} }
wxOutputStream::~wxOutputStream() wxOutputStream::~wxOutputStream()
@ -452,49 +592,19 @@ wxOutputStream& wxOutputStream::Write(wxInputStream& stream_in)
return *this; return *this;
} }
off_t wxOutputStream::SeekO(off_t pos, wxSeekMode mode)
{
off_t ret_off;
switch (mode) {
case wxFromStart:
if ( (unsigned)abs (DoTellOutput()-pos) > m_o_streambuf->GetLastAccess() ) {
ret_off = DoSeekOutput(pos, wxFromStart);
m_o_streambuf->ResetBuffer();
return ret_off;
} else {
m_o_streambuf->SetIntPosition( DoTellOutput() - pos);
return pos;
}
case wxFromCurrent:
if ( ((unsigned)pos > m_o_streambuf->GetLastAccess()) || (pos < 0) ) {
ret_off = DoSeekOutput(pos, wxFromCurrent);
m_o_streambuf->ResetBuffer();
return ret_off;
} else {
m_o_streambuf->SetIntPosition(pos);
return pos;
}
case wxFromEnd:
// Hard to compute: always seek to the requested position.
ret_off = DoSeekOutput(pos, wxFromEnd);
m_o_streambuf->ResetBuffer();
return ret_off;
}
return wxInvalidOffset;
}
off_t wxOutputStream::TellO() const off_t wxOutputStream::TellO() const
{ {
return DoTellOutput() - m_o_streambuf->GetLastAccess() return m_o_streambuf->Tell();
+ m_o_streambuf->GetIntPosition(); }
off_t wxOutputStream::SeekO(off_t pos, wxSeekMode mode)
{
return m_o_streambuf->Seek(pos, mode);
} }
void wxOutputStream::Sync() void wxOutputStream::Sync()
{ {
DoWrite(m_o_streambuf->GetBufferStart(), m_o_streambuf->GetIntPosition()); m_o_streambuf->FlushBuffer();
m_o_streambuf->ResetBuffer();
} }
wxOutputStream& wxOutputStream::operator<<(const char *string) wxOutputStream& wxOutputStream::operator<<(const char *string)
@ -553,51 +663,25 @@ wxOutputStream& wxOutputStream::operator<<(wxObject& obj)
} }
#endif #endif
// ----------------------------------------------------------------------------
// wxStream
// ----------------------------------------------------------------------------
wxStream::wxStream()
: wxInputStream(), wxOutputStream()
{
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxFilterInputStream // wxFilterInputStream
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxFilterInputStream::wxFilterInputStream() wxFilterInputStream::wxFilterInputStream()
: wxInputStream(NULL) : wxInputStream(NULL)
{ {
// WARNING streambuf set to NULL !
} }
wxFilterInputStream::wxFilterInputStream(wxInputStream& stream) wxFilterInputStream::wxFilterInputStream(wxInputStream& stream)
: wxInputStream(NULL) : wxInputStream(stream.InputStreamBuffer())
{ {
m_parent_i_stream = &stream; m_parent_i_stream = &stream;
wxDELETE(m_i_streambuf); // In case m_i_streambuf has been initialized.
m_i_destroybuf = FALSE;
m_i_streambuf = stream.InputStreamBuffer();
} }
wxFilterInputStream::~wxFilterInputStream() wxFilterInputStream::~wxFilterInputStream()
{ {
} }
size_t wxFilterInputStream::DoRead(void *buffer, size_t size)
{
return m_parent_i_stream->Read(buffer, size).LastRead();
}
off_t wxFilterInputStream::DoSeekInput(off_t pos, wxSeekMode mode)
{
return m_parent_i_stream->SeekI(pos, mode);
}
off_t wxFilterInputStream::DoTellInput() const
{
return m_parent_i_stream->TellI();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxFilterOutputStream // wxFilterOutputStream
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -607,46 +691,15 @@ wxFilterOutputStream::wxFilterOutputStream()
} }
wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream) wxFilterOutputStream::wxFilterOutputStream(wxOutputStream& stream)
: wxOutputStream(NULL) : wxOutputStream(stream.OutputStreamBuffer())
{ {
m_parent_o_stream = &stream; m_parent_o_stream = &stream;
wxDELETE(m_o_streambuf); // In case m_o_streambuf has been initialized.
m_o_destroybuf = FALSE;
m_o_streambuf = stream.OutputStreamBuffer();
} }
wxFilterOutputStream::~wxFilterOutputStream() wxFilterOutputStream::~wxFilterOutputStream()
{ {
} }
size_t wxFilterOutputStream::DoWrite(const void *buffer, size_t size)
{
return m_parent_o_stream->Write(buffer, size).LastWrite();
}
off_t wxFilterOutputStream::DoSeekOutput(off_t pos, wxSeekMode mode)
{
return m_parent_o_stream->SeekO(pos, mode);
}
off_t wxFilterOutputStream::DoTellOutput() const
{
return m_parent_o_stream->TellO();
}
// ----------------------------------------------------------------------------
// wxFilterStream
// ----------------------------------------------------------------------------
wxFilterStream::wxFilterStream()
{
}
wxFilterStream::wxFilterStream(wxStream& stream)
: wxFilterInputStream(stream), wxFilterOutputStream(stream)
{
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Some IOManip function // Some IOManip function
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -29,6 +29,7 @@
# endif # endif
#endif #endif
#include "wx/stream.h"
#include "wx/string.h" #include "wx/string.h"
#include "wx/variant.h" #include "wx/variant.h"
@ -294,7 +295,9 @@ public:
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Write(wxOutputStream &str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual wxString GetType() const { return "long"; }; virtual wxString GetType() const { return "long"; };
@ -330,6 +333,12 @@ bool wxVariantDataLong::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataLong::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataLong::Write(wxString& str) const bool wxVariantDataLong::Write(wxString& str) const
{ {
str.Printf("%ld", m_value); str.Printf("%ld", m_value);
@ -342,6 +351,12 @@ bool wxVariantDataLong::Read(istream& str)
return TRUE; return TRUE;
} }
bool wxVariantDataLong::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataLong::Read(wxString& str) bool wxVariantDataLong::Read(wxString& str)
{ {
m_value = atol((const char*) str); m_value = atol((const char*) str);
@ -366,7 +381,9 @@ public:
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Write(wxOutputStream &str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual wxString GetType() const { return "double"; }; virtual wxString GetType() const { return "double"; };
@ -402,6 +419,12 @@ bool wxVariantDataReal::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataReal::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataReal::Write(wxString& str) const bool wxVariantDataReal::Write(wxString& str) const
{ {
str.Printf("%.4f", m_value); str.Printf("%.4f", m_value);
@ -414,6 +437,12 @@ bool wxVariantDataReal::Read(istream& str)
return TRUE; return TRUE;
} }
bool wxVariantDataReal::Read(wxInputStream& str)
{
str >> (float&)m_value;
return TRUE;
}
bool wxVariantDataReal::Read(wxString& str) bool wxVariantDataReal::Read(wxString& str)
{ {
m_value = atof((const char*) str); m_value = atof((const char*) str);
@ -437,8 +466,10 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxOutputStream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual wxString GetType() const { return "bool"; }; virtual wxString GetType() const { return "bool"; };
@ -474,6 +505,12 @@ bool wxVariantDataBool::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataBool::Write(wxOutputStream& str) const
{
str << (char)m_value;
return TRUE;
}
bool wxVariantDataBool::Write(wxString& str) const bool wxVariantDataBool::Write(wxString& str) const
{ {
str.Printf("%d", (int) m_value); str.Printf("%d", (int) m_value);
@ -487,6 +524,12 @@ bool wxVariantDataBool::Read(istream& WXUNUSED(str))
return FALSE; return FALSE;
} }
bool wxVariantDataBool::Read(wxInputStream& str)
{
str >> (char&)m_value;
return TRUE;
}
bool wxVariantDataBool::Read(wxString& str) bool wxVariantDataBool::Read(wxString& str)
{ {
m_value = (atol((const char*) str) != 0); m_value = (atol((const char*) str) != 0);
@ -510,8 +553,10 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxOutputStream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual wxString GetType() const { return "char"; }; virtual wxString GetType() const { return "char"; };
@ -547,6 +592,12 @@ bool wxVariantDataChar::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataChar::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataChar::Write(wxString& str) const bool wxVariantDataChar::Write(wxString& str) const
{ {
str.Printf("%c", m_value); str.Printf("%c", m_value);
@ -560,6 +611,12 @@ bool wxVariantDataChar::Read(istream& WXUNUSED(str))
return FALSE; return FALSE;
} }
bool wxVariantDataChar::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataChar::Read(wxString& str) bool wxVariantDataChar::Read(wxString& str)
{ {
m_value = str[(size_t)0]; m_value = str[(size_t)0];
@ -583,8 +640,10 @@ public:
virtual void Copy(wxVariantData& data); virtual void Copy(wxVariantData& data);
virtual bool Eq(wxVariantData& data) const; virtual bool Eq(wxVariantData& data) const;
virtual bool Write(ostream& str) const; virtual bool Write(ostream& str) const;
virtual bool Write(wxOutputStream& str) const;
virtual bool Write(wxString& str) const; virtual bool Write(wxString& str) const;
virtual bool Read(istream& str); virtual bool Read(istream& str);
virtual bool Read(wxInputStream& str);
virtual bool Read(wxString& str); virtual bool Read(wxString& str);
virtual wxString GetType() const { return "string"; }; virtual wxString GetType() const { return "string"; };
@ -616,6 +675,12 @@ bool wxVariantDataString::Write(ostream& str) const
return TRUE; return TRUE;
} }
bool wxVariantDataString::Write(wxOutputStream& str) const
{
str << m_value;
return TRUE;
}
bool wxVariantDataString::Write(wxString& str) const bool wxVariantDataString::Write(wxString& str) const
{ {
str = m_value; str = m_value;
@ -628,6 +693,12 @@ bool wxVariantDataString::Read(istream& str)
return TRUE; return TRUE;
} }
bool wxVariantDataString::Read(wxInputStream& str)
{
str >> m_value;
return TRUE;
}
bool wxVariantDataString::Read(wxString& str) bool wxVariantDataString::Read(wxString& str)
{ {
m_value = str; m_value = str;

View File

@ -36,7 +36,7 @@ wxZlibInputStream::wxZlibInputStream(wxInputStream& stream)
int err; int err;
// I need a private stream buffer. // I need a private stream buffer.
m_i_streambuf = new wxStreamBuffer(*this); m_i_streambuf = new wxStreamBuffer(*this, wxStreamBuffer::read);
m_i_destroybuf = TRUE; m_i_destroybuf = TRUE;
m_inflate = new z_stream_s; m_inflate = new z_stream_s;
@ -64,7 +64,7 @@ wxZlibInputStream::~wxZlibInputStream()
delete m_inflate; delete m_inflate;
} }
size_t wxZlibInputStream::DoRead(void *buffer, size_t size) size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
{ {
int err; int err;
@ -78,7 +78,7 @@ size_t wxZlibInputStream::DoRead(void *buffer, size_t size)
m_inflate->next_in = m_z_buffer; m_inflate->next_in = m_z_buffer;
m_inflate->avail_in = m_parent_i_stream->LastRead(); m_inflate->avail_in = m_parent_i_stream->LastRead();
if (m_parent_i_stream->Eof()) if (m_parent_i_stream->LastError() != wxStream_NOERROR)
return (size - m_inflate->avail_in); return (size - m_inflate->avail_in);
} }
err = inflate(m_inflate, Z_FINISH); err = inflate(m_inflate, Z_FINISH);
@ -89,13 +89,6 @@ size_t wxZlibInputStream::DoRead(void *buffer, size_t size)
return size-m_inflate->avail_in; return size-m_inflate->avail_in;
} }
bool wxZlibInputStream::Eof() const
{
if (!m_eof)
return m_parent_i_stream->Eof();
return m_eof;
}
////////////////////// //////////////////////
// wxZlibOutputStream // wxZlibOutputStream
////////////////////// //////////////////////
@ -105,7 +98,7 @@ wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
{ {
int err; int err;
m_o_streambuf = new wxStreamBuffer(*this); m_o_streambuf = new wxStreamBuffer(*this, wxStreamBuffer::write);
m_o_destroybuf = TRUE; m_o_destroybuf = TRUE;
m_deflate = new z_stream_s; m_deflate = new z_stream_s;
@ -155,7 +148,6 @@ void wxZlibOutputStream::Sync()
err = deflate(m_deflate, Z_FULL_FLUSH); err = deflate(m_deflate, Z_FULL_FLUSH);
if (err != Z_OK) { if (err != Z_OK) {
m_bad = TRUE;
return; return;
} }
@ -164,7 +156,7 @@ void wxZlibOutputStream::Sync()
m_deflate->avail_out = m_z_size; m_deflate->avail_out = m_z_size;
} }
size_t wxZlibOutputStream::DoWrite(const void *buffer, size_t size) size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size)
{ {
int err; int err;
@ -175,7 +167,7 @@ size_t wxZlibOutputStream::DoWrite(const void *buffer, size_t size)
if (m_deflate->avail_out == 0) { if (m_deflate->avail_out == 0) {
m_parent_o_stream->Write(m_z_buffer, m_z_size); m_parent_o_stream->Write(m_z_buffer, m_z_size);
if (m_parent_o_stream->Bad()) if (m_parent_o_stream->LastError() != wxStream_NOERROR)
return (size - m_deflate->avail_in); return (size - m_deflate->avail_in);
m_deflate->next_out = m_z_buffer; m_deflate->next_out = m_z_buffer;
@ -188,10 +180,3 @@ size_t wxZlibOutputStream::DoWrite(const void *buffer, size_t size)
} }
return size; return size;
} }
bool wxZlibOutputStream::Bad() const
{
if (!m_bad)
return m_parent_o_stream->Bad();
return m_bad;
}

View File

@ -300,19 +300,31 @@ void wxComboBox::SetValue( const wxString& value )
void wxComboBox::Copy(void) void wxComboBox::Copy(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
#else
gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
#endif
} }
void wxComboBox::Cut(void) void wxComboBox::Cut(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
#else
gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
#endif
} }
void wxComboBox::Paste(void) void wxComboBox::Paste(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
#else
gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
#endif
} }
void wxComboBox::SetInsertionPoint( long pos ) void wxComboBox::SetInsertionPoint( long pos )

View File

@ -300,17 +300,29 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
void wxTextCtrl::Cut() void wxTextCtrl::Cut()
{ {
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
} }
void wxTextCtrl::Copy() void wxTextCtrl::Copy()
{ {
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
} }
void wxTextCtrl::Paste() void wxTextCtrl::Paste()
{ {
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
} }
void wxTextCtrl::Clear() void wxTextCtrl::Clear()

View File

@ -21,7 +21,6 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Static variables // Static variables
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -63,3 +62,29 @@ static void wxThreadGuiExit()
close(p_thrd_pipe[0]); close(p_thrd_pipe[0]);
close(p_thrd_pipe[1]); close(p_thrd_pipe[1]);
} }
#ifdef NO_DEFINE_GDK_1_1
void wxMutexGuiEnter()
{
gdk_mutex_enter();
}
void wxMutexGuiLeave()
{
gdk_mutex_leave();
}
#else
void wxMutexGuiEnter()
{
wxMainMutex.Lock();
}
void wxMutexGuiLeave()
{
wxMainMutex.Unlock();
}
#endif

View File

@ -9,6 +9,7 @@
/////////////////////////////////////////////////////////////////////////// */ /////////////////////////////////////////////////////////////////////////// */
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include <gtk/gtkfeatures.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -34,6 +35,9 @@ static void gtk_myfixed_add (GtkContainer *container,
static void gtk_myfixed_remove (GtkContainer *container, static void gtk_myfixed_remove (GtkContainer *container,
GtkWidget *widget); GtkWidget *widget);
static void gtk_myfixed_foreach (GtkContainer *container, static void gtk_myfixed_foreach (GtkContainer *container,
#if (GTK_MINOR_VERSION == 1)
gboolean include_internals,
#endif
GtkCallback callback, GtkCallback callback,
gpointer callback_data); gpointer callback_data);
@ -88,7 +92,11 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
container_class->add = gtk_myfixed_add; container_class->add = gtk_myfixed_add;
container_class->remove = gtk_myfixed_remove; container_class->remove = gtk_myfixed_remove;
#if (GTK_MINOR_VERSION == 1)
container_class->forall = gtk_myfixed_foreach;
#else
container_class->foreach = gtk_myfixed_foreach; container_class->foreach = gtk_myfixed_foreach;
#endif
} }
static void static void
@ -454,6 +462,9 @@ gtk_myfixed_remove (GtkContainer *container,
static void static void
gtk_myfixed_foreach (GtkContainer *container, gtk_myfixed_foreach (GtkContainer *container,
#if (GTK_MINOR_VERSION == 1)
gboolean include_internals,
#endif
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {

View File

@ -300,19 +300,31 @@ void wxComboBox::SetValue( const wxString& value )
void wxComboBox::Copy(void) void wxComboBox::Copy(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(entry) );
#else
gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
#endif
} }
void wxComboBox::Cut(void) void wxComboBox::Cut(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(entry) );
#else
gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
#endif
} }
void wxComboBox::Paste(void) void wxComboBox::Paste(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(entry) );
#else
gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
#endif
} }
void wxComboBox::SetInsertionPoint( long pos ) void wxComboBox::SetInsertionPoint( long pos )

View File

@ -300,17 +300,29 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
void wxTextCtrl::Cut() void wxTextCtrl::Cut()
{ {
#if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
} }
void wxTextCtrl::Copy() void wxTextCtrl::Copy()
{ {
#if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
} }
void wxTextCtrl::Paste() void wxTextCtrl::Paste()
{ {
#if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
} }
void wxTextCtrl::Clear() void wxTextCtrl::Clear()

View File

@ -21,7 +21,6 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Static variables // Static variables
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -63,3 +62,29 @@ static void wxThreadGuiExit()
close(p_thrd_pipe[0]); close(p_thrd_pipe[0]);
close(p_thrd_pipe[1]); close(p_thrd_pipe[1]);
} }
#ifdef NO_DEFINE_GDK_1_1
void wxMutexGuiEnter()
{
gdk_mutex_enter();
}
void wxMutexGuiLeave()
{
gdk_mutex_leave();
}
#else
void wxMutexGuiEnter()
{
wxMainMutex.Lock();
}
void wxMutexGuiLeave()
{
wxMainMutex.Unlock();
}
#endif

View File

@ -9,6 +9,7 @@
/////////////////////////////////////////////////////////////////////////// */ /////////////////////////////////////////////////////////////////////////// */
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include <gtk/gtkfeatures.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -34,6 +35,9 @@ static void gtk_myfixed_add (GtkContainer *container,
static void gtk_myfixed_remove (GtkContainer *container, static void gtk_myfixed_remove (GtkContainer *container,
GtkWidget *widget); GtkWidget *widget);
static void gtk_myfixed_foreach (GtkContainer *container, static void gtk_myfixed_foreach (GtkContainer *container,
#if (GTK_MINOR_VERSION == 1)
gboolean include_internals,
#endif
GtkCallback callback, GtkCallback callback,
gpointer callback_data); gpointer callback_data);
@ -88,7 +92,11 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
container_class->add = gtk_myfixed_add; container_class->add = gtk_myfixed_add;
container_class->remove = gtk_myfixed_remove; container_class->remove = gtk_myfixed_remove;
#if (GTK_MINOR_VERSION == 1)
container_class->forall = gtk_myfixed_foreach;
#else
container_class->foreach = gtk_myfixed_foreach; container_class->foreach = gtk_myfixed_foreach;
#endif
} }
static void static void
@ -454,6 +462,9 @@ gtk_myfixed_remove (GtkContainer *container,
static void static void
gtk_myfixed_foreach (GtkContainer *container, gtk_myfixed_foreach (GtkContainer *container,
#if (GTK_MINOR_VERSION == 1)
gboolean include_internals,
#endif
GtkCallback callback, GtkCallback callback,
gpointer callback_data) gpointer callback_data)
{ {

View File

@ -21,9 +21,10 @@
WXDIR = $(WXWIN) WXDIR = $(WXWIN)
# Set all these to 1 if you want to build a dynamic library # Set all these to 1 if you want to build a dynamic library
#DLL=1 !if "$(DLL)" == "1"
#WXMAKINGDLL=1 WXMAKINGDLL=1
#WXBUILDDLL=1 WXBUILDDLL=1
!endif
!include $(WXDIR)\src\makeb32.env !include $(WXDIR)\src\makeb32.env

View File

@ -12,9 +12,10 @@
WXDIR = $(WXWIN) WXDIR = $(WXWIN)
DLL=1 !if "$(DLL)" == "1"
WXBUILDDLL=1 WXBUILDDLL=1
WXUSINGDLL=1 WXUSINGDLL=1
!endif
!include $(WXDIR)\src\makeb32.env !include $(WXDIR)\src\makeb32.env