[dasher] g/c DASHER_WIN32 and DASHER_WINCE, therefore Platform.h



commit eaa5f3bbb2435e6fcd31dae26041c50c73c24686
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Sep 28 11:30:03 2012 +0100

    g/c DASHER_WIN32 and DASHER_WINCE, therefore Platform.h
    
    Conjecture: Windows programmers are used to _WIN32 being defined by the
    compiler and simply use it rather than hunting for the DASHER_* defines
    in Platform.h. Evidence for this is e.g. DASHER_WINCE and _WIN32_WCE
    being used in the same way in DasherWindow.cpp.

 Src/Common/AppSettingsData.h                       |    2 +-
 Src/Common/AppSettingsHeader.h                     |    2 +-
 Src/Common/Common.h                                |    7 +---
 Src/Common/I18n.h                                  |    2 +-
 Src/Common/Makefile.am                             |    1 -
 Src/Common/Platform.h                              |   27 --------------------
 Src/Common/Platform/stdminmax.h                    |    4 +-
 Src/Common/Random.h                                |    2 -
 Src/Common/Trace.cpp                               |    3 +-
 Src/Common/Types/int.h                             |    4 +--
 Src/Common/myassert.h                              |   14 ++++------
 Src/DasherCore/Alphabet/AlphIO.cpp                 |    4 +-
 Src/DasherCore/Alphabet/AlphabetMap.h              |    2 +-
 .../LanguageModelling/DictLanguageModel.cpp        |    2 +-
 .../LanguageModelling/WordLanguageModel.cpp        |    2 +-
 Src/Win32/AppSettings.cpp                          |    2 +-
 Src/Win32/AppSettings.h                            |    2 +-
 Src/Win32/Common/WinCommon.h                       |    2 +-
 Src/Win32/Common/WinHelper.cpp                     |    2 +-
 Src/Win32/Common/WinOptions.cpp                    |    2 +-
 Src/Win32/Common/WinOptions.h                      |    2 +-
 Src/Win32/DasherWindow.cpp                         |    6 ++--
 Src/Win32/Widgets/Edit.cpp                         |    4 +-
 Src/Win32/Widgets/FilenameGUI.cpp                  |    4 +-
 Src/Win32/Widgets/Screen.inl                       |    2 +-
 Src/Win32/Widgets/SplashScreen.cpp                 |    4 +-
 26 files changed, 36 insertions(+), 74 deletions(-)
---
diff --git a/Src/Common/AppSettingsData.h b/Src/Common/AppSettingsData.h
index e159871..399c2f4 100644
--- a/Src/Common/AppSettingsData.h
+++ b/Src/Common/AppSettingsData.h
@@ -87,7 +87,7 @@ app_sp_table app_stringparamtable[] = {
 #else
   {APP_SP_EDIT_FONT, "EditFont", PERS, "Sans 10", NULL, "EditFont"},
 #endif
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   {APP_SP_WINDOW_STATE, "WindowState", PERS, "", NULL, "WindowState"},
 #endif
 };
diff --git a/Src/Common/AppSettingsHeader.h b/Src/Common/AppSettingsHeader.h
index fede1dc..7024a47 100644
--- a/Src/Common/AppSettingsHeader.h
+++ b/Src/Common/AppSettingsHeader.h
@@ -26,7 +26,7 @@ enum {
 
 enum {
   APP_SP_EDIT_FONT = END_OF_APP_LPS, 
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   APP_SP_WINDOW_STATE, 
 #endif
   END_OF_APP_SPS
diff --git a/Src/Common/Common.h b/Src/Common/Common.h
index fbc4f09..c538acf 100644
--- a/Src/Common/Common.h
+++ b/Src/Common/Common.h
@@ -19,12 +19,9 @@
 #include <config.h>
 #endif
 
-// Deduce the platform, setting macros of the form DASHER_......
-#include "Platform.h"
-
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef DASHER_WIN32
+#ifdef _WIN32
 #include "MSVC_Unannoy.h"
 #endif
 
@@ -32,7 +29,7 @@
 
 // Set up any platform deficiencies
 
-#if DASHER_WIN32 < 1300
+#if _MSC_VER < 1300
 #include "Platform/stdminmax.h"
 #endif
 
diff --git a/Src/Common/I18n.h b/Src/Common/I18n.h
index 246a8b5..2b4f955 100644
--- a/Src/Common/I18n.h
+++ b/Src/Common/I18n.h
@@ -21,7 +21,7 @@
 #ifndef __i18n_h__
 #define __i18n_h__
 
-#if defined(DASHER_WIN32) || defined(__APPLE__)
+#if defined(_WIN32) || defined(__APPLE__)
 
 #define _(szText) szText
 #define N_(szText) (szText)
diff --git a/Src/Common/Makefile.am b/Src/Common/Makefile.am
index 6ecafdf..b5cb4a7 100644
--- a/Src/Common/Makefile.am
+++ b/Src/Common/Makefile.am
@@ -12,7 +12,6 @@ libdashermisc_a_SOURCES = \
 		mydebug.h \
 		ModuleSettings.h \
 		NoClones.h \
-		Platform.h \
 		Random.h \
                 Trace.cpp \
 		Trace.h \
diff --git a/Src/Common/Platform/stdminmax.h b/Src/Common/Platform/stdminmax.h
index 86f89fd..e7206d1 100644
--- a/Src/Common/Platform/stdminmax.h
+++ b/Src/Common/Platform/stdminmax.h
@@ -9,7 +9,7 @@
 #ifndef __Platform_stdminmax__
 #define __Platform_stdminmax__
 
-#if ( defined DASHER_WIN32 ) && ( DASHER_WIN32 < 1300 )
+#if _MSC_VER < 1300
 
 namespace std {
   template < typename T > inline T min(T t1, T t2) {
@@ -21,4 +21,4 @@ namespace std {
 };
 #endif
 
-#endif // __include__
+#endif // __Platform_stdminmax__
diff --git a/Src/Common/Random.h b/Src/Common/Random.h
index fcfe71f..767c6f9 100644
--- a/Src/Common/Random.h
+++ b/Src/Common/Random.h
@@ -5,8 +5,6 @@
 #ifndef __Random_h__
 #define __Random_h__
 
-#include "Platform.h"
-
 // Provide platform-independent interfaces for random number generation
 
 // int RandomInt()
diff --git a/Src/Common/Trace.cpp b/Src/Common/Trace.cpp
index 2b284cd..b3a0d68 100644
--- a/Src/Common/Trace.cpp
+++ b/Src/Common/Trace.cpp
@@ -5,7 +5,6 @@
 #include "Common.h"
 
 #include "Trace.h"
-#include "Platform.h"
 
 // Track memory leaks on Windows to the line that new'd the memory
 #ifdef _WIN32
@@ -19,7 +18,7 @@ static char THIS_FILE[] = __FILE__;
 
 // Customize behaviour of Trace here
 
-#ifdef DASHER_WIN32
+#ifdef _WIN32
 
         // On Windows, send Trace to the Debug window in DevStudio
         // The ATL/MFC Trace application also picks up Trace when running
diff --git a/Src/Common/Types/int.h b/Src/Common/Types/int.h
index 9cff196..29c2b88 100644
--- a/Src/Common/Types/int.h
+++ b/Src/Common/Types/int.h
@@ -9,9 +9,7 @@
 #ifndef __int_h__
 #define __int_h__
 
-#include "../Platform.h"
-
-#ifdef DASHER_WIN32
+#ifdef _WIN32
 
 typedef __int64 int64;
 typedef unsigned __int64 uint64;
diff --git a/Src/Common/myassert.h b/Src/Common/myassert.h
index 5dd4e1e..09357fc 100644
--- a/Src/Common/myassert.h
+++ b/Src/Common/myassert.h
@@ -21,8 +21,6 @@
 #ifndef __assert_h__
 #define __assert_h__
 
-#include "Platform.h"
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -31,8 +29,8 @@
 // In non-debug debug builds - no check is done
 
 #ifdef DEBUG
-#ifdef DASHER_WIN32
-#ifdef DASHER_WINCE
+#ifdef _WIN32
+#ifdef _WIN32_WCE
 
 // Windows CE
 void __cdecl __debugbreak(void);
@@ -44,7 +42,7 @@ void __cdecl __debugbreak(void);
 #include <crtdbg.h>
 #define DASHER_ASSERT(expr) _ASSERT(expr)
 
-#endif // DASHER_WINCE
+#endif // _WIN32_WCE
 
 #else 
 
@@ -52,7 +50,7 @@ void __cdecl __debugbreak(void);
 #include <cassert>
 #define DASHER_ASSERT(expr) assert(expr)
 
-#endif // DASHER_WIN32
+#endif // _WIN32
 
 #else
 
@@ -78,7 +76,7 @@ template <> struct CompileTimeError <true > {
 // DASHER_ASSERT_VALIDPTR_RW(p) asserts that a pointer is valid for read and write
 // DASHER_ASSERT_VALIDPTR_R(p) asserts that a pointer is valid for read
 
-#if DASHER_WIN32 >= 1300
+#if _MSC_VER >= 1300
 #define DASHER_ASSERT_VALIDPTR_RW(p)	DASHER_ASSERT(_CrtIsValidPointer(p, sizeof(p), 1))
 #define DASHER_ASSERT_VALIDPTR_R(p)		DASHER_ASSERT(_CrtIsValidPointer(p, sizeof(p), 0))
 #else
@@ -91,4 +89,4 @@ template <> struct CompileTimeError <true > {
 
 #endif
 
-#endif // __include__
+#endif // __assert_h__
diff --git a/Src/DasherCore/Alphabet/AlphIO.cpp b/Src/DasherCore/Alphabet/AlphIO.cpp
index 7aea69e..ae96f42 100644
--- a/Src/DasherCore/Alphabet/AlphIO.cpp
+++ b/Src/DasherCore/Alphabet/AlphIO.cpp
@@ -131,7 +131,7 @@ CAlphInfo *CAlphIO::CreateDefault() {
   // than their index into m_vCharacters... (as "unknown symbol" 0 does not appear in vector)
   Default.iParagraphCharacter = Chars.size()+1;
   Default.m_vCharacters[Chars.size()].Display = "Â";
-#ifdef WIN32
+#ifdef _WIN32
   Default.m_vCharacters[Chars.size()].Text = "\r\n";
 #else
   Default.m_vCharacters[Chars.size()].Text = "\n";
@@ -219,7 +219,7 @@ void CAlphIO::XmlStartHandler(const XML_Char *name, const XML_Char **atts) {
   if(strcmp(name, "paragraph") == 0) {
     if (!ParagraphCharacter) ParagraphCharacter=new CAlphInfo::character();
     ReadCharAtts(atts,*ParagraphCharacter);
-#ifdef WIN32
+#ifdef _WIN32
         ParagraphCharacter->Text = "\r\n";
 #else
         ParagraphCharacter->Text = "\n";
diff --git a/Src/DasherCore/Alphabet/AlphabetMap.h b/Src/DasherCore/Alphabet/AlphabetMap.h
index 181786c..3418708 100644
--- a/Src/DasherCore/Alphabet/AlphabetMap.h
+++ b/Src/DasherCore/Alphabet/AlphabetMap.h
@@ -10,7 +10,7 @@
 #ifndef __AlphabetMap_h__
 #define __AlphabetMap_h__
 
-#ifndef DASHER_WIN32
+#ifndef _WIN32
 #include <sys/types.h>
 #endif
 
diff --git a/Src/DasherCore/LanguageModelling/DictLanguageModel.cpp b/Src/DasherCore/LanguageModelling/DictLanguageModel.cpp
index 00eeedd..a12dd12 100644
--- a/Src/DasherCore/LanguageModelling/DictLanguageModel.cpp
+++ b/Src/DasherCore/LanguageModelling/DictLanguageModel.cpp
@@ -21,7 +21,7 @@ using namespace std;
 // static TCHAR debug[256];
 typedef unsigned long ulong;
 
-#ifdef DASHER_WIN32
+#ifdef _WIN32
 #define snprintf _snprintf
 #endif
 
diff --git a/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp b/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp
index dbcbb3d..eabf600 100644
--- a/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp
+++ b/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp
@@ -24,7 +24,7 @@ using namespace std;
 // static TCHAR debug[256];
 typedef unsigned long ulong;
 
-#ifdef DASHER_WIN32
+#ifdef _WIN32
 #define snprintf _snprintf
 #endif
 
diff --git a/Src/Win32/AppSettings.cpp b/Src/Win32/AppSettings.cpp
index a7de9b0..33ed465 100644
--- a/Src/Win32/AppSettings.cpp
+++ b/Src/Win32/AppSettings.cpp
@@ -234,7 +234,7 @@ bool CAppSettings::LoadSetting(const std::string &Key, std::string *Value) {
 static TCHAR FormatWindowPlacement[] = TEXT("%u,%u,%d,%d,%d,%d,%d,%d,%d,%d");
 
 /////////////////////////////////////////////////////////////////////////////
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
 
 void CAppSettings::SaveSetting(const std::string &Key, const LPWINDOWPLACEMENT pwp) {
   DASHER_ASSERT(pwp != NULL);
diff --git a/Src/Win32/AppSettings.h b/Src/Win32/AppSettings.h
index 39268bc..6519f35 100644
--- a/Src/Win32/AppSettings.h
+++ b/Src/Win32/AppSettings.h
@@ -47,7 +47,7 @@ public:
   void ResetParamater(int iParameter);
   void GetPermittedValues(int iParameter, std::vector<std::string> &vList);
 
-  #ifndef DASHER_WINCE
+  #ifndef _WIN32_WCE
   bool LoadSetting(const std::string & Key, LPWINDOWPLACEMENT pwp);
   void SaveSetting(const std::string & Key, const LPWINDOWPLACEMENT pwp);
 #endif
diff --git a/Src/Win32/Common/WinCommon.h b/Src/Win32/Common/WinCommon.h
index 94de0ba..9c19672 100644
--- a/Src/Win32/Common/WinCommon.h
+++ b/Src/Win32/Common/WinCommon.h
@@ -90,7 +90,7 @@ namespace WinHelper {
 
 #include "WinLocalisation.h"
 
-#if DASHER_WIN32 <= 1300
+#if _MSC_VER <= 1300
 namespace stdext = std;
 #endif
 
diff --git a/Src/Win32/Common/WinHelper.cpp b/Src/Win32/Common/WinHelper.cpp
index da03360..62b4f80 100644
--- a/Src/Win32/Common/WinHelper.cpp
+++ b/Src/Win32/Common/WinHelper.cpp
@@ -61,7 +61,7 @@ void WinHelper::GetUserDirectory(Tstring *Output) {
 #ifdef 	OriginalWin95
   // Not a lot else I can do :(
   GetAppDirectory(Output);
-#elif  defined DASHER_WINCE
+#elif  defined _WIN32_WCE
   GetAppDirectory(Output);
 #else
 
diff --git a/Src/Win32/Common/WinOptions.cpp b/Src/Win32/Common/WinOptions.cpp
index f6d15ab..b1a124a 100644
--- a/Src/Win32/Common/WinOptions.cpp
+++ b/Src/Win32/Common/WinOptions.cpp
@@ -136,7 +136,7 @@ bool CWinOptions::LoadSetting(const std::string &Key, std::string *Value) {
 static TCHAR FormatWindowPlacement[] = TEXT("%u,%u,%d,%d,%d,%d,%d,%d,%d,%d");
 
 /////////////////////////////////////////////////////////////////////////////
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
 
 void CWinOptions::SaveSetting(const std::string &Key, const LPWINDOWPLACEMENT pwp) {
   DASHER_ASSERT(pwp != NULL);
diff --git a/Src/Win32/Common/WinOptions.h b/Src/Win32/Common/WinOptions.h
index e471ced..2aa7ca1 100644
--- a/Src/Win32/Common/WinOptions.h
+++ b/Src/Win32/Common/WinOptions.h
@@ -22,7 +22,7 @@ public:
   CWinOptions(const std::string & Group, const std::string & Product);
    ~CWinOptions();
 
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   bool LoadSetting(const std::string & Key, LPWINDOWPLACEMENT pwp);
   void SaveSetting(const std::string & Key, const LPWINDOWPLACEMENT pwp);
 #endif
diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp
index 3bc36b5..3ab808a 100644
--- a/Src/Win32/DasherWindow.cpp
+++ b/Src/Win32/DasherWindow.cpp
@@ -182,7 +182,7 @@ void CDasherWindow::Show(int nCmdShow) {
 }
 
 void CDasherWindow::SaveWindowState() const {
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   WINDOWPLACEMENT wp;
   wp.length = sizeof(WINDOWPLACEMENT);
   
@@ -193,7 +193,7 @@ void CDasherWindow::SaveWindowState() const {
 }
 
 bool CDasherWindow::LoadWindowState() {
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   WINDOWPLACEMENT wp;
   
   if(m_pAppSettings->LoadSetting("WindowState", &wp)) {
@@ -514,4 +514,4 @@ void CDasherWindow::HandleWinEvent(HWINEVENTHOOK hWinEventHook, DWORD event, HWN
   if(m_pDasher)
     m_pDasher->SetBuffer(0);
 }
-#endif
\ No newline at end of file
+#endif
diff --git a/Src/Win32/Widgets/Edit.cpp b/Src/Win32/Widgets/Edit.cpp
index c3f8140..27c78e8 100644
--- a/Src/Win32/Widgets/Edit.cpp
+++ b/Src/Win32/Widgets/Edit.cpp
@@ -453,7 +453,7 @@ void CEdit::output(const std::string &sText) {
     else {    
       for(std::wstring::iterator it(String.begin()); it != String.end(); ++it) {
         fakekey[0].type = INPUT_KEYBOARD;
-#ifdef DASHER_WINCE
+#ifdef _WIN32_WCE
         fakekey[0].ki.dwFlags = KEYEVENTF_KEYUP;
 #else
         fakekey[0].ki.dwFlags = KEYEVENTF_UNICODE;
@@ -875,4 +875,4 @@ void CEdit::HandleParameterChange(int iParameter) {
   default:
     break;
   }
-}
\ No newline at end of file
+}
diff --git a/Src/Win32/Widgets/FilenameGUI.cpp b/Src/Win32/Widgets/FilenameGUI.cpp
index 64f719e..8f61092 100644
--- a/Src/Win32/Widgets/FilenameGUI.cpp
+++ b/Src/Win32/Widgets/FilenameGUI.cpp
@@ -54,7 +54,7 @@ const Tstring CFilenameGUI::Empty = TEXT("");
 CFilenameGUI::CFilenameGUI(HWND WindowWithTitlebar, Tstring AppName, bool NewWithDate)
 :WindowWithTitlebar(WindowWithTitlebar), AppName(AppName), NewWithDate(NewWithDate), Dirty(false), FileAndPath(TEXT("")) {
 
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   TCHAR CurrentDirectory[_MAX_DIR];
   if(GetCurrentDirectory(_MAX_DIR, CurrentDirectory) > 0) {
     OriginalPath = CurrentDirectory;
@@ -181,7 +181,7 @@ void CFilenameGUI::SetDirty(bool Value) {
 void CFilenameGUI::SetWindowTitle() {
   Tstring TitleText;
 
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
   TCHAR PrettyName[_MAX_FNAME];
   if(GetFileTitle(FileAndPath.c_str(), PrettyName, _MAX_FNAME) == 0)
     TitleText = PrettyName;
diff --git a/Src/Win32/Widgets/Screen.inl b/Src/Win32/Widgets/Screen.inl
index 927850f..59f33a8 100644
--- a/Src/Win32/Widgets/Screen.inl
+++ b/Src/Win32/Widgets/Screen.inl
@@ -18,7 +18,7 @@ inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, scr
   if(Colour != -1)
     FillRect(m_hDCBuffer, &Rect, brush);
 
-#ifndef DASHER_WINCE
+#ifndef _WIN32_WCE
 
   if(GetWidth() != -1) {
 
diff --git a/Src/Win32/Widgets/SplashScreen.cpp b/Src/Win32/Widgets/SplashScreen.cpp
index e84937b..bba536c 100644
--- a/Src/Win32/Widgets/SplashScreen.cpp
+++ b/Src/Win32/Widgets/SplashScreen.cpp
@@ -60,7 +60,7 @@ LRESULT CALLBACK CSplash::TmpWndProc(HWND Window, UINT message, WPARAM wParam, L
 
 CSplash::CSplash(HWND Parent) {
 
-#ifdef DASHER_WINCE
+#ifdef _WIN32_WCE
   WNDCLASS wndclass;
   memset(&wndclass, 0, sizeof(WNDCLASS));
 #else
@@ -74,7 +74,7 @@ CSplash::CSplash(HWND Parent) {
   wndclass.hbrBackground = (HBRUSH) GetStockObject(NULL_BRUSH);
   wndclass.lpszClassName = TEXT("Splash");
 
-#ifdef DASHER_WINCE
+#ifdef _WIN32_WCE
   RegisterClass(&wndclass);
   m_hwnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, TEXT("Splash"), TEXT("Splash"), WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, Parent, NULL, WinHelper::hInstApp, NULL);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]