if ((f == t) && ((f != 0) || (t != 0)))
{
- if (!barebones)
- {
- if (NOT_CURSES)
- printf("error in algbr: FROM=TO=%d, flag=0x%4x\n", t, flag);
- else
- printw("error in algbr: FROM=TO=%d, flag=0x%4x\n", t, flag);
+ if (!barebones) {
+ Printf("error in algbr: FROM=TO=%d, flag=0x%4x\n", t, flag);
}
mvstr[0][0] = mvstr[1][0] = mvstr[2][0] = mvstr[3][0] = '\0';
short sq;
short side, isp;
- if (savefile[0])
- {
+ if (savefile[0]) {
strcpy(fname, savefile);
- }
- else
- {
+ } else {
/* Enter file name */
ShowMessage(CP[63]);
-
- if (NOT_CURSES)
- {
- scanf("%s", fname);
- }
- else
- {
- fflush(stdout);
- scanw("%s", fname);
- }
+ RequestInputString(fname);
}
/* shogi.000 */
short side, piece;
char empty[2] = "\n";
- if (savefile[0])
- {
+ if (savefile[0]) {
strcpy(fname, savefile);
- }
- else
- {
+ } else {
/* Enter file name */
ShowMessage(CP[63]);
-
- if (NOT_CURSES)
- {
- scanf("%s", fname);
- }
- else
- {
- fflush(stdout);
- scanw("%s", fname);
- }
+ RequestInputString(fname);
}
if (fname[0] == '\0') /* shogi.000 */
/* Enter file name */
ShowMessage(CP[63]);
-
- if (NOT_CURSES)
- {
- scanf("%s", fname);
- }
- else
- {
- fflush(stdout);
- scanw("%s", fname);
- }
+ RequestInputString(fname);
if (fname[0] == '\0') /* XSHOGI.position.read */
strcpy(fname, CP[205]);
/* Enter file name */
ShowMessage(CP[63]);
-
- if (NOT_CURSES)
- {
- scanf("%s", fname);
- }
- else
- {
- fflush(stdout);
- scanw("%s", fname);
- }
+ RequestInputString(fname);
if (fname[0] == '\0') /* XSHOGI.position.read */
strcpy(fname, CP[205]);
char fname[256], sflags[4];
short i, j, f, t;
- if (savefile[0])
- {
+ if (savefile[0]) {
strcpy(fname, savefile);
- }
- else
- {
+ } else {
/* Enter file name */
ShowMessage(CP[63]);
-
- if (NOT_CURSES)
- {
- scanf("%s", fname);
- }
- else
- {
- fflush(stdout);
- scanw("%s", fname);
- }
+ RequestInputString(fname);
}
if (fname[0] == '\0')
void
+Curses_Printf(const char *format, ...)
+{
+ static char buffer[60];
+ va_list ap;
+ va_start(ap, format);
+ vsnprintf(buffer, sizeof(buffer), format, ap);
+ printw("%s", buffer);
+ va_end(ap);
+}
+
+
+void
+Curses_RequestInputString(char* buffer)
+{
+ FLUSH_SCANW("%s", buffer);
+}
+
+
+void
ShowNodeCnt(long NodeCnt)
{
gotoXY(TAB, 22);
void Curses_ShowGameType(void);
void Curses_ShowLine(unsigned short *bstline);
void Curses_ShowMessage(char *s);
+void Curses_Printf(const char *format, ...);
+void Curses_RequestInputString(char* buffer);
void Curses_ShowPatternCount(short side, short n);
void Curses_ShowPostnValue(short sq);
void Curses_ShowPostnValues(void);
#include "rawdsp.h"
#include "cursesdsp.h"
+#include <stdarg.h>
+
#define CASE_DSP_RAW(func,args) \
case DISPLAY_RAW: \
case DISPLAY_X: \
#define DISPLAY_VOIDFUNC(func) \
DISPLAY_FUNC(func,(void),())
+#define DISPLAY_STDARGFUNC(func,argsdecl,last,args) \
+ void func argsdecl \
+ { \
+ va_list ap; \
+ va_start(ap, last); \
+ switch (display_type) { \
+ CASE_DSP_RAW(Raw_ ## func, args); \
+ CASE_DSP_CURSES(Curses_ ## func, args); \
+ } \
+ va_end(ap); \
+ }
+
DISPLAY_VOIDFUNC(ChangeAlphaWindow)
DISPLAY_VOIDFUNC(ChangeBetaWindow)
DISPLAY_VOIDFUNC(ChangeHashDepth)
DISPLAY_VOIDFUNC(ShowGameType)
DISPLAY_FUNC(ShowLine, (unsigned short *bstline), (bstline))
DISPLAY_FUNC(ShowMessage, (char *s), (s))
+DISPLAY_STDARGFUNC(Printf, (const char *format, ...), format, (format, ap))
+DISPLAY_FUNC(RequestInputString, (char* buffer), (buffer))
DISPLAY_FUNC(ShowPatternCount, (short side, short n), (side, n))
DISPLAY_FUNC(ShowPostnValue, (short sq), (sq))
DISPLAY_VOIDFUNC(ShowPostnValues)
extern void ShowGameType(void);
extern void ShowLine(unsigned short *bstline);
extern void ShowMessage(char *s);
+extern void Printf(const char *format, ...);
+extern void RequestInputString(char* buffer);
extern void ShowPatternCount(short side, short n);
extern void ShowPostnValue(short sq);
extern void ShowPostnValues(void);
#include <ctype.h>
#include <signal.h>
+#include <stdarg.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/file.h>
void
+Raw_Printf(const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ vprintf(format, ap);
+ va_end(ap);
+}
+
+void
+Raw_RequestInputString(char* buffer)
+{
+ scanf("%s", buffer);
+}
+
+
+void
Raw_ShowPatternCount(short side, short n)
{
if (flag.post)
void Raw_ShowGameType(void);
void Raw_ShowLine(unsigned short *bstline);
void Raw_ShowMessage(char *s);
+void Raw_Printf(const char *format, ...);
+void Raw_RequestInputString(char* buffer);
void Raw_ShowPatternCount(short side, short n);
void Raw_ShowPostnValue(short sq);
void Raw_ShowPostnValues(void);