fi
+IODBC_C_SRC=""
if test "$wxUSE_ODBC" = 1 ; then
cat >> confdefs.h <<EOF
#define wxUSE_ODBC $wxUSE_ODBC
EOF
+ IODBC_C_SRC="\$(IODBC_C_SRC)"
fi
+
if test "$wxUSE_GAUGE" = 1 ; then
cat >> confdefs.h <<EOF
#define wxUSE_GAUGE $wxUSE_GAUGE
s%@EXTRA_LINK@%$EXTRA_LINK%g
s%@PROFILE@%$PROFILE%g
s%@OPTIMISE@%$OPTIMISE%g
+s%@IODBC_C_SRC@%$IODBC_C_SRC%g
s%@METAFILE@%$METAFILE%g
s%@HELP@%$HELP%g
s%@WXGRAPH@%$WXGRAPH%g
AC_DEFINE_UNQUOTED(wxUSE_LIBPNG,$wxUSE_LIBPNG)
fi
+IODBC_C_SRC=""
if test "$wxUSE_ODBC" = 1 ; then
AC_DEFINE_UNQUOTED(wxUSE_ODBC,$wxUSE_ODBC)
+ IODBC_C_SRC="\$(IODBC_C_SRC)"
fi
+AC_SUBST(IODBC_C_SRC)
dnl ----------------------------------------------------------------
dnl Register GUI-control options for makefiles and setup.h
wxFileInputStream(const wxString& ifileName);
wxFileInputStream(wxFile& file);
wxFileInputStream(int fd);
- virtual ~wxFileInputStream();
+ ~wxFileInputStream();
- virtual char Peek();
+ char Peek();
+ size_t StreamSize() const;
bool Ok() const { return m_file->IsOpened(); }
{ return wxOutputStream::Write(buffer, size); }
void Sync();
+ size_t StreamSize() const;
bool Ok() const { return m_file->IsOpened(); }
bool m_file_destroy;
};
+class wxFileStream: public wxFileInputStream, public wxFileOutputStream {
+ public:
+ wxFileStream(const wxString& fileName);
+};
+
#endif
class WXDLLEXPORT wxStreamBuffer {
public:
typedef enum {
- read, write
+ read, write, read_write
} BufMode;
// -----------
// ctor & dtor
// -----------
wxStreamBuffer(wxStreamBase& stream, BufMode mode);
+ wxStreamBuffer(BufMode mode);
+ wxStreamBuffer(const wxStreamBuffer& buf);
~wxStreamBuffer();
// -----------
void Write(const void *buffer, size_t size);
bool WriteBack(const char *buffer, size_t size);
bool WriteBack(char c);
+ char GetChar();
+ void PutChar(char c);
off_t Tell() const;
off_t Seek(off_t pos, wxSeekMode mode);
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; }
+ void Flushable(bool f) { m_flushable = f; }
bool FlushBuffer();
bool FillBuffer();
char *m_wback;
size_t m_wbacksize, m_wbackcur;
- bool m_fixed;
+ bool m_fixed, m_flushable;
wxStreamBase *m_stream;
BufMode m_mode;
+ bool m_destroybuf;
};
// ---------------------------------------------------------------------------
wxStreamBase();
virtual ~wxStreamBase();
- wxStreamError LastError() { return m_lasterror; }
+ wxStreamError LastError() const { return m_lasterror; }
+ virtual size_t StreamSize() const { return ~((size_t)0); }
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();
+ virtual off_t OnSysTell() const;
protected:
size_t m_lastcount;
char Peek() { return m_parent_i_stream->Peek(); }
+ wxStreamError LastError() const { return m_parent_i_stream->LastError(); }
+ size_t StreamSize() const { return m_parent_i_stream->StreamSize(); }
+
protected:
wxInputStream *m_parent_i_stream;
};
wxFilterOutputStream(wxOutputStream& stream);
~wxFilterOutputStream();
+ wxStreamError LastError() const { return m_parent_o_stream->LastError(); }
+ size_t StreamSize() const { return m_parent_o_stream->StreamSize(); }
+
protected:
wxOutputStream *m_parent_o_stream;
};
-I.. \
-I$(WXBASEDIR)/include \
-I$(WXBASEDIR)/src/zlib \
+-I$(WXBASEDIR)/src/iodbc \
$(GUI_TK_INCLUDE) \
$(OPENGL_INCLUDE) \
$(X_CFLAGS)
s|*EXTRA_LINK*|@EXTRA_LINK@|g
s|*GTK_JOYSTICK*|@GTK_JOYSTICK@|g
s|*UNIX_THREAD*|@UNIX_THREAD@|g
+s|*IOBC_C_SRC*|@IODBC_C_SRC@|g
RULE=gslib
# define common stuff
+IODBC_C_SRC=\
+ iodbc/catalog.c \
+ iodbc/connect.c \
+ iodbc/dlf.c \
+ iodbc/dlproc.c \
+ iodbc/execute.c \
+ iodbc/fetch.c \
+ iodbc/hdbc.c \
+ iodbc/henv.c \
+ iodbc/herr.c \
+ iodbc/hstmt.c \
+ iodbc/info.c \
+ iodbc/itrace.c \
+ iodbc/main.c \
+ iodbc/misc.c \
+ iodbc/prepare.c \
+ iodbc/result.c
# include gtk.inc, qt.inc or motif.inc here
include @MAKEINCLUDE@
LIB_CPP_ALL_SRC=$(LIB_CPP_SRC) @GTK_JOYSTICK@ @UNIX_THREAD@
-LIB_C_ALL_SRC=$(LIB_C_SRC) parser.c
+LIB_C_ALL_SRC=$(LIB_C_SRC) @IOBC_C_SRC@ parser.c
#define library objects
LIB_OBJ=\
return 0;
}
+size_t wxFileInputStream::StreamSize() const
+{
+ return m_file->Length();
+}
+
size_t wxFileInputStream::OnSysRead(void *buffer, size_t size)
{
return m_file->Read(buffer, size);
m_o_streambuf->SetBufferIO(1024);
}
+wxFileOutputStream::wxFileOutputStream(wxFile& file)
+{
+ m_file = &file;
+ m_file_destroy = FALSE;
+ m_o_streambuf->SetBufferIO(1024);
+}
+
wxFileOutputStream::wxFileOutputStream()
: wxOutputStream()
{
wxOutputStream::Sync();
m_file->Flush();
}
+
+size_t wxFileOutputStream::StreamSize() const
+{
+ return m_file->Length();
+}
+
+// ----------------------------------------------------------------------------
+// wxFileStream
+// ----------------------------------------------------------------------------
+wxFileStream::wxFileStream(const wxString& fileName)
+ : wxFileInputStream(fileName), wxFileOutputStream(*wxFileInputStream::m_file)
+{
+}
wxStreamBuffer::wxStreamBuffer(wxStreamBase& stream, BufMode mode)
: m_buffer_start(NULL), m_buffer_end(NULL), m_buffer_pos(NULL),
- m_buffer_size(0), m_stream(&stream), m_mode(mode)
+ m_buffer_size(0), m_fixed(TRUE), m_flushable(TRUE), m_stream(&stream),
+ m_mode(mode), m_destroybuf(FALSE)
{
}
+wxStreamBuffer::wxStreamBuffer(BufMode mode)
+ : m_buffer_start(NULL), m_buffer_end(NULL), m_buffer_pos(NULL),
+ m_buffer_size(0), m_fixed(TRUE), m_flushable(FALSE), m_stream(NULL),
+ m_mode(mode), m_destroybuf(FALSE)
+{
+}
+
+wxStreamBuffer::wxStreamBuffer(const wxStreamBuffer& buffer)
+{
+ m_buffer_start = buffer.m_buffer_start;
+ m_buffer_end = buffer.m_buffer_end;
+ m_buffer_pos = buffer.m_buffer_pos;
+ m_buffer_size = buffer.m_buffer_size;
+ m_fixed = buffer.m_fixed;
+ m_flushable = buffer.m_flushable;
+ m_stream = buffer.m_stream;
+ m_mode = buffer.m_mode;
+ m_destroybuf = FALSE;
+}
+
wxStreamBuffer::~wxStreamBuffer()
{
- wxDELETEA(m_buffer_start);
+ if (m_destroybuf)
+ wxDELETEA(m_buffer_start);
}
bool wxStreamBuffer::WriteBack(const char *buf, size_t bufsize)
void wxStreamBuffer::SetBufferIO(char *buffer_start, char *buffer_end)
{
+ if (m_destroybuf)
+ wxDELETEA(m_buffer_start);
m_buffer_start = buffer_start;
m_buffer_end = buffer_end;
m_buffer_size = m_buffer_end-m_buffer_start;
+ m_destroybuf = FALSE;
ResetBuffer();
}
}
b_start = new char[bufsize];
-
SetBufferIO(b_start, b_start + bufsize);
+ m_destroybuf = TRUE;
}
void wxStreamBuffer::ResetBuffer()
{
size_t count, current;
- if (m_buffer_pos == m_buffer_start)
+ if (m_buffer_pos == m_buffer_start || !m_flushable)
return FALSE;
current = m_buffer_pos-m_buffer_start;
if (s_toput < size && !m_fixed) {
m_buffer_start = (char *)realloc(m_buffer_start, m_buffer_size+size);
// I round a bit
+ m_buffer_size += size;
m_buffer_end = m_buffer_start+m_buffer_size;
s_toput = size;
}
m_buffer_pos += s_toput;
}
+void wxStreamBuffer::PutChar(char c)
+{
+ wxASSERT(m_stream != NULL);
+
+ if (!m_buffer_size) {
+ m_stream->OnSysWrite(&c, 1);
+ return;
+ }
+
+ if (!GetDataLeft() && !FlushBuffer())
+ return;
+
+ PutToBuffer(&c, 1);
+ m_stream->m_lastcount = 1;
+}
+
+char wxStreamBuffer::GetChar()
+{
+ char c;
+
+ wxASSERT(m_stream != NULL);
+
+ if (!m_buffer_size) {
+ m_stream->OnSysRead(&c, 1);
+ return c;
+ }
+
+ if (!GetDataLeft() && !FillBuffer())
+ return 0;
+
+ GetFromBuffer(&c, 1);
+ m_stream->m_lastcount = 1;
+ return c;
+}
+
void wxStreamBuffer::Read(void *buffer, size_t size)
{
wxASSERT(m_stream != NULL);
buf_left = GetDataLeft();
// First case: the requested buffer is larger than the stream buffer,
- // we split
+ // we split it.
if (size > buf_left) {
GetFromBuffer(buffer, buf_left);
size -= buf_left;
last_access = GetLastAccess();
+ if (m_fixed) {
+ diff = pos + GetIntPosition();
+ if (diff < 0 || diff > last_access)
+ return wxInvalidOffset;
+ SetIntPosition(diff);
+ return diff;
+ }
+
switch (mode) {
case wxFromStart: {
// We'll try to compute an internal position later ...
{
off_t pos;
- pos = m_stream->OnSysTell();
- if (pos == wxInvalidOffset)
- return wxInvalidOffset;
-
- return pos - GetLastAccess() + GetIntPosition();
+ if (!m_fixed) {
+ pos = m_stream->OnSysTell();
+ if (pos == wxInvalidOffset)
+ return wxInvalidOffset;
+ return pos - GetLastAccess() + GetIntPosition();
+ } else
+ return GetIntPosition();
}
size_t wxStreamBuffer::GetDataLeft() const
return wxInvalidOffset;
}
-off_t wxStreamBase::OnSysTell()
+off_t wxStreamBase::OnSysTell() const
{
return wxInvalidOffset;
}
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
else
+#if (GTK_MINOR_VERSION == 1)
+ title = "Unknown"; // GLH: Well I don't know for the moment what to write here.
+#else
title = gdk_progname;
+#endif
XmbSetWMProperties (gprivate->xdisplay, gprivate->xwindow,
title, title,
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
else
+#if (GTK_MINOR_VERSION == 1)
+ title = "Unknown"; // GLH: Well I don't know for the moment what to write here.
+#else
title = gdk_progname;
+#endif
XmbSetWMProperties (gprivate->xdisplay, gprivate->xwindow,
title, title,