Fix PGN saving with annotations.
[cboard.git] / src / engine.h
blobce54b60247bb38b7d7a91568ea9423c7a9a8e80c
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2002-2006 Ben Kibbey <bjk@luxsci.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef ENGINE_H
20 #define ENGINE_H
22 #if 0
23 #define RETURN status.engine = ENGINE_READY; \
24 return
25 #endif
26 #define RETURN return
28 #define SEND_TO_ENGINE(fmt, args...) (engine_initialized) ? \
29 send_to_engine(fmt, ##args) : 0
31 enum {
32 ENGINE_OFFLINE = -1, ENGINE_READY, ENGINE_THINKING, ENGINE_INITIALIZING
35 enum {
36 HUMAN, ENGINE
39 pid_t enginepid;
41 /* Chess engine file descriptors. 0 = from, 1 = to. */
42 int enginefd[2];
43 int engine_initialized;
45 // This is a failsafe when resuming a game.
46 int oldhistorytotal;
48 void send_to_engine(const char *format, ...);
49 int start_chess_engine();
50 void set_engine_defaults();
51 void stop_engine();
52 int save_pgn(const char *filename, int isfifo, int saveindex);
54 #endif