From b18dc4fd00c0055eae9128c28a36412f83b998b4 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 16 Oct 2013 00:54:58 +0200 Subject: [PATCH] Provide a Raw version of ShowNodeCnt to avoid more #ifdef's. At the same time, nuking "#ifdef DYNAMIC_ZNODES" (dead code). --- gnushogi/commondsp.c | 25 ++++--------------------- gnushogi/cursesdsp.c | 2 +- gnushogi/cursesdsp.h | 2 +- gnushogi/dspwrappers.c | 1 + gnushogi/dspwrappers.h | 1 + gnushogi/rawdsp.c | 8 ++++++++ gnushogi/rawdsp.h | 1 + 7 files changed, 17 insertions(+), 23 deletions(-) diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 157d852..1ed6e1b 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -1385,7 +1385,7 @@ TestSpeed(void(*f)(short side, short ply, #endif unsigned i; - long cnt, rate, t1, t2; + long cnt, t1, t2; #ifdef HAVE_GETTIMEOFDAY struct timeval tv; @@ -1425,17 +1425,7 @@ TestSpeed(void(*f)(short side, short ply, else et = 1; - rate = (((et) ? ((cnt * 100) / et) : 0)); - -#ifdef DYNAMIC_ZNODES - if (rate > 0) - znodes = rate; -#endif - - if (NOT_CURSES) - printf(CP[91], cnt, rate); - else - ShowNodeCnt(cnt); + ShowNodeCnt(cnt); } @@ -1444,7 +1434,7 @@ void TestPSpeed(short(*f) (short side), unsigned j) { short i; - long cnt, rate, t1, t2; + long cnt, t1, t2; #ifdef HAVE_GETTIMEOFDAY struct timeval tv; #endif @@ -1473,14 +1463,7 @@ TestPSpeed(short(*f) (short side), unsigned j) else et = 1; - rate = (et) ? ((cnt * 100) / et) : 0; - - /* printf("Nodes= %ld Nodes/sec= %ld\n", cnt, rate); */ - - if (NOT_CURSES) - printf(CP[91], cnt, rate); - else - ShowNodeCnt(cnt); + ShowNodeCnt(cnt); } diff --git a/gnushogi/cursesdsp.c b/gnushogi/cursesdsp.c index 27a2f72..c717a9f 100644 --- a/gnushogi/cursesdsp.c +++ b/gnushogi/cursesdsp.c @@ -170,7 +170,7 @@ Curses_doRequestInputString(const char* fmt, char* buffer) void -ShowNodeCnt(long NodeCnt) +Curses_ShowNodeCnt(long NodeCnt) { gotoXY(TAB, 22); /* printw(CP[90], NodeCnt, (et > 100) ? NodeCnt / (et / 100) : 0); */ diff --git a/gnushogi/cursesdsp.h b/gnushogi/cursesdsp.h index 8ad5554..e46a992 100644 --- a/gnushogi/cursesdsp.h +++ b/gnushogi/cursesdsp.h @@ -49,6 +49,7 @@ void Curses_EditBoard(void); void Curses_ExitShogi(void); void Curses_GiveHint(void); void Curses_Initialize(void); +void Curses_ShowNodeCnt(long NodeCnt); void Curses_OutputMove(void); void Curses_SearchStartStuff(short side); void Curses_SelectLevel(char *sx); @@ -78,7 +79,6 @@ void ClearEoln(void); void ClearMessage(void); void DrawPiece(short sq); void ShowHeader(void); -void ShowNodeCnt(long NodeCnt); void ShowPlayers(void); void ShowPrompt(void); void ShowScore(short score); diff --git a/gnushogi/dspwrappers.c b/gnushogi/dspwrappers.c index 8a7a0cf..87959ed 100644 --- a/gnushogi/dspwrappers.c +++ b/gnushogi/dspwrappers.c @@ -90,6 +90,7 @@ DISPLAY_VOIDFUNC(EditBoard) DISPLAY_VOIDFUNC(ExitShogi) DISPLAY_VOIDFUNC(GiveHint) DISPLAY_VOIDFUNC(Initialize) +DISPLAY_FUNC(ShowNodeCnt, (long NodeCnt), (NodeCnt)) DISPLAY_VOIDFUNC(OutputMove) DISPLAY_VOIDFUNC(SetContempt) DISPLAY_FUNC(SearchStartStuff, (short side), (side)) diff --git a/gnushogi/dspwrappers.h b/gnushogi/dspwrappers.h index 52d21a7..ad5ab9d 100644 --- a/gnushogi/dspwrappers.h +++ b/gnushogi/dspwrappers.h @@ -47,6 +47,7 @@ extern void EditBoard(void); extern void ExitShogi(void); extern void GiveHint(void); extern void Initialize(void); +extern void ShowNodeCnt(long NodeCnt); extern void OutputMove(void); extern void SetContempt(void); extern void SearchStartStuff(short side); diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index 8512633..4225f32 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -140,6 +140,14 @@ Raw_doRequestInputString(const char* fmt, char* buffer) void +Raw_ShowNodeCnt(long NodeCnt) +{ + printf(CP[91], + NodeCnt, (((et) ? ((NodeCnt * 100) / et) : 0))); +} + + +void Raw_ShowPatternCount(short side, short n) { if (flag.post) diff --git a/gnushogi/rawdsp.h b/gnushogi/rawdsp.h index 0a9be68..ca3b14d 100644 --- a/gnushogi/rawdsp.h +++ b/gnushogi/rawdsp.h @@ -49,6 +49,7 @@ void Raw_EditBoard(void); void Raw_ExitShogi(void); void Raw_GiveHint(void); void Raw_Initialize(void); +void Raw_ShowNodeCnt(long NodeCnt); void Raw_OutputMove(void); void Raw_SearchStartStuff(short side); void Raw_SelectLevel(char *sx); -- 1.7.0.4