* Changed "true" to "TRUE" in some file: "true" doesn't exist in BC++ 5
* Added wxDataStream and wxProcess * Added the asynchronous end process notification on GTK and MSW * Updated configure* and setup.h * Added extended.c: Apple code to encode/decode float in IEEE format this code is removable by disabling USE_APPLE_CODEC git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
/// shall we be case sensitive in parsing variable names?
|
/// shall we be case sensitive in parsing variable names?
|
||||||
#ifndef APPCONF_CASE_SENSITIVE
|
#ifndef APPCONF_CASE_SENSITIVE
|
||||||
#define APPCONF_CASE_SENSITIVE false
|
#define APPCONF_CASE_SENSITIVE FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// separates group and entry names
|
/// separates group and entry names
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
/// should we use registry instead of configuration files under Win32?
|
/// should we use registry instead of configuration files under Win32?
|
||||||
#ifndef APPCONF_WIN32_NATIVE
|
#ifndef APPCONF_WIN32_NATIVE
|
||||||
#define APPCONF_WIN32_NATIVE true
|
#define APPCONF_WIN32_NATIVE TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -124,13 +124,13 @@ public:
|
|||||||
virtual bool Write(const char *szKey, const char *szValue) = 0;
|
virtual bool Write(const char *szKey, const char *szValue) = 0;
|
||||||
virtual bool Write(const char *szKey, long lValue) = 0;
|
virtual bool Write(const char *szKey, long lValue) = 0;
|
||||||
// permanently writes all changes
|
// permanently writes all changes
|
||||||
virtual bool Flush(bool bCurrentOnly = false) = 0;
|
virtual bool Flush(bool bCurrentOnly = FALSE) = 0;
|
||||||
|
|
||||||
// delete entries/groups
|
// delete entries/groups
|
||||||
// deletes the specified entry and the group it belongs to if
|
// deletes the specified entry and the group it belongs to if
|
||||||
// it was the last key in it and the second parameter is true
|
// it was the last key in it and the second parameter is true
|
||||||
virtual bool DeleteEntry(const char *szKey,
|
virtual bool DeleteEntry(const char *szKey,
|
||||||
bool bDeleteGroupIfEmpty = true) = 0;
|
bool bDeleteGroupIfEmpty = TRUE) = 0;
|
||||||
// delete the group (with all subgroups)
|
// delete the group (with all subgroups)
|
||||||
virtual bool DeleteGroup(const char *szKey) = 0;
|
virtual bool DeleteGroup(const char *szKey) = 0;
|
||||||
// delete the whole underlying object (disk file, registry key, ...)
|
// delete the whole underlying object (disk file, registry key, ...)
|
||||||
|
46
include/wx/datstrm.h
Normal file
46
include/wx/datstrm.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: datstrm.h
|
||||||
|
// Purpose: Data stream classes
|
||||||
|
// Author: Guilhem Lavaux
|
||||||
|
// Modified by:
|
||||||
|
// Created: 28/06/1998
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Guilhem Lavaux
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DATSTREAMH__
|
||||||
|
#define __DATSTREAMH__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "datstrm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wx.h"
|
||||||
|
|
||||||
|
class wxDataStream {
|
||||||
|
public:
|
||||||
|
wxDataStream(iostream& s);
|
||||||
|
wxDataStream(istream& s);
|
||||||
|
wxDataStream(ostream& s);
|
||||||
|
|
||||||
|
virtual ~wxDataStream();
|
||||||
|
|
||||||
|
unsigned long Read32();
|
||||||
|
unsigned short Read16();
|
||||||
|
unsigned char Read8();
|
||||||
|
double ReadDouble();
|
||||||
|
wxString ReadLine();
|
||||||
|
|
||||||
|
void Write32(unsigned long i);
|
||||||
|
void Write16(unsigned short i);
|
||||||
|
void Write8(unsigned char i);
|
||||||
|
void WriteDouble(double d);
|
||||||
|
void WriteLine(const wxString& line);
|
||||||
|
protected:
|
||||||
|
istream *m_istream;
|
||||||
|
ostream *m_ostream;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// __HELPBASEH__
|
@@ -179,7 +179,10 @@ enum wxEventType {
|
|||||||
wxEVT_COMMAND_TAB_SEL_CHANGED,
|
wxEVT_COMMAND_TAB_SEL_CHANGED,
|
||||||
wxEVT_COMMAND_TAB_SEL_CHANGING,
|
wxEVT_COMMAND_TAB_SEL_CHANGING,
|
||||||
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
|
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
|
||||||
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
|
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
|
||||||
|
|
||||||
|
/* System misc. */
|
||||||
|
wxEVT_END_PROCESS = wxEVT_FIRST + 300
|
||||||
};
|
};
|
||||||
|
|
||||||
// Compatibility
|
// Compatibility
|
||||||
|
@@ -43,7 +43,7 @@ public:
|
|||||||
virtual bool Read(long&, const char *, long = 0) const;
|
virtual bool Read(long&, const char *, long = 0) const;
|
||||||
virtual bool Write(const char *szKey, const char *szValue);
|
virtual bool Write(const char *szKey, const char *szValue);
|
||||||
virtual bool Write(const char *szKey, long Value);
|
virtual bool Write(const char *szKey, long Value);
|
||||||
virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return true; }
|
virtual bool Flush(bool /* bCurrentOnly = FALSE */ ) { return TRUE; }
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
virtual bool DeleteEntry(const char *szKey, bool bGroupIfEmptyAlso);
|
virtual bool DeleteEntry(const char *szKey, bool bGroupIfEmptyAlso);
|
||||||
@@ -59,4 +59,4 @@ private:
|
|||||||
wxString m_strPath;
|
wxString m_strPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_REGCONF_H
|
#endif //_REGCONF_H
|
||||||
|
@@ -111,7 +111,7 @@ public:
|
|||||||
|
|
||||||
// get infomation about the key
|
// get infomation about the key
|
||||||
// get the (full) key name. Abbreviate std root keys if bShortPrefix.
|
// get the (full) key name. Abbreviate std root keys if bShortPrefix.
|
||||||
wxString GetName(bool bShortPrefix = true) const;
|
wxString GetName(bool bShortPrefix = TRUE) const;
|
||||||
// return true if the key exists
|
// return true if the key exists
|
||||||
bool Exists() const;
|
bool Exists() const;
|
||||||
// return true if the key is opened
|
// return true if the key is opened
|
||||||
@@ -124,7 +124,7 @@ public:
|
|||||||
// which need the key to be opened if the key is not opened yet)
|
// which need the key to be opened if the key is not opened yet)
|
||||||
bool Open();
|
bool Open();
|
||||||
// create the key: will fail if the key already exists and bOkIfExists
|
// create the key: will fail if the key already exists and bOkIfExists
|
||||||
bool Create(bool bOkIfExists = true);
|
bool Create(bool bOkIfExists = TRUE);
|
||||||
// close the key (will be automatically done in dtor)
|
// close the key (will be automatically done in dtor)
|
||||||
bool Close();
|
bool Close();
|
||||||
|
|
||||||
|
@@ -163,6 +163,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define USE_APPLE_IEEE 1
|
||||||
|
// if enabled, the float codec written by Apple
|
||||||
|
// will be used to write, in a portable way,
|
||||||
|
// float on the disk
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Motif and XView
|
* Motif and XView
|
||||||
*
|
*
|
||||||
|
@@ -130,7 +130,7 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
|||||||
#ifdef USE_STORABLE_CLASSES
|
#ifdef USE_STORABLE_CLASSES
|
||||||
|
|
||||||
#define IMPLEMENT_STORABLE_CLASS(name, basename) \
|
#define IMPLEMENT_STORABLE_CLASS(name, basename) \
|
||||||
wxObject* WXDLLEXPORT_CTORFN wxStorableConstructorFor##name( fstream* stream, char* data )\
|
wxObject* WXDLLEXPORT_CTORFN wxStorableConstructorFor##name( istream* stream, char* data )\
|
||||||
{ return new name( stream, data ); }\
|
{ return new name( stream, data ); }\
|
||||||
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void)\
|
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void)\
|
||||||
{ return new name; }\
|
{ return new name; }\
|
||||||
@@ -138,7 +138,7 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void)\
|
|||||||
wxStorableConstructorFor##name );
|
wxStorableConstructorFor##name );
|
||||||
|
|
||||||
#define IMPLEMENT_STORABLE_CLASS2(name, basename1, basename2) \
|
#define IMPLEMENT_STORABLE_CLASS2(name, basename1, basename2) \
|
||||||
wxObject* WXDLLEXPORT_CTORFN wxStorableConstructorFor##name( fstream* stream, char* data )\
|
wxObject* WXDLLEXPORT_CTORFN wxStorableConstructorFor##name( istream* stream, char* data )\
|
||||||
{ return new name( stream, data ); }\
|
{ return new name( stream, data ); }\
|
||||||
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void)\
|
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void)\
|
||||||
{ return new name; }\
|
{ return new name; }\
|
||||||
|
58
include/wx/process.h
Normal file
58
include/wx/process.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: process.h
|
||||||
|
// Purpose: wxProcess class
|
||||||
|
// Author: Guilhem Lavaux
|
||||||
|
// Modified by:
|
||||||
|
// Created: 24/06/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1998 Guilhem Lavaux
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __PROCESSH__
|
||||||
|
#define __PROCESSH__
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
#include "wx/object.h"
|
||||||
|
#include "wx/event.h"
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxProcess: public wxEvtHandler
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxProcess)
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxProcess(wxEvtHandler *parent = NULL, int id = -1);
|
||||||
|
virtual ~wxProcess();
|
||||||
|
|
||||||
|
virtual void OnTerminate(int pid);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Process Event handling
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxProcessEvent: public wxEvent
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxProcessEvent)
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxProcessEvent(int id = 0, int pid = -1);
|
||||||
|
|
||||||
|
inline int GetPid() { return m_pid; }
|
||||||
|
inline void SetPid(int pid) { m_pid = pid; }
|
||||||
|
|
||||||
|
public:
|
||||||
|
int m_pid;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void (wxObject::*wxProcessEventFunction)(wxProcessEvent&);
|
||||||
|
|
||||||
|
#define EVT_END_PROCESS(id, func) { wxEVT_END_TERMINATE, id, -1, (wxObjectEvent) (wxEventFunction) (wxProcessEventFunction) & fn, NULL},
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// __PROCESSH__
|
@@ -21,6 +21,7 @@
|
|||||||
#include "wx/list.h"
|
#include "wx/list.h"
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
|
#include "wx/process.h"
|
||||||
|
|
||||||
#if USE_IOSTREAMH
|
#if USE_IOSTREAMH
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
@@ -96,8 +97,10 @@ int WXDLLEXPORT wxHexToDec(char *buf);
|
|||||||
void WXDLLEXPORT wxDecToHex(int dec, char *buf);
|
void WXDLLEXPORT wxDecToHex(int dec, char *buf);
|
||||||
|
|
||||||
// Execute another program. Returns 0 if there was an error, a PID otherwise.
|
// Execute another program. Returns 0 if there was an error, a PID otherwise.
|
||||||
long WXDLLEXPORT wxExecute(char **argv, bool Async = FALSE);
|
long WXDLLEXPORT wxExecute(char **argv, bool Async = FALSE,
|
||||||
long WXDLLEXPORT wxExecute(const wxString& command, bool Async = FALSE);
|
wxProcess *process = NULL);
|
||||||
|
long WXDLLEXPORT wxExecute(const wxString& command, bool Async = FALSE,
|
||||||
|
wxProcess *process = NULL);
|
||||||
|
|
||||||
#define wxSIGTERM 1
|
#define wxSIGTERM 1
|
||||||
|
|
||||||
|
563
install/gtk/configure
vendored
563
install/gtk/configure
vendored
File diff suppressed because it is too large
Load Diff
@@ -696,6 +696,7 @@ DEFAULT_USE_ZLIB=1
|
|||||||
DEFAULT_USE_GDK_IMLIB=1
|
DEFAULT_USE_GDK_IMLIB=1
|
||||||
DEFAULT_USE_LIBPNG=1
|
DEFAULT_USE_LIBPNG=1
|
||||||
|
|
||||||
|
DEFAULT_USE_APPLE_IEEE=1
|
||||||
DEFAULT_USE_STORABLE_CLASSES=1
|
DEFAULT_USE_STORABLE_CLASSES=1
|
||||||
DEFAULT_USE_AUTOTRANS=1
|
DEFAULT_USE_AUTOTRANS=1
|
||||||
DEFAULT_USE_AFM_FOR_POSTSCRIPT=1
|
DEFAULT_USE_AFM_FOR_POSTSCRIPT=1
|
||||||
@@ -764,31 +765,35 @@ dnl user options for libraries (no choice yet)
|
|||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
|
|
||||||
AC_OVERRIDES(zlib,zlib,
|
AC_OVERRIDES(zlib,zlib,
|
||||||
**--with-zlib use zlib (LZW comression),
|
**--with-zlib use zlib (LZW comression),
|
||||||
USE_ZLIB)
|
USE_ZLIB)
|
||||||
|
|
||||||
AC_OVERRIDES(gdk_imlib,gdk_imlib,
|
AC_OVERRIDES(gdk_imlib,gdk_imlib,
|
||||||
**--with-gdk_imlib use Raster's gdk_imlib (Image library),
|
**--with-gdk_imlib use Raster's gdk_imlib (Image library),
|
||||||
USE_GDK_IMLIB)
|
USE_GDK_IMLIB)
|
||||||
|
|
||||||
AC_OVERRIDES(libpng,libpng,
|
AC_OVERRIDES(libpng,libpng,
|
||||||
**--with-libpng use libpng (PNG image format),
|
**--with-libpng use libpng (PNG image format),
|
||||||
USE_LIBPNG)
|
USE_LIBPNG)
|
||||||
|
|
||||||
AC_OVERRIDES(opengl,opengl,
|
AC_OVERRIDES(opengl,opengl,
|
||||||
**--with-opengl use opengl (OpenGL or Mesa),
|
**--with-opengl use opengl (OpenGL or Mesa),
|
||||||
USE_OPENGL)
|
USE_OPENGL)
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
dnl user options for code features (no choice yet)
|
dnl user options for code features (no choice yet)
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
|
|
||||||
|
AC_OVERRIDES(apple-ieee, apple-ieee,
|
||||||
|
**--with-apple-ieee use the Apple IEEE codec,
|
||||||
|
USE_APPLE_IEEE)
|
||||||
|
|
||||||
AC_OVERRIDES(storable,storable,
|
AC_OVERRIDES(storable,storable,
|
||||||
**--with-storable use storable classes,
|
**--with-storable use storable classes,
|
||||||
USE_STORABLE_CLASSES)
|
USE_STORABLE_CLASSES)
|
||||||
|
|
||||||
AC_OVERRIDES(autotrans,autotrans,
|
AC_OVERRIDES(autotrans,autotrans,
|
||||||
**--with-autotrans use gettext automatic translation,
|
**--with-autotrans use gettext automatic translation,
|
||||||
USE_AUTOTRANS)
|
USE_AUTOTRANS)
|
||||||
|
|
||||||
AC_OVERRIDES(afmfonts,afmfonts,
|
AC_OVERRIDES(afmfonts,afmfonts,
|
||||||
|
@@ -55,6 +55,7 @@ LIB_CPP_SRC=\
|
|||||||
common/time.cpp \
|
common/time.cpp \
|
||||||
common/timercmn.cpp \
|
common/timercmn.cpp \
|
||||||
common/utilscmn.cpp \
|
common/utilscmn.cpp \
|
||||||
|
common/datstrm.cpp \
|
||||||
\
|
\
|
||||||
gtk/app.cpp \
|
gtk/app.cpp \
|
||||||
gtk/bitmap.cpp \
|
gtk/bitmap.cpp \
|
||||||
@@ -118,6 +119,7 @@ LIB_CPP_SRC=\
|
|||||||
generic/treectrl.cpp
|
generic/treectrl.cpp
|
||||||
|
|
||||||
LIB_C_SRC=\
|
LIB_C_SRC=\
|
||||||
|
common/extended.c \
|
||||||
\
|
\
|
||||||
gtk/win_gtk.c \
|
gtk/win_gtk.c \
|
||||||
\
|
\
|
||||||
|
172
src/common/datstrm.cpp
Normal file
172
src/common/datstrm.cpp
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: datstrm.cpp
|
||||||
|
// Purpose: Data stream classes
|
||||||
|
// Author: Guilhem Lavaux
|
||||||
|
// Modified by:
|
||||||
|
// Created: 28/06/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Guilhem Lavaux
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "datstrm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/defs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/datstrm.h"
|
||||||
|
|
||||||
|
wxDataStream::wxDataStream(istream& s)
|
||||||
|
{
|
||||||
|
m_istream = &s;
|
||||||
|
m_ostream = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDataStream::wxDataStream(ostream& s)
|
||||||
|
{
|
||||||
|
m_istream = NULL;
|
||||||
|
m_ostream = &s;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDataStream::wxDataStream(iostream& s)
|
||||||
|
{
|
||||||
|
m_istream = &s;
|
||||||
|
m_ostream = &s;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDataStream::~wxDataStream()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long wxDataStream::Read32()
|
||||||
|
{
|
||||||
|
char buf[4];
|
||||||
|
|
||||||
|
if (!m_istream)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
m_istream->read(buf, 4);
|
||||||
|
|
||||||
|
return (unsigned long)buf[0] |
|
||||||
|
((unsigned long)buf[1] << 8) |
|
||||||
|
((unsigned long)buf[2] << 16) |
|
||||||
|
((unsigned long)buf[3] << 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short wxDataStream::Read16()
|
||||||
|
{
|
||||||
|
char buf[2];
|
||||||
|
|
||||||
|
if (!m_istream)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
m_istream->read(buf, 2);
|
||||||
|
|
||||||
|
return (unsigned short)buf[0] |
|
||||||
|
((unsigned short)buf[1] << 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char wxDataStream::Read8()
|
||||||
|
{
|
||||||
|
char buf;
|
||||||
|
|
||||||
|
if (!m_istream)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
m_istream->read(&buf, 1);
|
||||||
|
return (unsigned char)buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
double wxDataStream::ReadDouble()
|
||||||
|
{
|
||||||
|
extern "C" double ConvertFromIeeeExtended(const unsigned char *bytes);
|
||||||
|
|
||||||
|
#if USE_APPLE_IEEE
|
||||||
|
char buf[10];
|
||||||
|
|
||||||
|
if (!m_istream)
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
m_istream->read(buf, 10);
|
||||||
|
return ConvertFromIeeeExtended((unsigned char *)buf);
|
||||||
|
#else
|
||||||
|
return 0.0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxDataStream::ReadLine()
|
||||||
|
{
|
||||||
|
char i_strg[255];
|
||||||
|
|
||||||
|
if (!m_istream)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
m_istream->getline(i_strg, 255);
|
||||||
|
return i_strg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDataStream::Write32(unsigned long i)
|
||||||
|
{
|
||||||
|
char buf[4];
|
||||||
|
|
||||||
|
if (!m_ostream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
buf[0] = i & 0xff;
|
||||||
|
buf[1] = (i >> 8) & 0xff;
|
||||||
|
buf[2] = (i >> 16) & 0xff;
|
||||||
|
buf[3] = (i >> 24) & 0xff;
|
||||||
|
m_ostream->write(buf, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDataStream::Write16(unsigned short i)
|
||||||
|
{
|
||||||
|
char buf[2];
|
||||||
|
|
||||||
|
if (!m_ostream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
buf[0] = i & 0xff;
|
||||||
|
buf[1] = (i >> 8) & 0xff;
|
||||||
|
m_ostream->write(buf, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDataStream::Write8(unsigned char i)
|
||||||
|
{
|
||||||
|
if (!m_ostream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_ostream->write(&i, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDataStream::WriteLine(const wxString& line)
|
||||||
|
{
|
||||||
|
wxString tmp_string = line + '\n';
|
||||||
|
|
||||||
|
if (!m_ostream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_ostream->write((const char *) tmp_string, tmp_string.Length());
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDataStream::WriteDouble(double d)
|
||||||
|
{
|
||||||
|
extern "C" void ConvertToIeeeExtended(double num, unsigned char *bytes)
|
||||||
|
char buf[10];
|
||||||
|
|
||||||
|
if (!m_ostream)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ConvertToIeeeExtended(d, (unsigned char *)buf);
|
||||||
|
m_ostream->write(buf, 10);
|
||||||
|
}
|
179
src/common/extended.c
Normal file
179
src/common/extended.c
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
#include "wx/setup.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#if USE_APPLE_IEEE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* C O N V E R T T O I E E E E X T E N D E D
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Copyright (C) 1988-1991 Apple Computer, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Machine-independent I/O routines for IEEE floating-point numbers.
|
||||||
|
*
|
||||||
|
* NaN's and infinities are converted to HUGE_VAL or HUGE, which
|
||||||
|
* happens to be infinity on IEEE machines. Unfortunately, it is
|
||||||
|
* impossible to preserve NaN's in a machine-independent way.
|
||||||
|
* Infinities are, however, preserved on IEEE machines.
|
||||||
|
*
|
||||||
|
* These routines have been tested on the following machines:
|
||||||
|
* Apple Macintosh, MPW 3.1 C compiler
|
||||||
|
* Apple Macintosh, THINK C compiler
|
||||||
|
* Silicon Graphics IRIS, MIPS compiler
|
||||||
|
* Cray X/MP and Y/MP
|
||||||
|
* Digital Equipment VAX
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Implemented by Malcolm Slaney and Ken Turkowski.
|
||||||
|
*
|
||||||
|
* Malcolm Slaney contributions during 1988-1990 include big- and little-
|
||||||
|
* endian file I/O, conversion to and from Motorola's extended 80-bit
|
||||||
|
* floating-point format, and conversions to and from IEEE single-
|
||||||
|
* precision floating-point format.
|
||||||
|
*
|
||||||
|
* In 1991, Ken Turkowski implemented the conversions to and from
|
||||||
|
* IEEE double-precision format, added more precision to the extended
|
||||||
|
* conversions, and accommodated conversions involving +/- infinity,
|
||||||
|
* NaN's, and denormalized numbers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HUGE_VAL
|
||||||
|
#define HUGE_VAL HUGE
|
||||||
|
#endif /*HUGE_VAL*/
|
||||||
|
|
||||||
|
#define FloatToUnsigned(f) ((unsigned long) (((long) (f - 2147483648.0)) + 2147483647L) + 1)
|
||||||
|
|
||||||
|
void ConvertToIeeeExtended(double num, unsigned char *bytes)
|
||||||
|
{
|
||||||
|
int sign;
|
||||||
|
int expon;
|
||||||
|
double fMant, fsMant;
|
||||||
|
unsigned long hiMant, loMant;
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
sign = 0x8000;
|
||||||
|
num *= -1;
|
||||||
|
} else {
|
||||||
|
sign = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num == 0) {
|
||||||
|
expon = 0; hiMant = 0; loMant = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fMant = frexp(num, &expon);
|
||||||
|
if ((expon > 16384) || !(fMant < 1)) { /* Infinity or NaN */
|
||||||
|
expon = sign|0x7FFF; hiMant = 0; loMant = 0; /* infinity */
|
||||||
|
}
|
||||||
|
else { /* Finite */
|
||||||
|
expon += 16382;
|
||||||
|
if (expon < 0) { /* denormalized */
|
||||||
|
fMant = ldexp(fMant, expon);
|
||||||
|
expon = 0;
|
||||||
|
}
|
||||||
|
expon |= sign;
|
||||||
|
fMant = ldexp(fMant, 32);
|
||||||
|
fsMant = floor(fMant);
|
||||||
|
hiMant = FloatToUnsigned(fsMant);
|
||||||
|
fMant = ldexp(fMant - fsMant, 32);
|
||||||
|
fsMant = floor(fMant);
|
||||||
|
loMant = FloatToUnsigned(fsMant);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes[0] = expon >> 8;
|
||||||
|
bytes[1] = expon;
|
||||||
|
bytes[2] = hiMant >> 24;
|
||||||
|
bytes[3] = hiMant >> 16;
|
||||||
|
bytes[4] = hiMant >> 8;
|
||||||
|
bytes[5] = hiMant;
|
||||||
|
bytes[6] = loMant >> 24;
|
||||||
|
bytes[7] = loMant >> 16;
|
||||||
|
bytes[8] = loMant >> 8;
|
||||||
|
bytes[9] = loMant;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* C O N V E R T F R O M I E E E E X T E N D E D
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1988-1991 Apple Computer, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Machine-independent I/O routines for IEEE floating-point numbers.
|
||||||
|
*
|
||||||
|
* NaN's and infinities are converted to HUGE_VAL or HUGE, which
|
||||||
|
* happens to be infinity on IEEE machines. Unfortunately, it is
|
||||||
|
* impossible to preserve NaN's in a machine-independent way.
|
||||||
|
* Infinities are, however, preserved on IEEE machines.
|
||||||
|
*
|
||||||
|
* These routines have been tested on the following machines:
|
||||||
|
* Apple Macintosh, MPW 3.1 C compiler
|
||||||
|
* Apple Macintosh, THINK C compiler
|
||||||
|
* Silicon Graphics IRIS, MIPS compiler
|
||||||
|
* Cray X/MP and Y/MP
|
||||||
|
* Digital Equipment VAX
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Implemented by Malcolm Slaney and Ken Turkowski.
|
||||||
|
*
|
||||||
|
* Malcolm Slaney contributions during 1988-1990 include big- and little-
|
||||||
|
* endian file I/O, conversion to and from Motorola's extended 80-bit
|
||||||
|
* floating-point format, and conversions to and from IEEE single-
|
||||||
|
* precision floating-point format.
|
||||||
|
*
|
||||||
|
* In 1991, Ken Turkowski implemented the conversions to and from
|
||||||
|
* IEEE double-precision format, added more precision to the extended
|
||||||
|
* conversions, and accommodated conversions involving +/- infinity,
|
||||||
|
* NaN's, and denormalized numbers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HUGE_VAL
|
||||||
|
# define HUGE_VAL HUGE
|
||||||
|
#endif /*HUGE_VAL*/
|
||||||
|
|
||||||
|
# define UnsignedToFloat(u) (((double) ((long) (u - 2147483647L - 1))) + 2147483648.0)
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
* Extended precision IEEE floating-point conversion routine.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
double ConvertFromIeeeExtended(const unsigned char *bytes)
|
||||||
|
{
|
||||||
|
double f;
|
||||||
|
int expon;
|
||||||
|
unsigned long hiMant, loMant;
|
||||||
|
|
||||||
|
expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF);
|
||||||
|
hiMant = ((unsigned long)(bytes[2] & 0xFF) << 24)
|
||||||
|
| ((unsigned long) (bytes[3] & 0xFF) << 16)
|
||||||
|
| ((unsigned long) (bytes[4] & 0xFF) << 8)
|
||||||
|
| ((unsigned long) (bytes[5] & 0xFF));
|
||||||
|
loMant = ((unsigned long) (bytes[6] & 0xFF) << 24)
|
||||||
|
| ((unsigned long) (bytes[7] & 0xFF) << 16)
|
||||||
|
| ((unsigned long) (bytes[8] & 0xFF) << 8)
|
||||||
|
| ((unsigned long) (bytes[9] & 0xFF));
|
||||||
|
|
||||||
|
if (expon == 0 && hiMant == 0 && loMant == 0) {
|
||||||
|
f = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (expon == 0x7FFF) { /* Infinity or NaN */
|
||||||
|
f = HUGE_VAL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
expon -= 16383;
|
||||||
|
f = ldexp(UnsignedToFloat(hiMant), expon-=31);
|
||||||
|
f += ldexp(UnsignedToFloat(loMant), expon-=32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytes[0] & 0x80)
|
||||||
|
return -f;
|
||||||
|
else
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif USE_APPLE_IEEE
|
@@ -333,12 +333,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
|
||||||
|
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
|
||||||
|
|
||||||
|
#include "wx/process.h"
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
|
||||||
|
|
||||||
#if USE_TIMEDATE
|
#if USE_TIMEDATE
|
||||||
#include "wx/date.h"
|
#include "wx/date.h"
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
|
||||||
|
@@ -176,6 +176,10 @@
|
|||||||
/*
|
/*
|
||||||
* Use wxTree
|
* Use wxTree
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Use Apple Ieee-double converter
|
||||||
|
*/
|
||||||
|
#undef USE_APPLE_IEEE
|
||||||
|
|
||||||
/********************** DO NOT CHANGE BELOW THIS POINT **********************/
|
/********************** DO NOT CHANGE BELOW THIS POINT **********************/
|
||||||
|
|
||||||
|
@@ -337,10 +337,46 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
|
|||||||
// subprocess routines
|
// subprocess routines
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
long wxExecute( char **argv, bool Async )
|
typedef struct {
|
||||||
|
gint pid, tag;
|
||||||
|
wxProcess *process;
|
||||||
|
} wxEndProcessData;
|
||||||
|
|
||||||
|
static void GTK_EndProcessDetector(gpointer data, gint source,
|
||||||
|
GdkInputCondition condition)
|
||||||
{
|
{
|
||||||
|
wxEndProcessData *proc_data = (wxEndProcessData *)data;
|
||||||
|
int pid;
|
||||||
|
|
||||||
|
pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
|
||||||
|
|
||||||
|
wait4(proc_data->pid, NULL, 0, NULL);
|
||||||
|
|
||||||
|
close(source);
|
||||||
|
gdk_input_remove(proc_data->tag);
|
||||||
|
|
||||||
|
if (proc_data->process)
|
||||||
|
proc_data->process->OnTerminate(proc_data->pid);
|
||||||
|
|
||||||
|
if (proc_data->pid > 0)
|
||||||
|
delete proc_data;
|
||||||
|
else
|
||||||
|
proc_data->pid = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
long wxExecute( char **argv, bool Async, wxProcess *process )
|
||||||
|
{
|
||||||
|
wxEndProcessData *data = new wxEndProcessData;
|
||||||
|
int end_proc_detect[2];
|
||||||
|
|
||||||
if (*argv == NULL)
|
if (*argv == NULL)
|
||||||
return FALSE;
|
return 0;
|
||||||
|
|
||||||
|
/* Create pipes */
|
||||||
|
if (pipe(end_proc_detect) == -1) {
|
||||||
|
perror("pipe failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* fork the process */
|
/* fork the process */
|
||||||
#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
|
#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
|
||||||
@@ -350,8 +386,11 @@ long wxExecute( char **argv, bool Async )
|
|||||||
#endif
|
#endif
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
perror ("fork failed");
|
perror ("fork failed");
|
||||||
return FALSE;
|
return 0;
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
|
/* Close fd not useful */
|
||||||
|
close(end_proc_detect[0]); // close reading side
|
||||||
|
|
||||||
/* child */
|
/* child */
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
execvp ((const char *)*argv, (const char **)argv);
|
execvp ((const char *)*argv, (const char **)argv);
|
||||||
@@ -366,39 +405,26 @@ long wxExecute( char **argv, bool Async )
|
|||||||
_exit (-1);
|
_exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code below is NOT really acceptable!
|
close(end_proc_detect[1]); // close writing side
|
||||||
// One should NEVER use wait under X
|
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
|
||||||
// Ideas? A Sleep idle callback?
|
GTK_EndProcessDetector, (gpointer)data);
|
||||||
// WARNING: WARNING: WARNING: WARNING:
|
data->pid = pid;
|
||||||
// The CODE BELOW IS BAD BAD BAD BAD!
|
|
||||||
if (Async) {
|
if (Async) {
|
||||||
int status;
|
data->process = process;
|
||||||
/*
|
} else {
|
||||||
wxSleep(2); // Give a little time
|
data->process = NULL;
|
||||||
*/
|
data->pid = -(data->pid);
|
||||||
#if !defined(DG) && \
|
|
||||||
!defined(__AIX__) && \
|
while (data->pid != 0)
|
||||||
!defined(__xlC__) && \
|
wxYield();
|
||||||
!defined(__SVR4__) && \
|
|
||||||
!defined(__SUN__) && \
|
delete data;
|
||||||
!defined(__ALPHA__) && \
|
}
|
||||||
!defined(__SGI__) && \
|
|
||||||
!defined(__HPUX__) && \
|
return pid;
|
||||||
!defined(__SUNPRO_CC) && \
|
|
||||||
!defined(__FreeBSD__)
|
|
||||||
while (wait((union wait*)&status) != pid)
|
|
||||||
#else
|
|
||||||
while (wait(&status) != pid)
|
|
||||||
#endif
|
|
||||||
{};
|
|
||||||
/*
|
|
||||||
wxSleep(3); // 3 sec?
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
return TRUE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
long wxExecute( const wxString& command, bool Async )
|
long wxExecute( const wxString& command, bool Async, wxProcess *process )
|
||||||
{
|
{
|
||||||
if (command.IsNull() || command == "") return FALSE;
|
if (command.IsNull() || command == "") return FALSE;
|
||||||
|
|
||||||
@@ -412,6 +438,6 @@ long wxExecute( const wxString& command, bool Async )
|
|||||||
argv[argc++] = strtok (tmp, IFS);
|
argv[argc++] = strtok (tmp, IFS);
|
||||||
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
|
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
|
||||||
/* loop */ ;
|
/* loop */ ;
|
||||||
return wxExecute(argv, Async);
|
return wxExecute(argv, Async, process);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -333,12 +333,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
|
||||||
|
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
|
||||||
|
|
||||||
|
#include "wx/process.h"
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
|
||||||
|
|
||||||
#if USE_TIMEDATE
|
#if USE_TIMEDATE
|
||||||
#include "wx/date.h"
|
#include "wx/date.h"
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
|
||||||
|
@@ -176,6 +176,10 @@
|
|||||||
/*
|
/*
|
||||||
* Use wxTree
|
* Use wxTree
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Use Apple Ieee-double converter
|
||||||
|
*/
|
||||||
|
#undef USE_APPLE_IEEE
|
||||||
|
|
||||||
/********************** DO NOT CHANGE BELOW THIS POINT **********************/
|
/********************** DO NOT CHANGE BELOW THIS POINT **********************/
|
||||||
|
|
||||||
|
@@ -337,10 +337,46 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
|
|||||||
// subprocess routines
|
// subprocess routines
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
|
||||||
long wxExecute( char **argv, bool Async )
|
typedef struct {
|
||||||
|
gint pid, tag;
|
||||||
|
wxProcess *process;
|
||||||
|
} wxEndProcessData;
|
||||||
|
|
||||||
|
static void GTK_EndProcessDetector(gpointer data, gint source,
|
||||||
|
GdkInputCondition condition)
|
||||||
{
|
{
|
||||||
|
wxEndProcessData *proc_data = (wxEndProcessData *)data;
|
||||||
|
int pid;
|
||||||
|
|
||||||
|
pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid);
|
||||||
|
|
||||||
|
wait4(proc_data->pid, NULL, 0, NULL);
|
||||||
|
|
||||||
|
close(source);
|
||||||
|
gdk_input_remove(proc_data->tag);
|
||||||
|
|
||||||
|
if (proc_data->process)
|
||||||
|
proc_data->process->OnTerminate(proc_data->pid);
|
||||||
|
|
||||||
|
if (proc_data->pid > 0)
|
||||||
|
delete proc_data;
|
||||||
|
else
|
||||||
|
proc_data->pid = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
long wxExecute( char **argv, bool Async, wxProcess *process )
|
||||||
|
{
|
||||||
|
wxEndProcessData *data = new wxEndProcessData;
|
||||||
|
int end_proc_detect[2];
|
||||||
|
|
||||||
if (*argv == NULL)
|
if (*argv == NULL)
|
||||||
return FALSE;
|
return 0;
|
||||||
|
|
||||||
|
/* Create pipes */
|
||||||
|
if (pipe(end_proc_detect) == -1) {
|
||||||
|
perror("pipe failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* fork the process */
|
/* fork the process */
|
||||||
#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
|
#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
|
||||||
@@ -350,8 +386,11 @@ long wxExecute( char **argv, bool Async )
|
|||||||
#endif
|
#endif
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
perror ("fork failed");
|
perror ("fork failed");
|
||||||
return FALSE;
|
return 0;
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
|
/* Close fd not useful */
|
||||||
|
close(end_proc_detect[0]); // close reading side
|
||||||
|
|
||||||
/* child */
|
/* child */
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
execvp ((const char *)*argv, (const char **)argv);
|
execvp ((const char *)*argv, (const char **)argv);
|
||||||
@@ -366,39 +405,26 @@ long wxExecute( char **argv, bool Async )
|
|||||||
_exit (-1);
|
_exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Code below is NOT really acceptable!
|
close(end_proc_detect[1]); // close writing side
|
||||||
// One should NEVER use wait under X
|
data->tag = gdk_input_add(end_proc_detect[0], GDK_INPUT_READ,
|
||||||
// Ideas? A Sleep idle callback?
|
GTK_EndProcessDetector, (gpointer)data);
|
||||||
// WARNING: WARNING: WARNING: WARNING:
|
data->pid = pid;
|
||||||
// The CODE BELOW IS BAD BAD BAD BAD!
|
|
||||||
if (Async) {
|
if (Async) {
|
||||||
int status;
|
data->process = process;
|
||||||
/*
|
} else {
|
||||||
wxSleep(2); // Give a little time
|
data->process = NULL;
|
||||||
*/
|
data->pid = -(data->pid);
|
||||||
#if !defined(DG) && \
|
|
||||||
!defined(__AIX__) && \
|
while (data->pid != 0)
|
||||||
!defined(__xlC__) && \
|
wxYield();
|
||||||
!defined(__SVR4__) && \
|
|
||||||
!defined(__SUN__) && \
|
delete data;
|
||||||
!defined(__ALPHA__) && \
|
}
|
||||||
!defined(__SGI__) && \
|
|
||||||
!defined(__HPUX__) && \
|
return pid;
|
||||||
!defined(__SUNPRO_CC) && \
|
|
||||||
!defined(__FreeBSD__)
|
|
||||||
while (wait((union wait*)&status) != pid)
|
|
||||||
#else
|
|
||||||
while (wait(&status) != pid)
|
|
||||||
#endif
|
|
||||||
{};
|
|
||||||
/*
|
|
||||||
wxSleep(3); // 3 sec?
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
return TRUE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
long wxExecute( const wxString& command, bool Async )
|
long wxExecute( const wxString& command, bool Async, wxProcess *process )
|
||||||
{
|
{
|
||||||
if (command.IsNull() || command == "") return FALSE;
|
if (command.IsNull() || command == "") return FALSE;
|
||||||
|
|
||||||
@@ -412,6 +438,6 @@ long wxExecute( const wxString& command, bool Async )
|
|||||||
argv[argc++] = strtok (tmp, IFS);
|
argv[argc++] = strtok (tmp, IFS);
|
||||||
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
|
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
|
||||||
/* loop */ ;
|
/* loop */ ;
|
||||||
return wxExecute(argv, Async);
|
return wxExecute(argv, Async, process);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -104,7 +104,9 @@ COMMONOBJS = \
|
|||||||
$(MSWDIR)\string.obj \
|
$(MSWDIR)\string.obj \
|
||||||
$(MSWDIR)\time.obj \
|
$(MSWDIR)\time.obj \
|
||||||
$(MSWDIR)\wxexpr.obj \
|
$(MSWDIR)\wxexpr.obj \
|
||||||
$(MSWDIR)\y_tab.obj
|
$(MSWDIR)\y_tab.obj \
|
||||||
|
$(MSWDIR)\datstrm.obj \
|
||||||
|
$(MSWDIR)\extended.obj
|
||||||
|
|
||||||
# $(MSWDIR)\matrix.obj \
|
# $(MSWDIR)\matrix.obj \
|
||||||
|
|
||||||
@@ -184,6 +186,7 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\timer.obj \
|
$(MSWDIR)\timer.obj \
|
||||||
$(MSWDIR)\treectrl.obj \
|
$(MSWDIR)\treectrl.obj \
|
||||||
$(MSWDIR)\utils.obj \
|
$(MSWDIR)\utils.obj \
|
||||||
|
$(MSWDIR)\utilsexc.obj \
|
||||||
$(MSWDIR)\wave.obj \
|
$(MSWDIR)\wave.obj \
|
||||||
$(MSWDIR)\window.obj \
|
$(MSWDIR)\window.obj \
|
||||||
$(MSWDIR)\droptgt.obj \
|
$(MSWDIR)\droptgt.obj \
|
||||||
@@ -369,6 +372,8 @@ $(MSWDIR)\treectrl.obj: $(MSWDIR)\treectrl.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\utils.obj: $(MSWDIR)\utils.$(SRCSUFF)
|
$(MSWDIR)\utils.obj: $(MSWDIR)\utils.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\utilsexc.obj: $(MSWDIR)\utilsexc.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\wave.obj: $(MSWDIR)\wave.$(SRCSUFF)
|
$(MSWDIR)\wave.obj: $(MSWDIR)\wave.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF)
|
$(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF)
|
||||||
@@ -456,6 +461,10 @@ $(MSWDIR)\matrix.obj: $(COMMDIR)\matrix.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\time.obj: $(COMMDIR)\time.$(SRCSUFF)
|
$(MSWDIR)\time.obj: $(COMMDIR)\time.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\datstrm.obj: $(COMMDIR)\datstrm.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\extended.obj: $(COMMDIR)\extended.c
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
# Generic objects (not always compiled, depending on
|
# Generic objects (not always compiled, depending on
|
||||||
# whether platforms have native implementations)
|
# whether platforms have native implementations)
|
||||||
|
@@ -104,7 +104,9 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)\list.obj \
|
$(COMMDIR)\list.obj \
|
||||||
$(COMMDIR)\string.obj \
|
$(COMMDIR)\string.obj \
|
||||||
$(COMMDIR)\time.obj \
|
$(COMMDIR)\time.obj \
|
||||||
$(COMMDIR)\y_tab.obj
|
$(COMMDIR)\y_tab.obj \
|
||||||
|
$(COMMDIR)\datstrm.obj \
|
||||||
|
$(COMMDIR)\extended.obj
|
||||||
|
|
||||||
# Nested classes: won't comple
|
# Nested classes: won't comple
|
||||||
# $(COMMDIR)\fileconf.obj \
|
# $(COMMDIR)\fileconf.obj \
|
||||||
@@ -806,6 +808,16 @@ $(COMMDIR)/time.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(COMMDIR)/datstrm.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(COMMDIR)/extended.obj: $*.c
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.c
|
||||||
|
<<
|
||||||
|
|
||||||
$(COMMDIR)/y_tab.obj: $*.c $(COMMDIR)/lex_yy.c
|
$(COMMDIR)/y_tab.obj: $*.c $(COMMDIR)/lex_yy.c
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS2) -DUSE_DEFINE -DYY_USE_PROTOS /Fo$@ /I ..\common /c $*.c
|
$(CPPFLAGS2) -DUSE_DEFINE -DYY_USE_PROTOS /Fo$@ /I ..\common /c $*.c
|
||||||
|
@@ -109,7 +109,9 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)/list.$(OBJSUFF) \
|
$(COMMDIR)/list.$(OBJSUFF) \
|
||||||
$(COMMDIR)/string.$(OBJSUFF) \
|
$(COMMDIR)/string.$(OBJSUFF) \
|
||||||
$(COMMDIR)/time.$(OBJSUFF) \
|
$(COMMDIR)/time.$(OBJSUFF) \
|
||||||
$(COMMDIR)/y_tab.$(OBJSUFF)
|
$(COMMDIR)/y_tab.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/datstrm.$(OBJSUFF) \
|
||||||
|
$(COMMDIR)/extended.$(OBJSUFF)
|
||||||
|
|
||||||
# $(COMMDIR)/wxstrgnu/wxstrgnu.$(OBJSUFF) \
|
# $(COMMDIR)/wxstrgnu/wxstrgnu.$(OBJSUFF) \
|
||||||
# $(COMMDIR)/wxstrgnu/wxregex.$(OBJSUFF)
|
# $(COMMDIR)/wxstrgnu/wxregex.$(OBJSUFF)
|
||||||
@@ -189,6 +191,7 @@ MSWOBJS = \
|
|||||||
timer.$(OBJSUFF) \
|
timer.$(OBJSUFF) \
|
||||||
treectrl.$(OBJSUFF) \
|
treectrl.$(OBJSUFF) \
|
||||||
utils.$(OBJSUFF) \
|
utils.$(OBJSUFF) \
|
||||||
|
utilsexc.$(OBJSUFF) \
|
||||||
wave.$(OBJSUFF) \
|
wave.$(OBJSUFF) \
|
||||||
window.$(OBJSUFF) \
|
window.$(OBJSUFF) \
|
||||||
$(OLEDIR)/droptgt.$(OBJSUFF) \
|
$(OLEDIR)/droptgt.$(OBJSUFF) \
|
||||||
|
@@ -106,7 +106,9 @@ COMMONOBJS = \
|
|||||||
$(COMMDIR)\string.obj \
|
$(COMMDIR)\string.obj \
|
||||||
$(COMMDIR)\time.obj \
|
$(COMMDIR)\time.obj \
|
||||||
$(COMMDIR)\wxexpr.obj \
|
$(COMMDIR)\wxexpr.obj \
|
||||||
$(COMMDIR)\y_tab.obj
|
$(COMMDIR)\y_tab.obj \
|
||||||
|
$(COMMDIR)\datstrm.obj \
|
||||||
|
$(COMMDIR)\extended.obj
|
||||||
|
|
||||||
# $(COMMDIR)\wxstrgnu\wxstrgnu.obj \
|
# $(COMMDIR)\wxstrgnu\wxstrgnu.obj \
|
||||||
# $(COMMDIR)\wxstrgnu\wxregex.obj \
|
# $(COMMDIR)\wxstrgnu\wxregex.obj \
|
||||||
@@ -189,6 +191,7 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\timer.obj \
|
$(MSWDIR)\timer.obj \
|
||||||
$(MSWDIR)\treectrl.obj \
|
$(MSWDIR)\treectrl.obj \
|
||||||
$(MSWDIR)\utils.obj \
|
$(MSWDIR)\utils.obj \
|
||||||
|
$(MSWDIR)\utilsexc.obj \
|
||||||
$(MSWDIR)\wave.obj \
|
$(MSWDIR)\wave.obj \
|
||||||
$(MSWDIR)\window.obj \
|
$(MSWDIR)\window.obj \
|
||||||
$(OLEDIR)\droptgt.obj \
|
$(OLEDIR)\droptgt.obj \
|
||||||
@@ -646,6 +649,11 @@ $(MSWDIR)/utils.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(MSWDIR)/utilsexc.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/wave.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/wave.obj: $*.$(SRCSUFF)
|
||||||
echo $(CPPFLAGS)
|
echo $(CPPFLAGS)
|
||||||
cl @<<
|
cl @<<
|
||||||
@@ -879,6 +887,16 @@ $(COMMDIR)/time.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(COMMDIR)\datstrm.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(COMMDIR)/extended.obj: $*.c
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.c /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
$(COMMDIR)/y_tab.obj: $*.c $(COMMDIR)/lex_yy.c
|
$(COMMDIR)/y_tab.obj: $*.c $(COMMDIR)/lex_yy.c
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS2) /c $*.c -DUSE_DEFINE -DYY_USE_PROTOS /Fo$@
|
$(CPPFLAGS2) /c $*.c -DUSE_DEFINE -DYY_USE_PROTOS /Fo$@
|
||||||
|
@@ -189,7 +189,7 @@ bool wxRegConfig::Read(wxString& str,
|
|||||||
{
|
{
|
||||||
PathChanger path(this, szKey);
|
PathChanger path(this, szKey);
|
||||||
|
|
||||||
bool bQueryGlobal = true;
|
bool bQueryGlobal = TRUE;
|
||||||
|
|
||||||
// if immutable key exists in global key we must check that it's not
|
// if immutable key exists in global key we must check that it's not
|
||||||
// overriden by the local key with the same name
|
// overriden by the local key with the same name
|
||||||
@@ -200,30 +200,30 @@ bool wxRegConfig::Read(wxString& str,
|
|||||||
path.Name().c_str());
|
path.Name().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// don't waste time - it's not there anyhow
|
// don't waste time - it's not there anyhow
|
||||||
bQueryGlobal = false;
|
bQueryGlobal = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// first try local key
|
// first try local key
|
||||||
if ( TryGetValue(m_keyLocal, path.Name(), str) ||
|
if ( TryGetValue(m_keyLocal, path.Name(), str) ||
|
||||||
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), str)) ) {
|
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), str)) ) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default value
|
// default value
|
||||||
str = szDefault;
|
str = szDefault;
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegConfig::Read(long &lValue, const char *szKey, long lDefault) const
|
bool wxRegConfig::Read(long &lValue, const char *szKey, long lDefault) const
|
||||||
{
|
{
|
||||||
PathChanger path(this, szKey);
|
PathChanger path(this, szKey);
|
||||||
|
|
||||||
bool bQueryGlobal = true;
|
bool bQueryGlobal = TRUE;
|
||||||
|
|
||||||
// if immutable key exists in global key we must check that it's not
|
// if immutable key exists in global key we must check that it's not
|
||||||
// overriden by the local key with the same name
|
// overriden by the local key with the same name
|
||||||
@@ -234,23 +234,23 @@ bool wxRegConfig::Read(long &lValue, const char *szKey, long lDefault) const
|
|||||||
path.Name().c_str());
|
path.Name().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// don't waste time - it's not there anyhow
|
// don't waste time - it's not there anyhow
|
||||||
bQueryGlobal = false;
|
bQueryGlobal = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// first try local key
|
// first try local key
|
||||||
if ( TryGetValue(m_keyLocal, path.Name(), &lValue) ||
|
if ( TryGetValue(m_keyLocal, path.Name(), &lValue) ||
|
||||||
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), &lValue)) ) {
|
(bQueryGlobal && TryGetValue(m_keyGlobal, path.Name(), &lValue)) ) {
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default
|
// default
|
||||||
lValue = lDefault;
|
lValue = lDefault;
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegConfig::Write(const char *szKey, const char *szValue)
|
bool wxRegConfig::Write(const char *szKey, const char *szValue)
|
||||||
@@ -259,7 +259,7 @@ bool wxRegConfig::Write(const char *szKey, const char *szValue)
|
|||||||
|
|
||||||
if ( IsImmutable(path.Name()) ) {
|
if ( IsImmutable(path.Name()) ) {
|
||||||
wxLogError("Can't change immutable entry '%s'.", path.Name().c_str());
|
wxLogError("Can't change immutable entry '%s'.", path.Name().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_keyLocal.SetValue(path.Name(), szValue);
|
return m_keyLocal.SetValue(path.Name(), szValue);
|
||||||
@@ -271,7 +271,7 @@ bool wxRegConfig::Write(const char *szKey, long lValue)
|
|||||||
|
|
||||||
if ( IsImmutable(path.Name()) ) {
|
if ( IsImmutable(path.Name()) ) {
|
||||||
wxLogError("Can't change immutable entry '%s'.", path.Name().c_str());
|
wxLogError("Can't change immutable entry '%s'.", path.Name().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_keyLocal.SetValue(path.Name(), lValue);
|
return m_keyLocal.SetValue(path.Name(), lValue);
|
||||||
@@ -285,7 +285,7 @@ bool wxRegConfig::DeleteEntry(const char *szValue, bool bGroupIfEmptyAlso)
|
|||||||
PathChanger path(this, szValue);
|
PathChanger path(this, szValue);
|
||||||
|
|
||||||
if ( !m_keyLocal.DeleteValue(path.Name()) )
|
if ( !m_keyLocal.DeleteValue(path.Name()) )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
if ( m_keyLocal.IsEmpty() ) {
|
if ( m_keyLocal.IsEmpty() ) {
|
||||||
wxString strKey = GetPath().Right(APPCONF_PATH_SEPARATOR);
|
wxString strKey = GetPath().Right(APPCONF_PATH_SEPARATOR);
|
||||||
@@ -293,7 +293,7 @@ bool wxRegConfig::DeleteEntry(const char *szValue, bool bGroupIfEmptyAlso)
|
|||||||
return m_keyLocal.DeleteKey(strKey);
|
return m_keyLocal.DeleteKey(strKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegConfig::DeleteGroup(const char *szKey)
|
bool wxRegConfig::DeleteGroup(const char *szKey)
|
||||||
@@ -306,7 +306,7 @@ bool wxRegConfig::DeleteGroup(const char *szKey)
|
|||||||
bool wxRegConfig::DeleteAll()
|
bool wxRegConfig::DeleteAll()
|
||||||
{
|
{
|
||||||
// first of all, prevent the creation of new registry entries
|
// first of all, prevent the creation of new registry entries
|
||||||
Config::EnableAutosave(false);
|
Config::EnableAutosave(FALSE);
|
||||||
|
|
||||||
m_keyLocal.Close();
|
m_keyLocal.Close();
|
||||||
m_keyGlobal.Close();
|
m_keyGlobal.Close();
|
||||||
|
@@ -100,7 +100,7 @@ aStdKeys[] =
|
|||||||
// removes the trailing backslash from the string if it has one
|
// removes the trailing backslash from the string if it has one
|
||||||
static inline void RemoveTrailingSeparator(wxString& str);
|
static inline void RemoveTrailingSeparator(wxString& str);
|
||||||
|
|
||||||
// returns true if given registry key exists
|
// returns TRUE if given registry key exists
|
||||||
static bool KeyExists(HKEY hRootKey, const char *szKey);
|
static bool KeyExists(HKEY hRootKey, const char *szKey);
|
||||||
|
|
||||||
// combines value and key name (uses static buffer!)
|
// combines value and key name (uses static buffer!)
|
||||||
@@ -274,11 +274,11 @@ void wxRegKey::SetHkey(HKEY hKey)
|
|||||||
// info about the key
|
// info about the key
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// returns true if the key exists
|
// returns TRUE if the key exists
|
||||||
bool wxRegKey::Exists() const
|
bool wxRegKey::Exists() const
|
||||||
{
|
{
|
||||||
// opened key has to exist, try to open it if not done yet
|
// opened key has to exist, try to open it if not done yet
|
||||||
return IsOpened() ? true : KeyExists(m_hRootKey, m_strKey);
|
return IsOpened() ? TRUE : KeyExists(m_hRootKey, m_strKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the full name of the key (prefix is abbreviated if bShortPrefix)
|
// returns the full name of the key (prefix is abbreviated if bShortPrefix)
|
||||||
@@ -301,16 +301,16 @@ wxString wxRegKey::GetName(bool bShortPrefix) const
|
|||||||
bool wxRegKey::Open()
|
bool wxRegKey::Open()
|
||||||
{
|
{
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
return true;
|
return TRUE;
|
||||||
|
|
||||||
m_dwLastError = RegOpenKey(m_hRootKey, m_strKey, &m_hKey);
|
m_dwLastError = RegOpenKey(m_hRootKey, m_strKey, &m_hKey);
|
||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, "can't open registry key '%s'",
|
wxLogSysError(m_dwLastError, "can't open registry key '%s'",
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates key, failing if it exists and !bOkIfExists
|
// creates key, failing if it exists and !bOkIfExists
|
||||||
@@ -318,20 +318,20 @@ bool wxRegKey::Create(bool bOkIfExists)
|
|||||||
{
|
{
|
||||||
// check for existence only if asked (i.e. order is important!)
|
// check for existence only if asked (i.e. order is important!)
|
||||||
if ( !bOkIfExists && Exists() ) {
|
if ( !bOkIfExists && Exists() ) {
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
return true;
|
return TRUE;
|
||||||
|
|
||||||
m_dwLastError = RegCreateKey(m_hRootKey, m_strKey, &m_hKey);
|
m_dwLastError = RegCreateKey(m_hRootKey, m_strKey, &m_hKey);
|
||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, "can't create registry key '%s'",
|
wxLogSysError(m_dwLastError, "can't create registry key '%s'",
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// close the key, it's not an error to call it when not opened
|
// close the key, it's not an error to call it when not opened
|
||||||
@@ -344,14 +344,14 @@ bool wxRegKey::Close()
|
|||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
|
|
||||||
m_hKey = 0;
|
m_hKey = 0;
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_hKey = 0;
|
m_hKey = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -402,7 +402,7 @@ bool wxRegKey::DeleteSelf()
|
|||||||
bool wxRegKey::DeleteKey(const char *szKey)
|
bool wxRegKey::DeleteKey(const char *szKey)
|
||||||
{
|
{
|
||||||
if ( !Open() )
|
if ( !Open() )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
wxRegKey key(*this, szKey);
|
wxRegKey key(*this, szKey);
|
||||||
return key.DeleteSelf();
|
return key.DeleteSelf();
|
||||||
@@ -411,14 +411,14 @@ bool wxRegKey::DeleteKey(const char *szKey)
|
|||||||
bool wxRegKey::DeleteValue(const char *szValue)
|
bool wxRegKey::DeleteValue(const char *szValue)
|
||||||
{
|
{
|
||||||
if ( !Open() )
|
if ( !Open() )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
m_dwLastError = RegDeleteValue(m_hKey, szValue);
|
m_dwLastError = RegDeleteValue(m_hKey, szValue);
|
||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, "can't delete value '%s' from key '%s'",
|
wxLogSysError(m_dwLastError, "can't delete value '%s' from key '%s'",
|
||||||
szValue, GetName().c_str());
|
szValue, GetName().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#else //WIN16
|
#else //WIN16
|
||||||
// named registry values don't exist in Win16 world
|
// named registry values don't exist in Win16 world
|
||||||
@@ -429,18 +429,18 @@ bool wxRegKey::DeleteValue(const char *szValue)
|
|||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, "can't delete value of key '%s'",
|
wxLogSysError(m_dwLastError, "can't delete value of key '%s'",
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif //WIN16/32
|
#endif //WIN16/32
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// access to values and subkeys
|
// access to values and subkeys
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// return true if value exists
|
// return TRUE if value exists
|
||||||
bool wxRegKey::HasValue(const char *szValue) const
|
bool wxRegKey::HasValue(const char *szValue) const
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
@@ -449,14 +449,14 @@ bool wxRegKey::HasValue(const char *szValue) const
|
|||||||
NULL, NULL, NULL) == ERROR_SUCCESS;
|
NULL, NULL, NULL) == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return FALSE;
|
||||||
#else // WIN16
|
#else // WIN16
|
||||||
// only unnamed value exists
|
// only unnamed value exists
|
||||||
return IsEmpty(szValue);
|
return IsEmpty(szValue);
|
||||||
#endif // WIN16/32
|
#endif // WIN16/32
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if this key has any subkeys
|
// returns TRUE if this key has any subkeys
|
||||||
bool wxRegKey::HasSubkeys() const
|
bool wxRegKey::HasSubkeys() const
|
||||||
{
|
{
|
||||||
// just call GetFirstKey with dummy parameters
|
// just call GetFirstKey with dummy parameters
|
||||||
@@ -465,13 +465,13 @@ bool wxRegKey::HasSubkeys() const
|
|||||||
return CONST_CAST GetFirstKey(str, l);
|
return CONST_CAST GetFirstKey(str, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if given subkey exists
|
// returns TRUE if given subkey exists
|
||||||
bool wxRegKey::HasSubKey(const char *szKey) const
|
bool wxRegKey::HasSubKey(const char *szKey) const
|
||||||
{
|
{
|
||||||
if ( CONST_CAST Open() )
|
if ( CONST_CAST Open() )
|
||||||
return KeyExists(m_hKey, szKey);
|
return KeyExists(m_hKey, szKey);
|
||||||
else
|
else
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue)
|
wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue)
|
||||||
@@ -502,12 +502,12 @@ bool wxRegKey::SetValue(const char *szValue, long lValue)
|
|||||||
m_dwLastError = RegSetValueEx(m_hKey, szValue, RESERVED, REG_DWORD,
|
m_dwLastError = RegSetValueEx(m_hKey, szValue, RESERVED, REG_DWORD,
|
||||||
(RegString)&lValue, sizeof(lValue));
|
(RegString)&lValue, sizeof(lValue));
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, "can't set value of '%s'",
|
wxLogSysError(m_dwLastError, "can't set value of '%s'",
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::QueryValue(const char *szValue, long *plValue) const
|
bool wxRegKey::QueryValue(const char *szValue, long *plValue) const
|
||||||
@@ -520,18 +520,18 @@ bool wxRegKey::QueryValue(const char *szValue, long *plValue) const
|
|||||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||||
wxLogSysError(m_dwLastError, "can't read value of key '%s'",
|
wxLogSysError(m_dwLastError, "can't read value of key '%s'",
|
||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// check that we read the value of right type
|
// check that we read the value of right type
|
||||||
wxASSERT_MSG( dwType == REG_DWORD,
|
wxASSERT_MSG( dwType == REG_DWORD,
|
||||||
"Type mismatch in wxRegKey::QueryValue()." );
|
"Type mismatch in wxRegKey::QueryValue()." );
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //Win32
|
#endif //Win32
|
||||||
@@ -553,7 +553,7 @@ bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const
|
|||||||
wxASSERT_MSG( dwType == REG_SZ,
|
wxASSERT_MSG( dwType == REG_SZ,
|
||||||
"Type mismatch in wxRegKey::QueryValue()." );
|
"Type mismatch in wxRegKey::QueryValue()." );
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else //WIN16
|
#else //WIN16
|
||||||
@@ -562,13 +562,13 @@ bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const
|
|||||||
|
|
||||||
m_dwLastError = RegQueryValue(m_hKey, 0, strValue.GetWriteBuf(256), &l);
|
m_dwLastError = RegQueryValue(m_hKey, 0, strValue.GetWriteBuf(256), &l);
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return true;
|
return TRUE;
|
||||||
#endif //WIN16/32
|
#endif //WIN16/32
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, "can't read value of '%s'",
|
wxLogSysError(m_dwLastError, "can't read value of '%s'",
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::SetValue(const char *szValue, const wxString& strValue)
|
bool wxRegKey::SetValue(const char *szValue, const wxString& strValue)
|
||||||
@@ -579,20 +579,20 @@ bool wxRegKey::SetValue(const char *szValue, const wxString& strValue)
|
|||||||
(RegString)strValue.c_str(),
|
(RegString)strValue.c_str(),
|
||||||
strValue.Len() + 1);
|
strValue.Len() + 1);
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return true;
|
return TRUE;
|
||||||
#else //WIN16
|
#else //WIN16
|
||||||
// named registry values don't exist in Win16
|
// named registry values don't exist in Win16
|
||||||
wxASSERT( IsEmpty(szValue) );
|
wxASSERT( IsEmpty(szValue) );
|
||||||
|
|
||||||
m_dwLastError = RegSetValue(m_hKey, NULL, REG_SZ, strValue, NULL);
|
m_dwLastError = RegSetValue(m_hKey, NULL, REG_SZ, strValue, NULL);
|
||||||
if ( m_dwLastError == ERROR_SUCCESS )
|
if ( m_dwLastError == ERROR_SUCCESS )
|
||||||
return true;
|
return TRUE;
|
||||||
#endif //WIN16/32
|
#endif //WIN16/32
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogSysError(m_dwLastError, "can't set value of '%s'",
|
wxLogSysError(m_dwLastError, "can't set value of '%s'",
|
||||||
GetFullName(this, szValue));
|
GetFullName(this, szValue));
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegKey::operator wxString() const
|
wxRegKey::operator wxString() const
|
||||||
@@ -611,7 +611,7 @@ wxRegKey::operator wxString() const
|
|||||||
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
|
bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex)
|
||||||
{
|
{
|
||||||
if ( !Open() )
|
if ( !Open() )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
lIndex = 0;
|
lIndex = 0;
|
||||||
return GetNextValue(strValueName, lIndex);
|
return GetNextValue(strValueName, lIndex);
|
||||||
@@ -623,7 +623,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
|||||||
|
|
||||||
// are we already at the end of enumeration?
|
// are we already at the end of enumeration?
|
||||||
if ( lIndex == -1 )
|
if ( lIndex == -1 )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
char szValueName[1024]; // @@ use RegQueryInfoKey...
|
char szValueName[1024]; // @@ use RegQueryInfoKey...
|
||||||
@@ -647,7 +647,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
|||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
strValueName = szValueName;
|
strValueName = szValueName;
|
||||||
@@ -659,13 +659,13 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
|||||||
strValueName.Empty();
|
strValueName.Empty();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex)
|
bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex)
|
||||||
{
|
{
|
||||||
if ( !Open() )
|
if ( !Open() )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
lIndex = 0;
|
lIndex = 0;
|
||||||
return GetNextKey(strKeyName, lIndex);
|
return GetNextKey(strKeyName, lIndex);
|
||||||
@@ -677,7 +677,7 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const
|
|||||||
|
|
||||||
// are we already at the end of enumeration?
|
// are we already at the end of enumeration?
|
||||||
if ( lIndex == -1 )
|
if ( lIndex == -1 )
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
char szKeyName[_MAX_PATH + 1];
|
char szKeyName[_MAX_PATH + 1];
|
||||||
m_dwLastError = RegEnumKey(m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName));
|
m_dwLastError = RegEnumKey(m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName));
|
||||||
@@ -692,11 +692,11 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const
|
|||||||
GetName().c_str());
|
GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
strKeyName = szKeyName;
|
strKeyName = szKeyName;
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -707,10 +707,10 @@ bool KeyExists(HKEY hRootKey, const char *szKey)
|
|||||||
HKEY hkeyDummy;
|
HKEY hkeyDummy;
|
||||||
if ( RegOpenKey(hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) {
|
if ( RegOpenKey(hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) {
|
||||||
RegCloseKey(hkeyDummy);
|
RegCloseKey(hkeyDummy);
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GetFullName(const wxRegKey *pKey, const char *szValue)
|
const char *GetFullName(const wxRegKey *pKey, const char *szValue)
|
||||||
|
@@ -207,97 +207,6 @@ bool wxGetUserName(char *buf, int maxSize)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute a command (e.g. another program) in a
|
|
||||||
// system-independent manner.
|
|
||||||
|
|
||||||
long wxExecute(char **argv, bool sync)
|
|
||||||
{
|
|
||||||
if (*argv == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
char command[1024];
|
|
||||||
command[0] = '\0';
|
|
||||||
|
|
||||||
int argc;
|
|
||||||
for (argc = 0; argv[argc]; argc++)
|
|
||||||
{
|
|
||||||
if (argc)
|
|
||||||
strcat(command, " ");
|
|
||||||
strcat(command, argv[argc]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxExecute((char *)command, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
long wxExecute(const wxString& command, bool sync)
|
|
||||||
{
|
|
||||||
if (command == "")
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#ifdef __WIN32__
|
|
||||||
char * cl;
|
|
||||||
char * argp;
|
|
||||||
int clen;
|
|
||||||
HINSTANCE result;
|
|
||||||
DWORD dresult;
|
|
||||||
|
|
||||||
// copy the command line
|
|
||||||
clen = command.Length();
|
|
||||||
if (!clen) return -1;
|
|
||||||
cl = (char *) calloc( 1, 256);
|
|
||||||
if (!cl) return -1;
|
|
||||||
strcpy( cl, WXSTRINGCAST command);
|
|
||||||
|
|
||||||
// isolate command and arguments
|
|
||||||
argp = strchr( cl, ' ');
|
|
||||||
if (argp)
|
|
||||||
*argp++ = '\0';
|
|
||||||
|
|
||||||
// execute the command
|
|
||||||
#ifdef __GNUWIN32__
|
|
||||||
result = ShellExecute( (HWND) (wxTheApp->GetTopWindow() ? (HWND) wxTheApp->GetTopWindow()->GetHWND() : NULL),
|
|
||||||
(const wchar_t) "open", (const wchar_t) cl, (const wchar_t) argp, (const wchar_t) NULL, SW_SHOWNORMAL);
|
|
||||||
#else
|
|
||||||
result = ShellExecute( (HWND) (wxTheApp->GetTopWindow() ? wxTheApp->GetTopWindow()->GetHWND() : NULL),
|
|
||||||
"open", cl, argp, NULL, SW_SHOWNORMAL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (((long)result) <= 32) {
|
|
||||||
free(cl);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sync)
|
|
||||||
{
|
|
||||||
free(cl);
|
|
||||||
return dresult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// waiting until command executed
|
|
||||||
do {
|
|
||||||
wxYield();
|
|
||||||
dresult = GetModuleFileName( result, cl, 256);
|
|
||||||
} while( dresult);
|
|
||||||
|
|
||||||
/* long lastError = GetLastError(); */
|
|
||||||
|
|
||||||
free(cl);
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
long instanceID = WinExec((LPCSTR) WXSTRINGCAST command, SW_SHOW);
|
|
||||||
if (instanceID < 32) return(0);
|
|
||||||
|
|
||||||
if (sync) {
|
|
||||||
int running;
|
|
||||||
do {
|
|
||||||
wxYield();
|
|
||||||
running = GetModuleUsage((HANDLE)instanceID);
|
|
||||||
} while (running);
|
|
||||||
}
|
|
||||||
return(instanceID);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxKill(long pid, int sig)
|
int wxKill(long pid, int sig)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user