Some rearrangement/naming of utility functions due to name clashes in

Visual Studio 2005.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1335 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2007-07-31 15:46:21 +00:00
parent 06ebb24bb6
commit ea790eda33
16 changed files with 55 additions and 57 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DataGridWidget.cxx,v 1.10 2007-01-01 18:04:43 stephena Exp $ // $Id: DataGridWidget.cxx,v 1.11 2007-07-31 15:46:20 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -170,8 +170,8 @@ void DataGridWidget::setSelectedValue(int value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setRange(int lower, int upper) void DataGridWidget::setRange(int lower, int upper)
{ {
_lowerBound = MAX(0, lower); _lowerBound = BSPF_max(0, lower);
_upperBound = MIN(1 << _bits, upper); _upperBound = BSPF_min(1 << _bits, upper);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: PromptWidget.cxx,v 1.16 2007-06-21 12:27:00 stephena Exp $ // $Id: PromptWidget.cxx,v 1.17 2007-07-31 15:46:20 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -731,7 +731,7 @@ void PromptWidget::nextLine()
// Call this (at least) when the current line changes or when a new line is added // Call this (at least) when the current line changes or when a new line is added
void PromptWidget::updateScrollBuffer() void PromptWidget::updateScrollBuffer()
{ {
int lastchar = MAX(_promptEndPos, _currentPos); int lastchar = BSPF_max(_promptEndPos, _currentPos);
int line = lastchar / _lineWidth; int line = lastchar / _lineWidth;
int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer; int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer;
int firstline = line - numlines + 1; int firstline = line - numlines + 1;

View File

@ -7,7 +7,10 @@
should be made in stella.pro, and then this file should be should be made in stella.pro, and then this file should be
regenerated and the application recompiled. regenerated and the application recompiled.
*/ */
static const char* DefProps[2722][21] = {
#define DEF_PROPS_SIZE 2722
static const char* DefProps[DEF_PROPS_SIZE][21] = {
{ "000509d1ed2b8d30a9d94be1b3b5febb", "", "", "Jungle Jane (2003) (Greg Zumwalt) (Pitfall! Hack)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "000509d1ed2b8d30a9d94be1b3b5febb", "", "", "Jungle Jane (2003) (Greg Zumwalt) (Pitfall! Hack)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "007d18dedc1f0565f09c42aa61a6f585", "CCE", "", "Worm War I (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "007d18dedc1f0565f09c42aa61a6f585", "CCE", "", "Worm War I (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "008543ae43497af015e9428a5e3e874e", "Retroactive", "", "Qb (V2.09) (PAL) (2001) (Retroactive)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" }, { "008543ae43497af015e9428a5e3e874e", "Retroactive", "", "Qb (V2.09) (PAL) (2001) (Retroactive)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "" },

View File

@ -14,7 +14,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.cxx,v 1.203 2007-06-20 16:33:22 stephena Exp $ // $Id: EventHandler.cxx,v 1.204 2007-07-31 15:46:20 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -860,7 +860,7 @@ void EventHandler::handleMouseMotionEvent(SDL_Event& event)
// Grabmouse introduces some lag into the mouse movement, // Grabmouse introduces some lag into the mouse movement,
// so we need to fudge the numbers a bit // so we need to fudge the numbers a bit
if(myGrabMouseFlag) x = MIN(w, (int) (x * 1.5)); if(myGrabMouseFlag) x = BSPF_min(w, (int) (x * 1.5));
int resistance = (int)(1000000.0 * (w - x) / w); int resistance = (int)(1000000.0 * (w - x) / w);
myEvent->set(Paddle_Resistance[myPaddleMode], resistance); myEvent->set(Paddle_Resistance[myPaddleMode], resistance);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FSNode.cxx,v 1.9 2007-01-19 21:53:26 stephena Exp $ // $Id: FSNode.cxx,v 1.10 2007-07-31 15:46:20 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ void FSList::sort()
min = j; min = j;
} }
if (min != i) if (min != i)
SWAP(_data[min], _data[i]); BSPF_swap(_data[min], _data[i]);
} }
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBuffer.cxx,v 1.119 2007-07-11 15:08:10 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.120 2007-07-31 15:46:20 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -671,7 +671,7 @@ void FrameBuffer::drawString(const GUI::Font* font, const string& s,
uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2) uInt8 FrameBuffer::getPhosphor(uInt8 c1, uInt8 c2)
{ {
if(c2 > c1) if(c2 > c1)
SWAP(c1, c2); BSPF_swap(c1, c2);
return ((c1 - c2) * myPhosphorBlend)/100 + c2; return ((c1 - c2) * myPhosphorBlend)/100 + c2;
} }
@ -779,8 +779,8 @@ VideoMode FrameBuffer::getSavedVidMode()
{ {
int lw, lh; int lw, lh;
myOSystem->settings().getSize("launcherres", lw, lh); myOSystem->settings().getSize("launcherres", lw, lh);
w = MAX(w, lw); w = BSPF_max(w, lw);
h = MAX(h, lh); h = BSPF_max(h, lh);
} }
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
else if(state == EventHandler::S_DEBUGGER) else if(state == EventHandler::S_DEBUGGER)

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: PropsSet.cxx,v 1.33 2007-07-19 16:21:39 stephena Exp $ // $Id: PropsSet.cxx,v 1.34 2007-07-31 15:46:20 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -79,7 +79,7 @@ void PropertiesSet::getMD5(const string& md5, Properties& properties,
// Otherwise, search the internal database using binary search // Otherwise, search the internal database using binary search
if(!found) if(!found)
{ {
int low = 0, high = ARRAYSIZE(DefProps) - 1; int low = 0, high = DEF_PROPS_SIZE - 1;
while(low <= high) while(low <= high)
{ {
int i = (low + high) / 2; int i = (low + high) / 2;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: bspf.hxx,v 1.16 2007-07-19 16:21:39 stephena Exp $ // $Id: bspf.hxx,v 1.17 2007-07-31 15:46:21 stephena Exp $
//============================================================================ //============================================================================
#ifndef BSPF_HXX #ifndef BSPF_HXX
@ -24,7 +24,7 @@
that need to be defined for different operating systems. that need to be defined for different operating systems.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: bspf.hxx,v 1.16 2007-07-19 16:21:39 stephena Exp $ @version $Id: bspf.hxx,v 1.17 2007-07-31 15:46:21 stephena Exp $
*/ */
// Types for 8-bit signed and unsigned integers // Types for 8-bit signed and unsigned integers
@ -82,6 +82,12 @@ typedef unsigned int uInt32;
#define BSPF_vsnprintf vsnprintf #define BSPF_vsnprintf vsnprintf
#endif #endif
// Some convenience functions
template<typename T> inline void BSPF_swap(T &a, T &b) { T tmp = a; a = b; b = tmp; }
template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; }
template<typename T> inline T BSPF_min (T a, T b) { return (a<b) ? a : b; }
template<typename T> inline T BSPF_max (T a, T b) { return (a>b) ? a : b; }
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
#include "missing.h" #include "missing.h"
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CheckListWidget.cxx,v 1.13 2007-01-01 18:04:52 stephena Exp $ // $Id: CheckListWidget.cxx,v 1.14 2007-07-31 15:46:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -31,7 +31,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
// rowheight is determined by largest item on a line, // rowheight is determined by largest item on a line,
// possibly meaning that number of rows will change // possibly meaning that number of rows will change
_fontHeight = MAX(_fontHeight, CheckboxWidget::boxSize()); _fontHeight = BSPF_max(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _fontHeight; _rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list // Create a CheckboxWidget for each row in the list

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DialogContainer.cxx,v 1.36 2007-01-01 18:04:52 stephena Exp $ // $Id: DialogContainer.cxx,v 1.37 2007-07-31 15:46:21 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -210,8 +210,8 @@ void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y, uInt8
} }
if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay) if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay)
&& ABS(myLastClick.x - x) < 3 && BSPF_abs(myLastClick.x - x) < 3
&& ABS(myLastClick.y - y) < 3) && BSPF_abs(myLastClick.y - y) < 3)
{ {
myLastClick.count++; myLastClick.count++;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: GuiUtils.hxx,v 1.26 2007-01-01 18:04:53 stephena Exp $ // $Id: GuiUtils.hxx,v 1.27 2007-07-31 15:46:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ... Probably not very neat, but at least it works ...
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.26 2007-01-01 18:04:53 stephena Exp $ @version $Id: GuiUtils.hxx,v 1.27 2007-07-31 15:46:21 stephena Exp $
*/ */
#define kScrollBarWidth 9 #define kScrollBarWidth 9
@ -50,17 +50,4 @@ enum {
static const string EmptyString(""); static const string EmptyString("");
template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
template<typename T> inline T ABS (T x) { return (x>=0) ? x : -x; }
#if !defined(MIN)
template<typename T> inline T MIN (T a, T b) { return (a<b) ? a : b; }
#endif
#if !defined(MAX)
template<typename T> inline T MAX (T a, T b) { return (a>b) ? a : b; }
#endif
#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Launcher.cxx,v 1.16 2007-07-11 15:08:13 stephena Exp $ // $Id: Launcher.cxx,v 1.17 2007-07-31 15:46:21 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -34,14 +34,14 @@ Launcher::Launcher(OSystem* osystem)
{ {
int w, h; int w, h;
myOSystem->settings().getSize("launcherres", w, h); myOSystem->settings().getSize("launcherres", w, h);
myWidth = MAX(w, 0); myWidth = BSPF_max(w, 0);
myHeight = MAX(h, 0); myHeight = BSPF_max(h, 0);
// Error check the resolution // Error check the resolution
myWidth = MAX(myWidth, 320u); myWidth = BSPF_max(myWidth, 320u);
myWidth = MIN(myWidth, osystem->desktopWidth()); myWidth = BSPF_min(myWidth, osystem->desktopWidth());
myHeight = MAX(myHeight, 240u); myHeight = BSPF_max(myHeight, 240u);
myHeight = MIN(myHeight, osystem->desktopHeight()); myHeight = BSPF_min(myHeight, osystem->desktopHeight());
myOSystem->settings().setSize("launcherres", myWidth, myHeight); myOSystem->settings().setSize("launcherres", myWidth, myHeight);
myBaseDialog = new LauncherDialog(myOSystem, this, 0, 0, myWidth, myHeight); myBaseDialog = new LauncherDialog(myOSystem, this, 0, 0, myWidth, myHeight);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Rect.hxx,v 1.4 2007-01-01 18:04:54 stephena Exp $ // $Id: Rect.hxx,v 1.5 2007-07-31 15:46:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -22,7 +22,7 @@
#ifndef RECT_HXX #ifndef RECT_HXX
#define RECT_HXX #define RECT_HXX
#include "GuiUtils.hxx" #include "bspf.hxx"
namespace GUI { namespace GUI {
@ -119,10 +119,10 @@ struct Rect
@param r the rectangle to extend by @param r the rectangle to extend by
*/ */
void extend(const Rect & r) { void extend(const Rect & r) {
left = MIN(left, r.left); left = BSPF_min(left, r.left);
right = MAX(right, r.right); right = BSPF_max(right, r.right);
top = MIN(top, r.top); top = BSPF_min(top, r.top);
bottom = MAX(bottom, r.bottom); bottom = BSPF_max(bottom, r.bottom);
} }
/*! @brief extend this rectangle in all four directions by the given number of pixels /*! @brief extend this rectangle in all four directions by the given number of pixels

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: UIDialog.cxx,v 1.4 2007-06-20 16:33:23 stephena Exp $ // $Id: UIDialog.cxx,v 1.5 2007-07-31 15:46:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -158,8 +158,8 @@ void UIDialog::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void UIDialog::setDefaults() void UIDialog::setDefaults()
{ {
int w = MIN(instance()->desktopWidth(), (const uInt32) 400); int w = BSPF_min(instance()->desktopWidth(), (const uInt32) 400);
int h = MIN(instance()->desktopHeight(), (const uInt32) 300); int h = BSPF_min(instance()->desktopHeight(), (const uInt32) 300);
myLauncherWidthSlider->setValue(w); myLauncherWidthSlider->setValue(w);
myLauncherWidthLabel->setValue(w); myLauncherWidthLabel->setValue(w);
myLauncherHeightSlider->setValue(h); myLauncherHeightSlider->setValue(h);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Widget.cxx,v 1.49 2007-06-20 16:33:23 stephena Exp $ // $Id: Widget.cxx,v 1.50 2007-07-31 15:46:21 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -88,7 +88,7 @@ void Widget::draw()
int colorA = kColor; int colorA = kColor;
int colorB = kShadowColor; int colorB = kShadowColor;
if((_flags & WIDGET_INV_BORDER) == WIDGET_INV_BORDER) if((_flags & WIDGET_INV_BORDER) == WIDGET_INV_BORDER)
SWAP(colorA, colorB); BSPF_swap(colorA, colorB);
fb.box(_x, _y, _w, _h, colorA, colorB); fb.box(_x, _y, _w, _h, colorA, colorB);
_x += 4; _x += 4;
_y += 4; _y += 4;

View File

@ -104,7 +104,9 @@ print OUTFILE " located in the src/tools directory. All properties changes\n";
print OUTFILE " should be made in stella.pro, and then this file should be\n"; print OUTFILE " should be made in stella.pro, and then this file should be\n";
print OUTFILE " regenerated and the application recompiled.\n"; print OUTFILE " regenerated and the application recompiled.\n";
print OUTFILE "*/\n"; print OUTFILE "*/\n";
print OUTFILE "static const char* DefProps[" . $size . "][" . keys( %proptype ) . "] = {\n"; print OUTFILE "\n#define DEF_PROPS_SIZE " . $size;
print OUTFILE "\n\n";
print OUTFILE "static const char* DefProps[DEF_PROPS_SIZE][" . keys( %proptype ) . "] = {\n";
my $idx = 0; my $idx = 0;
for my $key ( sort keys %propset ) for my $key ( sort keys %propset )