OS/2 updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3219 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -107,10 +107,15 @@ public:
|
|||||||
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
|
typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&);
|
||||||
|
|
||||||
// macros for handling spin events
|
// macros for handling spin events
|
||||||
|
#ifndef EVT_SPIN_UP
|
||||||
#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
|
#define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
|
||||||
|
#endif
|
||||||
|
#ifndef EVT_SPIN_DOWN
|
||||||
#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
|
#define EVT_SPIN_DOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
|
||||||
|
#endif
|
||||||
|
#ifndef EVT_SPIN
|
||||||
#define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
|
#define EVT_SPIN(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func },
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // wxUSE_SPINBTN
|
#endif // wxUSE_SPINBTN
|
||||||
|
|
||||||
|
@@ -41,7 +41,8 @@ enum wxTextFileType
|
|||||||
wxTextFileType_None, // incomplete (the last line of the file only)
|
wxTextFileType_None, // incomplete (the last line of the file only)
|
||||||
wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n'
|
wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n'
|
||||||
wxTextFileType_Dos, // 'CR' 'LF'
|
wxTextFileType_Dos, // 'CR' 'LF'
|
||||||
wxTextFileType_Mac // 'CR' = 0xD = 13 = '\r'
|
wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r'
|
||||||
|
wxTextFileType_Os2 // 'CR' 'LF'
|
||||||
};
|
};
|
||||||
|
|
||||||
WX_DEFINE_ARRAY(wxTextFileType, ArrayFileType);
|
WX_DEFINE_ARRAY(wxTextFileType, ArrayFileType);
|
||||||
|
@@ -41,7 +41,7 @@ class WXDLLEXPORT wxProcess;
|
|||||||
class WXDLLEXPORT wxFrame;
|
class WXDLLEXPORT wxFrame;
|
||||||
|
|
||||||
// FIXME should use wxStricmp() instead
|
// FIXME should use wxStricmp() instead
|
||||||
#ifdef __GNUWIN32__
|
#if defined(__GNUWIN32__)
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#define strnicmp strncasecmp
|
#define strnicmp strncasecmp
|
||||||
#endif
|
#endif
|
||||||
|
@@ -59,12 +59,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxPNGHandler,wxImageHandler)
|
|||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
|
|
||||||
static void _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
|
#if defined(__VISAGECPP__)
|
||||||
|
#define LINKAGEMODE _Optlink
|
||||||
|
#else
|
||||||
|
#define LINKAGEMODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void LINKAGEMODE _PNG_stream_reader( png_structp png_ptr, png_bytep data, png_size_t length )
|
||||||
{
|
{
|
||||||
((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length);
|
((wxInputStream*) png_get_io_ptr( png_ptr )) -> Read(data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length )
|
static void LINKAGEMODE _PNG_stream_writer( png_structp png_ptr, png_bytep data, png_size_t length )
|
||||||
{
|
{
|
||||||
((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length);
|
((wxOutputStream*) png_get_io_ptr( png_ptr )) -> Write(data, length);
|
||||||
}
|
}
|
||||||
@@ -73,56 +79,56 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
{
|
{
|
||||||
// VZ: as this function uses setjmp() the only fool proof error handling
|
// VZ: as this function uses setjmp() the only fool proof error handling
|
||||||
// method is to use goto (setjmp is not really C++ dtors friendly...)
|
// method is to use goto (setjmp is not really C++ dtors friendly...)
|
||||||
|
|
||||||
unsigned char **lines;
|
unsigned char **lines;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
png_infop info_ptr = (png_infop) NULL;
|
png_infop info_ptr = (png_infop) NULL;
|
||||||
|
|
||||||
image->Destroy();
|
image->Destroy();
|
||||||
|
|
||||||
png_structp png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
|
png_structp png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
|
||||||
(voidp) NULL,
|
(voidp) NULL,
|
||||||
(png_error_ptr) NULL,
|
(png_error_ptr) NULL,
|
||||||
(png_error_ptr) NULL );
|
(png_error_ptr) NULL );
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
goto error_nolines;
|
goto error_nolines;
|
||||||
|
|
||||||
info_ptr = png_create_info_struct( png_ptr );
|
info_ptr = png_create_info_struct( png_ptr );
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
goto error_nolines;
|
goto error_nolines;
|
||||||
|
|
||||||
if (setjmp(png_ptr->jmpbuf))
|
if (setjmp(png_ptr->jmpbuf))
|
||||||
goto error_nolines;
|
goto error_nolines;
|
||||||
|
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
goto error_nolines;
|
goto error_nolines;
|
||||||
|
|
||||||
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
|
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
|
||||||
|
|
||||||
png_uint_32 width,height;
|
png_uint_32 width,height;
|
||||||
int bit_depth,color_type,interlace_type;
|
int bit_depth,color_type,interlace_type;
|
||||||
|
|
||||||
png_read_info( png_ptr, info_ptr );
|
png_read_info( png_ptr, info_ptr );
|
||||||
png_get_IHDR( png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, (int*) NULL, (int*) NULL );
|
png_get_IHDR( png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, (int*) NULL, (int*) NULL );
|
||||||
|
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_set_expand( png_ptr );
|
png_set_expand( png_ptr );
|
||||||
|
|
||||||
png_set_strip_16( png_ptr );
|
png_set_strip_16( png_ptr );
|
||||||
png_set_packing( png_ptr );
|
png_set_packing( png_ptr );
|
||||||
if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid( png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||||
png_set_expand( png_ptr );
|
png_set_expand( png_ptr );
|
||||||
png_set_filler( png_ptr, 0xff, PNG_FILLER_AFTER );
|
png_set_filler( png_ptr, 0xff, PNG_FILLER_AFTER );
|
||||||
|
|
||||||
image->Create( width, height );
|
image->Create( width, height );
|
||||||
|
|
||||||
if (!image->Ok())
|
if (!image->Ok())
|
||||||
goto error_nolines;
|
goto error_nolines;
|
||||||
|
|
||||||
lines = (unsigned char **)malloc( height * sizeof(unsigned char *) );
|
lines = (unsigned char **)malloc( height * sizeof(unsigned char *) );
|
||||||
if (lines == NULL)
|
if (lines == NULL)
|
||||||
goto error_nolines;
|
goto error_nolines;
|
||||||
|
|
||||||
for (i = 0; i < height; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
if ((lines[i] = (unsigned char *)malloc(width * (sizeof(unsigned char) * 4))) == NULL)
|
if ((lines[i] = (unsigned char *)malloc(width * (sizeof(unsigned char) * 4))) == NULL)
|
||||||
@@ -132,7 +138,7 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loaded successfully!
|
// loaded successfully!
|
||||||
{
|
{
|
||||||
int transp = 0;
|
int transp = 0;
|
||||||
@@ -193,11 +199,11 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( unsigned int j = 0; j < height; j++ )
|
for ( unsigned int j = 0; j < height; j++ )
|
||||||
free( lines[j] );
|
free( lines[j] );
|
||||||
free( lines );
|
free( lines );
|
||||||
|
|
||||||
if (transp)
|
if (transp)
|
||||||
{
|
{
|
||||||
image->SetMaskColour( 255, 0, 255 );
|
image->SetMaskColour( 255, 0, 255 );
|
||||||
@@ -207,24 +213,24 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
image->SetMask( FALSE );
|
image->SetMask( FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error_nolines:
|
error_nolines:
|
||||||
lines = NULL; // called from before it was set
|
lines = NULL; // called from before it was set
|
||||||
error:
|
error:
|
||||||
wxLogError(_("Couldn't load a PNG image - probably file is corrupted."));
|
wxLogError(_("Couldn't load a PNG image - probably file is corrupted."));
|
||||||
|
|
||||||
if ( image->Ok() )
|
if ( image->Ok() )
|
||||||
{
|
{
|
||||||
image->Destroy();
|
image->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lines )
|
if ( lines )
|
||||||
{
|
{
|
||||||
free( lines );
|
free( lines );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( png_ptr )
|
if ( png_ptr )
|
||||||
{
|
{
|
||||||
if ( info_ptr )
|
if ( info_ptr )
|
||||||
@@ -247,26 +253,26 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (info_ptr == NULL)
|
if (info_ptr == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(png_ptr->jmpbuf))
|
if (setjmp(png_ptr->jmpbuf))
|
||||||
{
|
{
|
||||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_set_write_fn( png_ptr, &stream, _PNG_stream_writer, NULL);
|
png_set_write_fn( png_ptr, &stream, _PNG_stream_writer, NULL);
|
||||||
|
|
||||||
png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), 8,
|
png_set_IHDR( png_ptr, info_ptr, image->GetWidth(), image->GetHeight(), 8,
|
||||||
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
||||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
png_color_8 sig_bit;
|
png_color_8 sig_bit;
|
||||||
sig_bit.red = 8;
|
sig_bit.red = 8;
|
||||||
sig_bit.green = 8;
|
sig_bit.green = 8;
|
||||||
@@ -276,14 +282,14 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
|
|||||||
png_write_info( png_ptr, info_ptr );
|
png_write_info( png_ptr, info_ptr );
|
||||||
png_set_shift( png_ptr, &sig_bit );
|
png_set_shift( png_ptr, &sig_bit );
|
||||||
png_set_packing( png_ptr );
|
png_set_packing( png_ptr );
|
||||||
|
|
||||||
unsigned char *data = (unsigned char *)malloc( image->GetWidth()*4 );
|
unsigned char *data = (unsigned char *)malloc( image->GetWidth()*4 );
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < image->GetHeight(); y++)
|
for (int y = 0; y < image->GetHeight(); y++)
|
||||||
{
|
{
|
||||||
unsigned char *ptr = image->GetData() + (y * image->GetWidth() * 3);
|
unsigned char *ptr = image->GetData() + (y * image->GetWidth() * 3);
|
||||||
@@ -306,7 +312,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
|
|||||||
png_bytep row_ptr = data;
|
png_bytep row_ptr = data;
|
||||||
png_write_rows( png_ptr, &row_ptr, 1 );
|
png_write_rows( png_ptr, &row_ptr, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
png_write_end( png_ptr, info_ptr );
|
png_write_end( png_ptr, info_ptr );
|
||||||
png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr );
|
png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr );
|
||||||
@@ -314,9 +320,9 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// wxUSE_STREAMS
|
// wxUSE_STREAMS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// wxUSE_LIBPNG
|
// wxUSE_LIBPNG
|
||||||
|
|
||||||
|
@@ -53,6 +53,8 @@ const wxTextFileType wxTextFile::typeDefault =
|
|||||||
wxTextFileType_Unix;
|
wxTextFileType_Unix;
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
wxTextFileType_Mac;
|
wxTextFileType_Mac;
|
||||||
|
#elif defined(__WXPM__)
|
||||||
|
wxTextFileType_Os2;
|
||||||
#else
|
#else
|
||||||
wxTextFileType_None;
|
wxTextFileType_None;
|
||||||
#error "wxTextFile: unsupported platform."
|
#error "wxTextFile: unsupported platform."
|
||||||
|
@@ -83,7 +83,7 @@ void wxStartTimer(void)
|
|||||||
#endif
|
#endif
|
||||||
wxStartTime = 1000*tp.tv_sec + tp.tv_usec/1000;
|
wxStartTime = 1000*tp.tv_sec + tp.tv_usec/1000;
|
||||||
#elif (defined(__SC__) || defined(__SGI__) || defined(___BSDI__) || defined(__ALPHA__) || \
|
#elif (defined(__SC__) || defined(__SGI__) || defined(___BSDI__) || defined(__ALPHA__) || \
|
||||||
defined(__MINGW32__) || defined(__MWERKS__) || defined(__FreeBSD__) )
|
defined(__MINGW32__) || defined(__MWERKS__) || defined(__FreeBSD__) )
|
||||||
time_t t0;
|
time_t t0;
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
time(&t0);
|
time(&t0);
|
||||||
@@ -136,7 +136,7 @@ long wxGetElapsedTime(bool resetTimer)
|
|||||||
#ifndef __VMS__
|
#ifndef __VMS__
|
||||||
bool wxGetLocalTime(long *timeZone, int *dstObserved)
|
bool wxGetLocalTime(long *timeZone, int *dstObserved)
|
||||||
{
|
{
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
time_t t0;
|
time_t t0;
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
time(&t0);
|
time(&t0);
|
||||||
@@ -157,38 +157,41 @@ bool wxGetLocalTime(long *timeZone, int *dstObserved)
|
|||||||
*dstObserved = tp->tm_isdst;
|
*dstObserved = tp->tm_isdst;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if (((defined(__SYSV__) && !defined(__HPUX__)) || defined(__MSDOS__) || defined(__WXMSW__)) \
|
#if (((defined(__SYSV__) && !defined(__HPUX__)) || defined(__MSDOS__) || defined(__WXMSW__) || defined(__WXPM__)) \
|
||||||
&& !defined(__GNUWIN32__) && !defined(__MWERKS__) )
|
&& !defined(__GNUWIN32__) && !defined(__MWERKS__) )
|
||||||
#if defined(__BORLANDC__)
|
# if defined(__BORLANDC__)
|
||||||
/* Borland uses underscores */
|
/* Borland uses underscores */
|
||||||
*timeZone = _timezone;
|
*timeZone = _timezone;
|
||||||
*dstObserved = _daylight;
|
*dstObserved = _daylight;
|
||||||
#elif defined(__SALFORDC__)
|
# elif defined(__SALFORDC__)
|
||||||
*timeZone = _timezone;
|
*timeZone = _timezone;
|
||||||
*dstObserved = daylight;
|
*dstObserved = daylight;
|
||||||
#else
|
# elif defined(__VISAGECPP__)
|
||||||
|
*timeZone = _timezone;
|
||||||
|
*dstObserved = daylight;
|
||||||
|
# else
|
||||||
*timeZone = timezone;
|
*timeZone = timezone;
|
||||||
*dstObserved = daylight;
|
*dstObserved = daylight;
|
||||||
#endif
|
# endif
|
||||||
#elif defined(__xlC__) || defined(__AIX__) || defined(__SVR4__) || defined(__SYSV__) || defined(__MWERKS__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) // || defined(__AIXV3__)
|
#elif defined(__xlC__) || defined(__AIX__) || defined(__SVR4__) || defined(__SYSV__) || defined(__MWERKS__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) // || defined(__AIXV3__)
|
||||||
#ifndef __MWERKS__ // shouldn't this be one scope below ?
|
# ifndef __MWERKS__ // shouldn't this be one scope below ?
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
#endif
|
# endif
|
||||||
#if defined(__SYSV__) || (defined(__GNUWIN32__) && !defined(__MINGW32))
|
# if defined(__SYSV__) || (defined(__GNUWIN32__) && !defined(__MINGW32))
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
gettimeofday(&tp, &tz);
|
gettimeofday(&tp, &tz);
|
||||||
*timeZone = 60*(tz.tz_minuteswest);
|
*timeZone = 60*(tz.tz_minuteswest);
|
||||||
*dstObserved = tz.tz_dsttime;
|
*dstObserved = tz.tz_dsttime;
|
||||||
#else
|
# else
|
||||||
time_t t0;
|
time_t t0;
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
time(&t0);
|
time(&t0);
|
||||||
tp = localtime(&t0);
|
tp = localtime(&t0);
|
||||||
#ifndef __MWERKS__
|
# ifndef __MWERKS__
|
||||||
*timeZone = tp->tm_gmtoff; // ???
|
*timeZone = tp->tm_gmtoff; // ???
|
||||||
#else
|
# else
|
||||||
*timeZone = 0 ;
|
*timeZone = 0 ;
|
||||||
#endif
|
# endif
|
||||||
*dstObserved = tp->tm_isdst;
|
*dstObserved = tp->tm_isdst;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 28/06/98
|
// Created: 28/06/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Guilhem Lavaux
|
// Copyright: (c) Guilhem Lavaux
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ wxChar wxTextInputStream::NextNonWhiteSpace()
|
|||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
if (!m_input) return (wxChar) 0;
|
if (!m_input) return (wxChar) 0;
|
||||||
|
|
||||||
if (c != _T('\n') &&
|
if (c != _T('\n') &&
|
||||||
c != _T('\r') &&
|
c != _T('\r') &&
|
||||||
c != _T('\t') &&
|
c != _T('\t') &&
|
||||||
c != _T(' '))
|
c != _T(' '))
|
||||||
@@ -63,7 +63,7 @@ wxChar wxTextInputStream::NextNonWhiteSpace()
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this shouldn't happen
|
// this shouldn't happen
|
||||||
return (wxChar) 0;
|
return (wxChar) 0;
|
||||||
}
|
}
|
||||||
@@ -71,11 +71,11 @@ wxChar wxTextInputStream::NextNonWhiteSpace()
|
|||||||
void wxTextInputStream::SkipIfEndOfLine( wxChar c )
|
void wxTextInputStream::SkipIfEndOfLine( wxChar c )
|
||||||
{
|
{
|
||||||
if (c == _T('\n'))
|
if (c == _T('\n'))
|
||||||
{
|
{
|
||||||
// eat on UNIX
|
// eat on UNIX
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == _T('\r'))
|
if (c == _T('\r'))
|
||||||
{
|
{
|
||||||
// eat on both Mac and DOS
|
// eat on both Mac and DOS
|
||||||
@@ -84,7 +84,7 @@ void wxTextInputStream::SkipIfEndOfLine( wxChar c )
|
|||||||
if (!m_input) return;
|
if (!m_input) return;
|
||||||
|
|
||||||
if (c2 == _T('\n'))
|
if (c2 == _T('\n'))
|
||||||
{
|
{
|
||||||
// eat on DOS
|
// eat on DOS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -106,32 +106,32 @@ wxUint32 wxTextInputStream::Read32()
|
|||||||
/* I only implemented a simple integer parser */
|
/* I only implemented a simple integer parser */
|
||||||
int sign;
|
int sign;
|
||||||
wxInt32 i;
|
wxInt32 i;
|
||||||
|
|
||||||
int c = NextNonWhiteSpace();
|
int c = NextNonWhiteSpace();
|
||||||
if (!m_input) return 0;
|
if (!m_input) return 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if (! (c == _T('-') || c == _T('+') || isdigit(c)) )
|
if (! (c == _T('-') || c == _T('+') || isdigit(c)) )
|
||||||
{
|
{
|
||||||
m_input->Ungetch(c);
|
m_input->Ungetch(c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == _T('-'))
|
if (c == _T('-'))
|
||||||
{
|
{
|
||||||
sign = -1;
|
sign = -1;
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
} else
|
} else
|
||||||
if (c == _T('+'))
|
if (c == _T('+'))
|
||||||
{
|
{
|
||||||
sign = 1;
|
sign = 1;
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
sign = 1;
|
sign = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (isdigit(c))
|
while (isdigit(c))
|
||||||
{
|
{
|
||||||
i = i*10 + (c - (int)_T('0'));
|
i = i*10 + (c - (int)_T('0'));
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
@@ -164,54 +164,54 @@ double wxTextInputStream::ReadDouble()
|
|||||||
if (!m_input) return 0.0;
|
if (!m_input) return 0.0;
|
||||||
|
|
||||||
f = 0.0;
|
f = 0.0;
|
||||||
if (! (c == _T('.') || c == _T('-') || c == _T('+') || isdigit(c)) )
|
if (! (c == _T('.') || c == _T('-') || c == _T('+') || isdigit(c)) )
|
||||||
{
|
{
|
||||||
m_input->Ungetch(c);
|
m_input->Ungetch(c);
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == _T('-'))
|
if (c == _T('-'))
|
||||||
{
|
{
|
||||||
sign = -1;
|
sign = -1;
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
} else
|
} else
|
||||||
if (c == _T('+'))
|
if (c == _T('+'))
|
||||||
{
|
{
|
||||||
sign = 1;
|
sign = 1;
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sign = 1;
|
sign = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (isdigit(c))
|
while (isdigit(c))
|
||||||
{
|
{
|
||||||
f = f*10 + (c - _T('0'));
|
f = f*10 + (c - _T('0'));
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == _T('.'))
|
if (c == _T('.'))
|
||||||
{
|
{
|
||||||
double f_multiplicator = (double) 0.1;
|
double f_multiplicator = (double) 0.1;
|
||||||
|
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
|
|
||||||
while (isdigit(c))
|
while (isdigit(c))
|
||||||
{
|
{
|
||||||
f += (c-_T('0'))*f_multiplicator;
|
f += (c-_T('0'))*f_multiplicator;
|
||||||
f_multiplicator /= 10;
|
f_multiplicator /= 10;
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == _T('e'))
|
if (c == _T('e'))
|
||||||
{
|
{
|
||||||
double f_multiplicator = 0.0;
|
double f_multiplicator = 0.0;
|
||||||
int i, e;
|
int i, e;
|
||||||
|
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
|
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case _T('-'): f_multiplicator = 0.1; break;
|
case _T('-'): f_multiplicator = 0.1; break;
|
||||||
case _T('+'): f_multiplicator = 10.0; break;
|
case _T('+'): f_multiplicator = 10.0; break;
|
||||||
@@ -221,7 +221,7 @@ double wxTextInputStream::ReadDouble()
|
|||||||
|
|
||||||
for (i=0;i<e;i++)
|
for (i=0;i<e;i++)
|
||||||
f *= f_multiplicator;
|
f *= f_multiplicator;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SkipIfEndOfLine( c );
|
SkipIfEndOfLine( c );
|
||||||
}
|
}
|
||||||
@@ -240,7 +240,7 @@ wxString wxTextInputStream::ReadString()
|
|||||||
wxChar c;
|
wxChar c;
|
||||||
wxString line;
|
wxString line;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
c = m_input->GetC();
|
c = m_input->GetC();
|
||||||
if (!m_input) break;
|
if (!m_input) break;
|
||||||
@@ -254,12 +254,12 @@ wxString wxTextInputStream::ReadString()
|
|||||||
if (c == _T('\r'))
|
if (c == _T('\r'))
|
||||||
{
|
{
|
||||||
// eat on both Mac and DOS
|
// eat on both Mac and DOS
|
||||||
|
|
||||||
wxChar c2 = m_input->GetC();
|
wxChar c2 = m_input->GetC();
|
||||||
if (!m_input) break;
|
if (!m_input) break;
|
||||||
|
|
||||||
if (c2 == _T('\n'))
|
if (c2 == _T('\n'))
|
||||||
{
|
{
|
||||||
// eat on DOS
|
// eat on DOS
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -273,10 +273,10 @@ wxString wxTextInputStream::ReadString()
|
|||||||
|
|
||||||
line += c;
|
line += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextInputStream& wxTextInputStream::operator>>(wxString& line)
|
wxTextInputStream& wxTextInputStream::operator>>(wxString& line)
|
||||||
{
|
{
|
||||||
line = ReadString();
|
line = ReadString();
|
||||||
@@ -291,13 +291,13 @@ wxTextInputStream& wxTextInputStream::operator>>(wxChar& c)
|
|||||||
c = (wxChar) 0;
|
c = (wxChar) 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c1 == _T('\r'))
|
if (c1 == _T('\r'))
|
||||||
{
|
{
|
||||||
c = _T('\n');
|
c = _T('\n');
|
||||||
wxChar c2 = m_input->GetC();
|
wxChar c2 = m_input->GetC();
|
||||||
if (!m_input) return *this;
|
if (!m_input) return *this;
|
||||||
|
|
||||||
if (c2 != _T('\n'))
|
if (c2 != _T('\n'))
|
||||||
{
|
{
|
||||||
// we are on a Mac
|
// we are on a Mac
|
||||||
@@ -308,7 +308,7 @@ wxTextInputStream& wxTextInputStream::operator>>(wxChar& c)
|
|||||||
{
|
{
|
||||||
c = c1;
|
c = c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ void wxTextOutputStream::Write32(wxUint32 i)
|
|||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf(_T("%u"), i);
|
str.Printf(_T("%u"), i);
|
||||||
|
|
||||||
WriteString(str);
|
WriteString(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ void wxTextOutputStream::Write16(wxUint16 i)
|
|||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf(_T("%u"), i);
|
str.Printf(_T("%u"), i);
|
||||||
|
|
||||||
WriteString(str);
|
WriteString(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ void wxTextOutputStream::Write8(wxUint8 i)
|
|||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf(_T("%u"), i);
|
str.Printf(_T("%u"), i);
|
||||||
|
|
||||||
WriteString(str);
|
WriteString(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,6 +407,11 @@ void wxTextOutputStream::WriteString(const wxString& string)
|
|||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
c = _T('\r');
|
c = _T('\r');
|
||||||
m_output->Write( (const void*)(&c), sizeof(wxChar) );
|
m_output->Write( (const void*)(&c), sizeof(wxChar) );
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
c = _T('\r');
|
||||||
|
m_output->Write( (const void*)(&c), sizeof(wxChar) );
|
||||||
|
c = _T('\n');
|
||||||
|
m_output->Write( (const void*)(&c), sizeof(wxChar) );
|
||||||
#else
|
#else
|
||||||
#error "wxTextOutputStream: unsupported platform."
|
#error "wxTextOutputStream: unsupported platform."
|
||||||
#endif
|
#endif
|
||||||
|
@@ -177,6 +177,10 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
#endif /* __WXMSW__ */
|
#endif /* __WXMSW__ */
|
||||||
|
|
||||||
|
#ifdef __WXPM__
|
||||||
|
#define strcasecmp stricmp
|
||||||
|
#define strncasecmp strnicmp
|
||||||
|
#endif
|
||||||
|
|
||||||
wxChar *
|
wxChar *
|
||||||
copystring (const wxChar *s)
|
copystring (const wxChar *s)
|
||||||
|
Reference in New Issue
Block a user