From 0b5a14c42469df26a8faeca81c1bbf800847fb6a Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 17 Feb 2008 21:48:48 +0000 Subject: [PATCH] Add ENABLE_LOGGING define so logging can be used on non-debug builds, e.g. to trace opening of non-debug saved games and prefs files. --- common/comtypes.h | 6 ++++++ common/dbgutil.c | 4 ++-- linux/Makefile | 2 +- palm/Makefile | 2 +- wince/Makefile | 8 +++++++- wince/cemain.c | 10 +++++----- wince/cemain.h | 3 ++- wince/resource.h | 2 +- wince/xptypes.h | 2 +- wince/xwords4.rc | 12 ++++++++++-- 10 files changed, 36 insertions(+), 15 deletions(-) diff --git a/common/comtypes.h b/common/comtypes.h index 171df675e..79be0b638 100644 --- a/common/comtypes.h +++ b/common/comtypes.h @@ -201,6 +201,12 @@ typedef struct CommonPrefs { # define XP_UNUSED_DBG(x) XP_UNUSED(x) #endif +#ifdef ENABLE_LOGGING +# define XP_UNUSED_LOG(x) x +#else +# define XP_UNUSED_LOG(x) XP_UNUSED(x) +#endif + #ifdef XWFEATURE_RELAY # define XP_UNUSED_RELAY(x) x #else diff --git a/common/dbgutil.c b/common/dbgutil.c index c6773f9d1..94c74f107 100644 --- a/common/dbgutil.c +++ b/common/dbgutil.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifdef DEBUG +#ifdef ENABLE_LOGGING #include "dbgutil.h" @@ -67,5 +67,5 @@ BoardObjectType_2str( BoardObjectType obj ) #undef CASESTR -#endif /* DEBUG */ +#endif /* ENABLE_LOGGING */ diff --git a/linux/Makefile b/linux/Makefile index 23729f067..6f6955532 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ifeq ($(MEMDEBUG),TRUE) -DEFINES = -DMEM_DEBUG -DDEBUG +DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror CFLAGS += -DDEBUG_TS PLATFORM = obj_linux_memdbg diff --git a/palm/Makefile b/palm/Makefile index 675591dba..81cb5dfb0 100644 --- a/palm/Makefile +++ b/palm/Makefile @@ -20,7 +20,7 @@ PLATFORM=obj_palm SVNREV = $(shell svnversion -n .. | tr ':' '_') ifeq ($(MEMDEBUG),TRUE) -DEBUG = -DMEM_DEBUG -DDEBUG +DEBUG = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING PLATFORM := $(PLATFORM)_memdebug CFLAGS += $(DEBUG) -g -O0 CSFLAGS += -O0 -g diff --git a/wince/Makefile b/wince/Makefile index 03fcb8237..603754101 100644 --- a/wince/Makefile +++ b/wince/Makefile @@ -96,8 +96,14 @@ CFLAGS += -DDICTS_MOVED_ALERT CFLAGS += -DKEYBOARD_NAV CFLAGS += -DPERIMETER_FOCUS +# This is normally part of MEM_DEBUG, but sometimes we want logging in +# a release build, e.g. to figure out why opening a saved game isn't +# working. So normally it's commented out here. +# LOGGING_FLAG = -DENABLE_LOGGING + ifeq ($(DEBUG),TRUE) MEM_DEBUG_FLAG=-DMEM_DEBUG +LOGGING_FLAG = -DENABLE_LOGGING DEBUG_FLAG=-DDEBUG CFLAGS += -g -DDEBUG_TS OBJDIR = obj_$(TARGET_OS)_dbg @@ -148,7 +154,7 @@ XW_BOTH_DEFINES = \ -DXWFEATURE_HINT_CONFIG \ -DPOINTER_SUPPORT -DKEY_SUPPORT -D__LITTLE_ENDIAN \ -DCEFEATURE_CANSCROLL -DUNICODE \ - $(DEBUG_FLAG) $(MEM_DEBUG_FLAG) \ + $(DEBUG_FLAG) $(MEM_DEBUG_FLAG) $(LOGGING_FLAG) \ CFLAGS += $(XW_BOTH_DEFINES) -DARM RESFLAGS += $(XW_BOTH_DEFINES) $(STANDALONE) $(BLUETOOTH) $(RELAY) \ diff --git a/wince/cemain.c b/wince/cemain.c index 4b46e762c..134ee734f 100755 --- a/wince/cemain.c +++ b/wince/cemain.c @@ -2420,15 +2420,15 @@ RECTtoXPR( XP_Rect* dest, RECT* src ) } /* RECTtoXPR */ void -wince_assert( XP_UCHAR* XP_UNUSED_DBG(s), int XP_UNUSED_DBG(line), - char* XP_UNUSED_DBG(fileName) ) +wince_assert( XP_UCHAR* XP_UNUSED_LOG(s), int XP_UNUSED_LOG(line), + char* XP_UNUSED_LOG(fileName) ) { XP_WARNF( "ASSERTION FAILED %s: file %s, line %d\n", s, fileName, line ); } /* wince_assert */ -#ifdef DEBUG +#ifdef ENABLE_LOGGING static void -makeTimeStamp( XP_UCHAR* timeStamp, XP_U16 size ) +makeTimeStamp( XP_UCHAR* timeStamp, XP_U16 XP_UNUSED_DBG(size) ) { SYSTEMTIME st; DWORD tid; @@ -2546,7 +2546,7 @@ messageToBuf( UINT message, char* buf, int bufSize ) snprintf( buf, bufSize, "%s", str ); } } /* messageToBuf */ -#endif +#endif /* ENABLE_LOGGING */ XP_U16 wince_snprintf( XP_UCHAR* buf, XP_U16 len, const XP_UCHAR* format, ... ) diff --git a/wince/cemain.h b/wince/cemain.h index 13d5c5763..2bbad6688 100755 --- a/wince/cemain.h +++ b/wince/cemain.h @@ -59,7 +59,8 @@ enum { CE_BONUS1_COLOR, CE_NUM_COLORS /* last */ }; -#define CUR_CE_PREFS_FLAGS 0x0003 +#define CUR_CE_PREFS_FLAGS 0x0003 /* adds CE_FOCUS_COLOR */ + typedef struct CEAppPrefs { XP_U16 versionFlags; CommonPrefs cp; diff --git a/wince/resource.h b/wince/resource.h index f1e3e98e9..4a9f379c9 100755 --- a/wince/resource.h +++ b/wince/resource.h @@ -109,7 +109,7 @@ #define TPLWRD_LABEL 1076 #define EMPTYCELL_LABEL 1077 #define TILEBACK_LABEL 1078 -#define FOCURCLR_LABEL 1079 +#define FOCUSCLR_LABEL 1079 /* editor dlg: assumption is that the edit field's ID is one more than the corresponding slider's */ diff --git a/wince/xptypes.h b/wince/xptypes.h index 39f7d5780..6215ec7c9 100755 --- a/wince/xptypes.h +++ b/wince/xptypes.h @@ -94,7 +94,7 @@ typedef XP_U32 XP_Time; #define XP_STATUSF XP_DEBUGF #define XP_WARNF XP_DEBUGF -#ifdef DEBUG +#ifdef ENABLE_LOGGING #define XP_DEBUGF(...) wince_debugf(__VA_ARGS__) #define XP_LOGF(...) wince_debugf(__VA_ARGS__) #else diff --git a/wince/xwords4.rc b/wince/xwords4.rc index 569db6030..c74c2d43c 100755 --- a/wince/xwords4.rc +++ b/wince/xwords4.rc @@ -167,12 +167,20 @@ CAPTION "About Crosswords" FONT 8, "System" BEGIN ICON IDI_XWORDS4,IDC_STATIC,5,17,20,20 + /* For some reason, the mingw compiler (win32) doesn't like my + string concatenation trick any more. Need to fix or file a bug + or something. */ +#ifdef _WIN32_WCE LTEXT "Crosswords 4.2b1 (rev " SVN_REV ") "\ "for PocketPC. Copyright 1998-2008 by "\ "Eric House. This software is released under the GNU "\ "Public License.\r\r"\ "For dictionaries, a manual, or source code go to "\ - "http://xwords.sf.net or http://eehouse.org/xwords/.", + "http://xwords.sf.net or http://eehouse.org/xwords/." +#else + LTEXT "Crosswords 4.2b1" +#endif +, IDC_STATIC,29,4,95,101,SS_NOPREFIX END @@ -533,7 +541,7 @@ BEGIN PUSHBUTTON "",TBACK_BUTTON,CLR_COL_4,CLR_ROW_3,CLR_BUT_WIDTH, CLR_BUT_HT,BS_OWNERDRAW - LTEXT "Focus color:",FOCURCLR_LABEL,CLR_COL_1,CLR_ROW_4, + LTEXT "Focus color:",FOCUSCLR_LABEL,CLR_COL_1,CLR_ROW_4, CLR_LAB_WIDTH,CLR_LAB_HT PUSHBUTTON "",FOCUS_BUTTON,CLR_COL_2,CLR_ROW_4,CLR_BUT_WIDTH, CLR_BUT_HT,BS_OWNERDRAW