wx/math.h integration
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,7 +32,8 @@
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "wx/math.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wx/string.h"
|
||||
|
@@ -42,8 +42,9 @@ hack doesn't fix.
|
||||
#include "wx/wx.h"
|
||||
#endif //precompiled headers
|
||||
|
||||
#include "wx/math.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#define Random(x) (rand() % x)
|
||||
|
@@ -3260,8 +3260,7 @@ static void TestZipFileSystem()
|
||||
|
||||
#ifdef TEST_DATETIME
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "wx/math.h"
|
||||
#include "wx/datetime.h"
|
||||
|
||||
// this test miscellaneous static wxDateTime functions
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "wx/timer.h"
|
||||
#include "wx/glcanvas.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
||||
# ifdef __DARWIN__
|
||||
@@ -55,8 +56,6 @@
|
||||
|
||||
// The following part is taken largely unchanged from the original C Version
|
||||
|
||||
#include <math.h>
|
||||
|
||||
GLboolean speed_test = GL_FALSE;
|
||||
GLboolean use_vertex_arrays = GL_FALSE;
|
||||
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include "lw.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#if wxUSE_GLCANVAS
|
||||
|
||||
|
@@ -32,8 +32,7 @@
|
||||
#include "wx/image.h"
|
||||
#include "wx/imaglist.h"
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
#include "math.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#ifdef __WIN32__
|
||||
// this is not supported by native control
|
||||
@@ -411,7 +410,7 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
|
||||
static wxString s_text;
|
||||
s_text = wxGetTextFromUser(wxT("New name: "), wxT("Tree sample question"),
|
||||
s_text, this);
|
||||
if ( !s_text.IsEmpty() )
|
||||
if ( !s_text.empty() )
|
||||
{
|
||||
m_treeCtrl->SetItemText(item, s_text);
|
||||
}
|
||||
|
@@ -39,9 +39,9 @@
|
||||
#include "wx/textfile.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h> // for INT_MAX
|
||||
|
||||
@@ -234,13 +234,13 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer,
|
||||
wxString strPath = strEntry.BeforeLast(wxCONFIG_PATH_SEPARATOR);
|
||||
|
||||
// except in the special case of "/keyname" when there is nothing before "/"
|
||||
if ( strPath.IsEmpty() &&
|
||||
((!strEntry.IsEmpty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) )
|
||||
if ( strPath.empty() &&
|
||||
((!strEntry.empty()) && strEntry[0] == wxCONFIG_PATH_SEPARATOR) )
|
||||
{
|
||||
strPath = wxCONFIG_PATH_SEPARATOR;
|
||||
}
|
||||
|
||||
if ( !strPath.IsEmpty() )
|
||||
if ( !strPath.empty() )
|
||||
{
|
||||
if ( m_pContainer->GetPath() != strPath )
|
||||
{
|
||||
@@ -433,7 +433,7 @@ void wxSplitPath(wxArrayString& aParts, const wxChar *sz)
|
||||
|
||||
strCurrent.Empty();
|
||||
}
|
||||
else if ( !strCurrent.IsEmpty() ) {
|
||||
else if ( !strCurrent.empty() ) {
|
||||
aParts.push_back(strCurrent);
|
||||
strCurrent.Empty();
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
#if wxUSE_APPLE_IEEE
|
||||
|
||||
#include <math.h>
|
||||
#include "wx/math.h"
|
||||
|
||||
/* Copyright (C) 1989-1991 Ken Turkowski. <turk@computer.org>
|
||||
*
|
||||
@@ -42,13 +42,13 @@
|
||||
* 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
|
||||
* Sequent Balance (Multiprocesor 386)
|
||||
* NeXT
|
||||
* 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
|
||||
* Sequent Balance (Multiprocesor 386)
|
||||
* NeXT
|
||||
*
|
||||
*
|
||||
* Implemented by Malcolm Slaney and Ken Turkowski.
|
||||
@@ -77,12 +77,12 @@
|
||||
* Silicon Graphics MIPS-based Iris.
|
||||
****************************************************************/
|
||||
|
||||
#ifdef applec /* The Apple C compiler works */
|
||||
# define FloatToUnsigned(f) ((wxUint32)(f))
|
||||
# define UnsignedToFloat(u) ((wxFloat64)(u))
|
||||
#ifdef applec /* The Apple C compiler works */
|
||||
# define FloatToUnsigned(f) ((wxUint32)(f))
|
||||
# define UnsignedToFloat(u) ((wxFloat64)(u))
|
||||
#else /*applec*/
|
||||
# define FloatToUnsigned(f) ((wxUint32)(((wxInt32)((f) - 2147483648.0)) + 2147483647L) + 1)
|
||||
# define UnsignedToFloat(u) (((wxFloat64)((wxInt32)((u) - 2147483647L - 1))) + 2147483648.0)
|
||||
# define FloatToUnsigned(f) ((wxUint32)(((wxInt32)((f) - 2147483648.0)) + 2147483647L) + 1)
|
||||
# define UnsignedToFloat(u) (((wxFloat64)((wxInt32)((u) - 2147483647L - 1))) + 2147483648.0)
|
||||
#endif /*applec*/
|
||||
|
||||
|
||||
@@ -96,38 +96,38 @@
|
||||
|
||||
wxFloat64 ConvertFromIeeeExtended(wxInt8* bytes)
|
||||
{
|
||||
wxFloat64 f;
|
||||
wxInt32 expon;
|
||||
wxUint32 hiMant, loMant;
|
||||
wxFloat64 f;
|
||||
wxInt32 expon;
|
||||
wxUint32 hiMant, loMant;
|
||||
|
||||
expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF);
|
||||
hiMant = ((wxUint32)(bytes[2] & 0xFF) << 24)
|
||||
| ((wxUint32)(bytes[3] & 0xFF) << 16)
|
||||
| ((wxUint32)(bytes[4] & 0xFF) << 8)
|
||||
| ((wxUint32)(bytes[5] & 0xFF));
|
||||
loMant = ((wxUint32)(bytes[6] & 0xFF) << 24)
|
||||
| ((wxUint32)(bytes[7] & 0xFF) << 16)
|
||||
| ((wxUint32)(bytes[8] & 0xFF) << 8)
|
||||
| ((wxUint32)(bytes[9] & 0xFF));
|
||||
expon = ((bytes[0] & 0x7F) << 8) | (bytes[1] & 0xFF);
|
||||
hiMant = ((wxUint32)(bytes[2] & 0xFF) << 24)
|
||||
| ((wxUint32)(bytes[3] & 0xFF) << 16)
|
||||
| ((wxUint32)(bytes[4] & 0xFF) << 8)
|
||||
| ((wxUint32)(bytes[5] & 0xFF));
|
||||
loMant = ((wxUint32)(bytes[6] & 0xFF) << 24)
|
||||
| ((wxUint32)(bytes[7] & 0xFF) << 16)
|
||||
| ((wxUint32)(bytes[8] & 0xFF) << 8)
|
||||
| ((wxUint32)(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 (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;
|
||||
if (bytes[0] & 0x80)
|
||||
return -f;
|
||||
else
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,48 +136,48 @@ wxFloat64 ConvertFromIeeeExtended(wxInt8* bytes)
|
||||
|
||||
void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes)
|
||||
{
|
||||
wxInt32 sign;
|
||||
wxInt32 expon;
|
||||
wxFloat64 fMant, fsMant;
|
||||
wxUint32 hiMant, loMant;
|
||||
wxInt32 sign;
|
||||
wxInt32 expon;
|
||||
wxFloat64 fMant, fsMant;
|
||||
wxUint32 hiMant, loMant;
|
||||
|
||||
if (num < 0) {
|
||||
sign = 0x8000;
|
||||
num *= -1;
|
||||
} else {
|
||||
sign = 0;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -33,10 +33,10 @@
|
||||
#include "wx/module.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
// For memcpy
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __SALFORDC__
|
||||
#undef FAR
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#if wxUSE_LONGLONG
|
||||
#include "wx/longlong.h"
|
||||
#include "wx/math.h" // for fabs()
|
||||
|
||||
#if defined(__MWERKS__) && defined(__WXMSW__)
|
||||
#include <string.h> // for memset()
|
||||
@@ -34,8 +35,6 @@
|
||||
#include <memory.h> // for memset()
|
||||
#endif
|
||||
|
||||
#include <math.h> // for fabs()
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
@@ -39,8 +39,7 @@
|
||||
#include "wx/generic/prntdlgg.h"
|
||||
#include "wx/paper.h"
|
||||
#include "wx/filefn.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "wx/math.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
|
@@ -69,14 +69,13 @@
|
||||
#endif // HAVE_NATIVE_LISTCTRL/!HAVE_NATIVE_LISTCTRL
|
||||
|
||||
#include "wx/selstore.h"
|
||||
|
||||
#include "wx/renderer.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#include "wx/mac/private.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
// NOTE: If using the wxListBox visual attributes works everywhere then this can
|
||||
|
@@ -30,7 +30,8 @@
|
||||
#include "wx/settings.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include "wx/math.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "wx/dcscreen.h"
|
||||
|
@@ -31,8 +31,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "wx/math.h"
|
||||
#include "wx/tab.h"
|
||||
#include "wx/listimpl.cpp"
|
||||
|
||||
|
@@ -36,8 +36,8 @@
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
FORCE_LINK_ME(m_image)
|
||||
@@ -572,7 +572,7 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y,
|
||||
|
||||
wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
|
||||
{
|
||||
if (m_mapName.IsEmpty())
|
||||
if (m_mapName.empty())
|
||||
return wxHtmlCell::GetLink( x, y );
|
||||
if (!m_imageMap)
|
||||
{
|
||||
|
@@ -47,12 +47,12 @@
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/colordlg.h"
|
||||
#include "wx/cmndata.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#if !defined(__WIN32__) || defined(__WXWINCE__)
|
||||
#include <commdlg.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@@ -46,7 +46,7 @@
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/msw/printdlg.h"
|
||||
#include "math.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#if wxUSE_COMMON_DIALOGS
|
||||
#include <commdlg.h>
|
||||
@@ -182,7 +182,7 @@ bool wxPrinterDC::StartDoc(const wxString& message)
|
||||
|
||||
wxString filename(m_printData.GetFilename());
|
||||
|
||||
if (filename.IsEmpty())
|
||||
if (filename.empty())
|
||||
docinfo.lpszOutput = NULL;
|
||||
else
|
||||
docinfo.lpszOutput = (const wxChar *) filename;
|
||||
|
@@ -46,12 +46,12 @@
|
||||
#include <commdlg.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "wx/filename.h"
|
||||
#include "wx/tokenzr.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#include "wx/msw/missing.h"
|
||||
|
||||
|
@@ -45,8 +45,8 @@
|
||||
|
||||
#include "wx/cmndata.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/math.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@@ -31,8 +31,7 @@
|
||||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/ole/oleutils.h"
|
||||
#include "wx/msw/ole/automtn.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "wx/math.h"
|
||||
|
||||
#ifdef __WXWINCE__
|
||||
#include "wx/msw/wince/time.h"
|
||||
|
@@ -23,8 +23,7 @@
|
||||
|
||||
#include "wx/datstrm.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
#include <math.h> //HUGE
|
||||
#include "wx/math.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// test class
|
||||
|
Reference in New Issue
Block a user