7590dcbbc4725ba0375d1ed0ce9b987830eae4a2
[gnushogi.git] / gnushogi / dspwrappers.c
1 /*
2  * FILE: dspwrappers.c
3  *
4  *     Wrapper functions which call analogous functions in rawdsp.c
5  *     or cursesdsp.c depending on the interface.
6  *
7  * ----------------------------------------------------------------------
8  * Copyright (c) 1993, 1994, 1995 Matthias Mutz
9  * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
10  *
11  * GNU SHOGI is based on GNU CHESS
12  *
13  * Copyright (c) 1988, 1989, 1990 John Stanback
14  * Copyright (c) 1992 Free Software Foundation
15  *
16  * This file is part of GNU SHOGI.
17  *
18  * GNU Shogi is free software; you can redistribute it and/or modify it
19  * under the terms of the GNU General Public License as published by the
20  * Free Software Foundation; either version 3 of the License,
21  * or (at your option) any later version.
22  *
23  * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
24  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26  * for more details.
27  *
28  * You should have received a copy of the GNU General Public License along
29  * with GNU Shogi; see the file COPYING. If not, see
30  * <http://www.gnu.org/licenses/>.
31  * ----------------------------------------------------------------------
32  *
33  */
34
35 #include "gnushogi.h"
36 #include "dspwrappers.h"
37 #include "rawdsp.h"
38 #include "cursesdsp.h"
39
40 #define CASE_DSP_RAW(func,args) \
41   case DISPLAY_RAW:             \
42   case DISPLAY_X:               \
43     func args;                  \
44     break
45
46 #ifdef HAVE_LIBCURSES
47 #define CASE_DSP_CURSES(func,args) \
48   case DISPLAY_CURSES:             \
49     func args;                     \
50     break;
51 #else
52 #define CASE_DSP_CURSES(func,args)
53 #endif
54
55 #define DISPLAY_FUNC(func,argsdecl,args)        \
56   void func argsdecl                            \
57   {                                             \
58     switch (display_type) {                     \
59       CASE_DSP_RAW(Raw_ ## func, args);         \
60       CASE_DSP_CURSES(Curses_ ## func, args);   \
61     }                                           \
62   }
63 #define DISPLAY_VOIDFUNC(func)                  \
64   DISPLAY_FUNC(func,(void),())
65
66 DISPLAY_VOIDFUNC(ChangeAlphaWindow)
67 DISPLAY_VOIDFUNC(ChangeBetaWindow)
68 DISPLAY_VOIDFUNC(ChangeHashDepth)
69 DISPLAY_VOIDFUNC(ChangeSearchDepth)
70 DISPLAY_VOIDFUNC(ChangeXwindow)
71 DISPLAY_VOIDFUNC(ClearScreen)
72 DISPLAY_VOIDFUNC(DoDebug)
73 DISPLAY_FUNC(DoTable, (short table[NO_SQUARES]), (table))
74 DISPLAY_VOIDFUNC(EditBoard)
75 DISPLAY_VOIDFUNC(ExitShogi)
76 DISPLAY_VOIDFUNC(GiveHint)
77 DISPLAY_VOIDFUNC(Initialize)
78 DISPLAY_VOIDFUNC(OutputMove)
79 DISPLAY_VOIDFUNC(SetContempt)
80 DISPLAY_FUNC(SearchStartStuff, (short side), (side))
81 DISPLAY_FUNC(SelectLevel, (char *sx), (sx))
82 DISPLAY_FUNC(ShowCurrentMove, (short pnt, short f, short t), (pnt, f, t))
83 DISPLAY_FUNC(ShowDepth, (char ch), (ch))
84 DISPLAY_VOIDFUNC(ShowGameType)
85 DISPLAY_FUNC(ShowLine, (unsigned short *bstline), (bstline))
86 DISPLAY_FUNC(ShowMessage, (char *s), (s))
87 DISPLAY_FUNC(ShowPatternCount, (short side, short n), (side, n))
88 DISPLAY_FUNC(ShowPostnValue, (short sq), (sq))
89 DISPLAY_VOIDFUNC(ShowPostnValues)
90 DISPLAY_VOIDFUNC(ShowResponseTime)
91 DISPLAY_FUNC(ShowResults, (short score, unsigned short *bstline, char ch), (score, bstline, ch))
92 DISPLAY_VOIDFUNC(ShowSidetoMove)
93 DISPLAY_VOIDFUNC(ShowStage)
94 DISPLAY_FUNC(TerminateSearch, (int sig), (sig))
95 DISPLAY_FUNC(UpdateDisplay, (short f, short t, short redraw, short isspec), (f, t, redraw, isspec))
96 DISPLAY_VOIDFUNC(help)