}
-static void
-UpdateClocks(void)
+void
+Curses_UpdateClocks(void)
{
short m, s;
long dt;
}
-/*
- * Determine the time that has passed since the search was started. If the
- * elapsed time exceeds the target(ResponseTime + ExtraTime) then set timeout
- * to true which will terminate the search.
- * iop = COMPUTE_MODE calculate et, bump ETnodes
- * iop = COMPUTE_AND_INIT_MODE calculate et, set timeout if time exceeded,
- * set reference time
- */
void
-Curses_ElapsedTime(ElapsedTime_mode iop)
+Curses_PollForInput(void)
{
- long current_time;
int i;
int nchar;
-#ifdef HAVE_GETTIMEOFDAY
- struct timeval tv;
-#endif
-
if ((i = ioctl((int) 0, FIONREAD, &nchar)))
{
perror("FIONREAD");
flag.bothsides = false;
}
+}
+
+/*
+ * Determine the time that has passed since the search was started. If the
+ * elapsed time exceeds the target(ResponseTime + ExtraTime) then set timeout
+ * to true which will terminate the search.
+ * iop = COMPUTE_MODE calculate et, bump ETnodes
+ * iop = COMPUTE_AND_INIT_MODE calculate et, set timeout if time exceeded,
+ * set reference time
+ */
+void
+Curses_ElapsedTime(ElapsedTime_mode iop)
+{
+ long current_time;
+#ifdef HAVE_GETTIMEOFDAY
+ struct timeval tv;
+#endif
+
+ PollForInput();
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv, NULL);
void Curses_Initialize(void);
void Curses_ShowNodeCnt(long NodeCnt);
void Curses_OutputMove(void);
+void Curses_PollForInput(void);
void Curses_SearchStartStuff(short side);
void Curses_SelectLevel(char *sx);
void Curses_SetContempt(void);
void Curses_ShowSidetoMove(void);
void Curses_ShowStage(void);
void Curses_TerminateSearch(int sig);
+void Curses_UpdateClocks(void);
void Curses_UpdateDisplay(short f, short t, short redraw, short isspec);
void Curses_help(void);
DISPLAY_VOIDFUNC(Initialize)
DISPLAY_FUNC(ShowNodeCnt, (long NodeCnt), (NodeCnt))
DISPLAY_VOIDFUNC(OutputMove)
+DISPLAY_VOIDFUNC(PollForInput)
DISPLAY_VOIDFUNC(SetContempt)
DISPLAY_FUNC(SearchStartStuff, (short side), (side))
DISPLAY_FUNC(SelectLevel, (char *sx), (sx))
DISPLAY_VOIDFUNC(ShowSidetoMove)
DISPLAY_VOIDFUNC(ShowStage)
DISPLAY_FUNC(TerminateSearch, (int sig), (sig))
+DISPLAY_VOIDFUNC(UpdateClocks)
DISPLAY_FUNC(UpdateDisplay, (short f, short t, short redraw, short isspec), (f, t, redraw, isspec))
DISPLAY_VOIDFUNC(help)
extern void Initialize(void);
extern void ShowNodeCnt(long NodeCnt);
extern void OutputMove(void);
+extern void PollForInput(void);
extern void SetContempt(void);
extern void SearchStartStuff(short side);
extern void SelectLevel(char *sx);
extern void ShowSidetoMove(void);
extern void ShowStage(void);
extern void TerminateSearch(int sig);
+extern void UpdateClocks(void);
extern void UpdateDisplay(short f, short t, short redraw, short isspec);
extern void help(void);
#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
+#include <poll.h>
+#include <unistd.h>
#include "gnushogi.h"
#include "rawdsp.h"
void
+Raw_UpdateClocks(void)
+{
+}
+
+
+void
Raw_UpdateDisplay(short f, short t, short redraw, short isspec)
{
}
+void
+Raw_PollForInput(void)
+{
+ static struct pollfd pollfds[1] = { /* [0] = */ { /* .fd = */ STDIN_FILENO,
+ /* .events = */ POLLIN } };
+ int cnt = poll(pollfds, sizeof(pollfds)/sizeof(pollfds[0]), 0);
+ if (cnt < 0) {
+ perror("polling standard input");
+ ExitShogi();
+ }
+ if (cnt) { /* if anything to read, or error occured */
+ if (!flag.timeout)
+ flag.back = true; /* previous: flag.timeout = true; */
+ flag.bothsides = false;
+ }
+}
+
+
/*
* Determine the time that has passed since the search was started. If the
* elapsed time exceeds the target(ResponseTime + ExtraTime) then set timeout
long current_time;
#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
+#endif
+
+ PollForInput();
+
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv, NULL);
current_time = tv.tv_sec*100 + (tv.tv_usec/10000);
#else
time0 = current_time;
}
+
+#ifdef QUIETBACKGROUND
+ if (!background)
+#endif
+ UpdateClocks();
}
}
void Raw_Initialize(void);
void Raw_ShowNodeCnt(long NodeCnt);
void Raw_OutputMove(void);
+void Raw_PollForInput(void);
void Raw_SearchStartStuff(short side);
void Raw_SelectLevel(char *sx);
void Raw_SetContempt(void);
void Raw_ShowSidetoMove(void);
void Raw_ShowStage(void);
void Raw_TerminateSearch(int sig);
+void Raw_UpdateClocks(void);
void Raw_UpdateDisplay(short f, short t, short redraw, short isspec);
void Raw_help(void);
*/
#include "gnushogi.h"
-#include <poll.h>
-#include <unistd.h>
short background = 0;
static short DepthBeyond;
short best = -(SCORE_LIMIT + 3000);
short bestwidth = 0;
short mustcut;
- static struct pollfd pollfds[1] = { /* [0] = */ { /* .fd = */ STDIN_FILENO,
- /* .events = */ POLLIN } };
#ifdef NULLMOVE
short PVsave;
{
ElapsedTime(COMPUTE_MODE);
- if(background) {
- int cnt = poll(pollfds, sizeof(pollfds)/sizeof(pollfds[0]), 0);
- if (cnt < 0) {
- perror("polling standard input");
- ExitShogi();
- }
- if (cnt) { /* if anything to read, or error occured */
- if (!flag.timeout)
- flag.back = true; /* previous: flag.timeout = true; */
- flag.bothsides = false;
- }
- }
-
if (flag.back)
{
flag.back = false;