From e96aaccef9c71533a54f7e7ac968524a0c69a1cb Mon Sep 17 00:00:00 2001
From: ehouse <ehouse@0782aaa5-4710-0410-8820-a96bf9123855>
Date: Thu, 20 Apr 2006 04:38:40 +0000
Subject: [PATCH] debug-only function for logging wchar_t strings

---
 xwords4/wince/ceutil.c | 11 +++++++++++
 xwords4/wince/ceutil.h |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/xwords4/wince/ceutil.c b/xwords4/wince/ceutil.c
index a43226430..56067f134 100755
--- a/xwords4/wince/ceutil.c
+++ b/xwords4/wince/ceutil.c
@@ -191,3 +191,14 @@ ceCenterCtl( HWND hDlg, XP_U16 resID )
         XP_LOGF( "MoveWindow=>%d", GetLastError() );
     }
 } /* ceCenterCtl */
+
+#ifdef DEBUG
+void
+XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg )
+{
+    XP_UCHAR buf[512];
+    (void)WideCharToMultiByte( CP_ACP, 0, arg, -1,
+                               buf, sizeof(buf), NULL, NULL );
+    XP_LOGF( "%s: %s", prefix, buf );
+}
+#endif
diff --git a/xwords4/wince/ceutil.h b/xwords4/wince/ceutil.h
index 1a0669b76..3c9131e2e 100755
--- a/xwords4/wince/ceutil.h
+++ b/xwords4/wince/ceutil.h
@@ -42,4 +42,11 @@ XP_Bool ceGetChecked( HWND hDlg, XP_U16 resID );
 void ceSetChecked( HWND hDlg, XP_U16 resID, XP_Bool check );
 
 void ceCenterCtl( HWND hDlg, XP_U16 resID );
+
+#ifdef DEBUG
+void XP_LOGW( const XP_UCHAR* prefix, const wchar_t* arg );
+#else
+# define XP_LOGW( prefix, arg )
+#endif
+
 #endif