Changing license to GPL3 (and bumping version to 1.4.0).
[gnushogi.git] / gnushogi / dspwrappers.c
blob252f3de50153b4e9d0c1df2e17d48006f9199aeb
1 /*
2 * FILE: dspwrappers.c
4 * Wrapper functions which call analogous functions in rawdsp.c
5 * or cursesdsp.c depending on the interface.
7 * ----------------------------------------------------------------------
9 * Copyright (c) 2012 Free Software Foundation
11 * GNU SHOGI is based on GNU CHESS
13 * This file is part of GNU SHOGI.
15 * GNU Shogi is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 3 of the License,
18 * or (at your option) any later version.
20 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
21 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * for more details.
25 * You should have received a copy of the GNU General Public License along
26 * with GNU Shogi; see the file COPYING. If not, see
27 * <http://www.gnu.org/licenses/>.
28 * ----------------------------------------------------------------------
32 #include "gnushogi.h"
33 #include "dspwrappers.h"
34 #include "rawdsp.h"
35 #include "cursesdsp.h"
38 void
39 ChangeAlphaWindow(void)
41 switch (display_type)
43 case DISPLAY_RAW:
44 case DISPLAY_X:
45 Raw_ChangeAlphaWindow();
46 break;
48 case DISPLAY_CURSES:
49 Curses_ChangeAlphaWindow();
50 break;
55 void
56 ChangeBetaWindow(void)
58 switch (display_type)
60 case DISPLAY_RAW:
61 case DISPLAY_X:
62 Raw_ChangeBetaWindow();
63 break;
65 case DISPLAY_CURSES:
66 Curses_ChangeBetaWindow();
67 break;
72 void
73 ChangeHashDepth(void)
75 switch (display_type)
77 case DISPLAY_RAW:
78 case DISPLAY_X:
79 Raw_ChangeHashDepth();
80 break;
82 case DISPLAY_CURSES:
83 Curses_ChangeHashDepth();
84 break;
89 void
90 ChangeSearchDepth(void)
92 switch (display_type)
94 case DISPLAY_RAW:
95 case DISPLAY_X:
96 Raw_ChangeSearchDepth();
97 break;
99 case DISPLAY_CURSES:
100 Curses_ChangeSearchDepth();
101 break;
106 void
107 ChangeXwindow(void)
109 switch (display_type)
111 case DISPLAY_RAW:
112 case DISPLAY_X:
113 Raw_ChangeXwindow();
114 break;
116 case DISPLAY_CURSES:
117 Curses_ChangeXwindow();
118 break;
123 void
124 ClearScreen(void)
126 switch (display_type)
128 case DISPLAY_RAW:
129 case DISPLAY_X:
130 Raw_ClearScreen();
131 break;
133 case DISPLAY_CURSES:
134 Curses_ClearScreen();
135 break;
140 void
141 DoDebug(void)
143 switch (display_type)
145 case DISPLAY_RAW:
146 case DISPLAY_X:
147 Raw_DoDebug();
148 break;
150 case DISPLAY_CURSES:
151 Curses_DoDebug();
152 break;
157 void
158 DoTable(short table[NO_SQUARES])
160 switch (display_type)
162 case DISPLAY_RAW:
163 case DISPLAY_X:
164 Raw_DoTable(table);
165 break;
167 case DISPLAY_CURSES:
168 Curses_DoTable(table);
169 break;
174 void
175 EditBoard(void)
177 switch (display_type)
179 case DISPLAY_RAW:
180 case DISPLAY_X:
181 Raw_EditBoard();
182 break;
184 case DISPLAY_CURSES:
185 Curses_EditBoard();
186 break;
191 void
192 ExitShogi(void)
194 switch (display_type)
196 case DISPLAY_RAW:
197 case DISPLAY_X:
198 Raw_ExitShogi();
199 break;
201 case DISPLAY_CURSES:
202 Curses_ExitShogi();
203 break;
208 void
209 GiveHint(void)
211 switch (display_type)
213 case DISPLAY_RAW:
214 case DISPLAY_X:
215 Raw_GiveHint();
216 break;
218 case DISPLAY_CURSES:
219 Curses_GiveHint();
220 break;
225 void
226 Initialize(void)
228 switch (display_type)
230 case DISPLAY_RAW:
231 case DISPLAY_X:
232 Raw_Initialize();
233 break;
235 case DISPLAY_CURSES:
236 Curses_Initialize();
237 break;
242 void
243 OutputMove(void)
245 switch (display_type)
247 case DISPLAY_RAW:
248 case DISPLAY_X:
249 Raw_OutputMove();
250 break;
252 case DISPLAY_CURSES:
253 Curses_OutputMove();
254 break;
259 void
260 SetContempt(void)
262 switch (display_type)
264 case DISPLAY_RAW:
265 case DISPLAY_X:
266 Raw_SetContempt();
267 break;
269 case DISPLAY_CURSES:
270 Curses_SetContempt();
271 break;
276 void
277 SearchStartStuff(short side)
279 switch (display_type)
281 case DISPLAY_RAW:
282 case DISPLAY_X:
283 Raw_SearchStartStuff(side);
284 break;
286 case DISPLAY_CURSES:
287 Curses_SearchStartStuff(side);
288 break;
293 void
294 SelectLevel(char *sx)
296 switch (display_type)
298 case DISPLAY_RAW:
299 case DISPLAY_X:
300 Raw_SelectLevel(sx);
301 break;
303 case DISPLAY_CURSES:
304 Curses_SelectLevel(sx);
305 break;
310 void
311 ShowCurrentMove(short pnt, short f, short t)
313 switch (display_type)
315 case DISPLAY_RAW:
316 case DISPLAY_X:
317 Raw_ShowCurrentMove(pnt, f, t);
318 break;
320 case DISPLAY_CURSES:
321 Curses_ShowCurrentMove(pnt, f, t);
322 break;
327 void
328 ShowDepth(char ch)
330 switch (display_type)
332 case DISPLAY_RAW:
333 case DISPLAY_X:
334 Raw_ShowDepth(ch);
335 break;
337 case DISPLAY_CURSES:
338 Curses_ShowDepth(ch);
339 break;
344 void
345 ShowGameType(void)
347 switch (display_type)
349 case DISPLAY_RAW:
350 case DISPLAY_X:
351 Raw_ShowGameType();
352 break;
354 case DISPLAY_CURSES:
355 Curses_ShowGameType();
356 break;
361 void
362 ShowLine(unsigned short *bstline)
364 switch (display_type)
366 case DISPLAY_RAW:
367 case DISPLAY_X:
368 Raw_ShowLine(bstline);
369 break;
371 case DISPLAY_CURSES:
372 Curses_ShowLine(bstline);
373 break;
378 void
379 ShowMessage(char *s)
381 switch (display_type)
383 case DISPLAY_RAW:
384 case DISPLAY_X:
385 Raw_ShowMessage(s);
386 break;
388 case DISPLAY_CURSES:
389 Curses_ShowMessage(s);
390 break;
395 void
396 ShowPatternCount(short side, short n)
398 switch (display_type)
400 case DISPLAY_RAW:
401 case DISPLAY_X:
402 Raw_ShowPatternCount(side, n);
403 break;
405 case DISPLAY_CURSES:
406 Curses_ShowPatternCount(side, n);
407 break;
412 void
413 ShowPostnValue(short sq)
415 switch (display_type)
417 case DISPLAY_RAW:
418 case DISPLAY_X:
419 Raw_ShowPostnValue(sq);
420 break;
422 case DISPLAY_CURSES:
423 Curses_ShowPostnValue(sq);
424 break;
429 void
430 ShowPostnValues(void)
432 switch (display_type)
434 case DISPLAY_RAW:
435 case DISPLAY_X:
436 Raw_ShowPostnValues();
437 break;
439 case DISPLAY_CURSES:
440 Curses_ShowPostnValues();
441 break;
446 void
447 ShowResponseTime(void)
449 switch (display_type)
451 case DISPLAY_RAW:
452 case DISPLAY_X:
453 Raw_ShowResponseTime();
454 break;
456 case DISPLAY_CURSES:
457 Curses_ShowResponseTime();
458 break;
463 void
464 ShowResults(short score, unsigned short *bstline, char ch)
466 switch (display_type)
468 case DISPLAY_RAW:
469 case DISPLAY_X:
470 Raw_ShowResults(score, bstline, ch);
471 break;
473 case DISPLAY_CURSES:
474 Curses_ShowResults(score, bstline, ch);
475 break;
480 void
481 ShowSidetoMove(void)
483 switch (display_type)
485 case DISPLAY_RAW:
486 case DISPLAY_X:
487 Raw_ShowSidetoMove();
488 break;
490 case DISPLAY_CURSES:
491 Curses_ShowSidetoMove();
492 break;
497 void
498 ShowStage(void)
500 switch (display_type)
502 case DISPLAY_RAW:
503 case DISPLAY_X:
504 Raw_ShowStage();
505 break;
507 case DISPLAY_CURSES:
508 Curses_ShowStage();
509 break;
514 void
515 TerminateSearch(int sig)
517 switch (display_type)
519 case DISPLAY_RAW:
520 case DISPLAY_X:
521 Raw_TerminateSearch(sig);
522 break;
524 case DISPLAY_CURSES:
525 Curses_TerminateSearch(sig);
526 break;
531 void
532 UpdateDisplay(short f, short t, short redraw, short isspec)
534 switch (display_type)
536 case DISPLAY_RAW:
537 case DISPLAY_X:
538 Raw_UpdateDisplay(f, t, redraw, isspec);
539 break;
541 case DISPLAY_CURSES:
542 Curses_UpdateDisplay(f, t, redraw, isspec);
543 break;
548 void
549 help(void)
551 switch (display_type)
553 case DISPLAY_RAW:
554 case DISPLAY_X:
555 Raw_help();
556 break;
558 case DISPLAY_CURSES:
559 Curses_help();
560 break;