From 400d4d12b7a70b81629a119844e7d5ad16aa6012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 20 Jul 2022 14:31:28 +0200 Subject: Improve ANSI compatibility. This improves upon 79d4fa6. Actually, ANSI compatibility may be desirable, as recent work has been done to make the A versions of Windows API functions work with UTF-8. --- c/listview.cpp | 10 ++++------ c/pl.h | 15 ++++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/c/listview.cpp b/c/listview.cpp index 3ad66f5..752ebcb 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -41,25 +41,23 @@ int ListView::Height(int bHeader) void ListView::UpdateTheme(const BOOL bThemeActive) { DWORD dwStyle; - const TCHAR* tszTheme; + const wchar_t* wszTheme; WORD wAction; extern int g_bThemes; if (!g_bThemes) return; if (bThemeActive) { dwStyle = LVS_EX_DOUBLEBUFFER; - tszTheme = TEXT("Explorer"); + wszTheme = L"Explorer"; wAction = UIS_SET; } else { dwStyle = 0; - tszTheme = NULL; + wszTheme = NULL; wAction = UIS_CLEAR; } -#ifdef UNICODE /* Use modern "Explorer" theme. */ - SetWindowTheme(hWnd, tszTheme, NULL); -#endif + SetWindowTheme(hWnd, wszTheme, NULL); /* The modern theme requires double buffering. */ ListView_SetExtendedListViewStyleEx(hWnd, LVS_EX_DOUBLEBUFFER, dwStyle); diff --git a/c/pl.h b/c/pl.h index 1448361..8325c86 100644 --- a/c/pl.h +++ b/c/pl.h @@ -67,20 +67,17 @@ inline int PlGet(term_t t, atom_t* x) { return PL_get_atom(t, x); } inline int PlGet(term_t t, char** x) { return PL_get_atom_chars(t, x); } inline int PlGet(term_t t, wchar_t** x) { size_t len; return PL_get_wchars(t, &len, x, CVT_ATOM); } -/* Helper templates for Plx, Pl. */ +/* Put in or get from a term reference an arbitrary number of values, + * returning false if any value could not be put/got. */ template -inline int PlPutN(term_t) { return -1; } -template -inline int PlPutN(term_t t, T arg) { return PlPut(t, arg); } +inline bool PlPutN(term_t) { return true; } template -inline int PlPutN(term_t t, T arg, U... xs) { return PlPut(t, arg) && PlPutN(t+1, xs...); } +inline bool PlPutN(term_t t, T x, U... xs) { return PlPut(t, x) && PlPutN(t+1, xs...); } template -inline int PlGetN(term_t) { return -1; } -template -inline int PlGetN(term_t t, T arg) { return PlGet(t, arg); } +inline bool PlGetN(term_t) { return true; } template -inline int PlGetN(term_t t, T arg, U... xs) { return PlGet(t, arg) && PlGetN(t+1, xs...); } +inline bool PlGetN(term_t t, T x, U... xs) { return PlGet(t, x) && PlGetN(t+1, xs...); } /* Call Prolog predicate, propagating Prolog exceptions. */ template -- cgit v1.2.3