2 * backend.h -- Interface exported by XBoard back end
\r
3 * $Id: backend.h,v 2.1 2003/10/27 19:21:00 mann Exp $
\r
5 * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
\r
6 * Enhancements Copyright 1992-95 Free Software Foundation, Inc.
\r
8 * The following terms apply to Digital Equipment Corporation's copyright
\r
9 * interest in XBoard:
\r
10 * ------------------------------------------------------------------------
\r
11 * All Rights Reserved
\r
13 * Permission to use, copy, modify, and distribute this software and its
\r
14 * documentation for any purpose and without fee is hereby granted,
\r
15 * provided that the above copyright notice appear in all copies and that
\r
16 * both that copyright notice and this permission notice appear in
\r
17 * supporting documentation, and that the name of Digital not be
\r
18 * used in advertising or publicity pertaining to distribution of the
\r
19 * software without specific, written prior permission.
\r
21 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
\r
22 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
\r
23 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
\r
24 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
\r
25 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
\r
26 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
\r
28 * ------------------------------------------------------------------------
\r
30 * The following terms apply to the enhanced version of XBoard distributed
\r
31 * by the Free Software Foundation:
\r
32 * ------------------------------------------------------------------------
\r
33 * This program is free software; you can redistribute it and/or modify
\r
34 * it under the terms of the GNU General Public License as published by
\r
35 * the Free Software Foundation; either version 2 of the License, or
\r
36 * (at your option) any later version.
\r
38 * This program is distributed in the hope that it will be useful,
\r
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
41 * GNU General Public License for more details.
\r
43 * You should have received a copy of the GNU General Public License
\r
44 * along with this program; if not, write to the Free Software
\r
45 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
46 * ------------------------------------------------------------------------
\r
52 #include "frontend.h"
\r
54 extern int gotPremove;
\r
55 extern GameMode gameMode;
\r
56 extern int pausing, cmailMsgLoaded, flipView;
\r
57 extern char white_holding[], black_holding[];
\r
58 extern int currentMove, backwardMostMove, forwardMostMove;
\r
59 extern int blackPlaysFirst;
\r
60 extern FILE *debugFP;
\r
61 extern char* programVersion;
\r
62 extern ProcRef firstProgramPR, secondProgramPR;
\r
63 extern Board boards[];
\r
65 char *CmailMsg P((void));
\r
66 /* Tord: Added the useFEN960 parameter in PositionToFEN() below */
\r
67 char *PositionToFEN P((int move, int useFEN960));
\r
68 void AlphaRank P((char *s, int n)); /* [HGM] Shogi move preprocessor */
\r
69 void EditPositionPasteFEN P((char *fen));
\r
70 void TimeDelay P((long ms));
\r
71 void SendMultiLineToICS P(( char *text ));
\r
72 void AnalysisPeriodicEvent P((int force));
\r
73 void SetWhiteToPlayEvent P((void));
\r
74 void SetBlackToPlayEvent P((void));
\r
75 void InitBackEnd1 P((void));
\r
76 void InitBackEnd2 P((void));
\r
77 int IsPromotion P((int fromX, int fromY, int toX, int toY));
\r
78 int InPalace P((int row, int column));
\r
79 int PieceForSquare P((int x, int y));
\r
80 int OKToStartUserMove P((int x, int y));
\r
81 void Reset P((int redraw, int init));
\r
82 void ResetGameEvent P((void));
\r
83 int LoadGame P((FILE *f, int n, char *title, int useList));
\r
84 int LoadGameFromFile P((char *filename, int n, char *title, int useList));
\r
85 int CmailLoadGame P((FILE *f, int n, char *title, int useList));
\r
86 int ReloadGame P((int offset));
\r
87 int SaveGame P((FILE *f, int dummy, char *dummy2));
\r
88 int SaveGameToFile P((char *filename, int append));
\r
89 int LoadPosition P((FILE *f, int n, char *title));
\r
90 int ReloadPosition P((int offset));
\r
91 int SavePosition P((FILE *f, int dummy, char *dummy2));
\r
92 void EditPositionEvent P((void));
\r
93 void FlipViewEvent P((void));
\r
94 void MachineWhiteEvent P((void));
\r
95 void MachineBlackEvent P((void));
\r
96 void TwoMachinesEvent P((void));
\r
97 void EditGameEvent P((void));
\r
98 void TrainingEvent P((void));
\r
99 void IcsClientEvent P((void));
\r
100 void ForwardEvent P((void));
\r
101 void BackwardEvent P((void));
\r
102 void ToEndEvent P((void));
\r
103 void ToStartEvent P((void));
\r
104 void ToNrEvent P((int to));
\r
105 void RevertEvent P((void));
\r
106 void RetractMoveEvent P((void));
\r
107 void MoveNowEvent P((void));
\r
108 void TruncateGameEvent P((void));
\r
109 void PauseEvent P((void));
\r
110 void CallFlagEvent P((void));
\r
111 void AcceptEvent P((void));
\r
112 void DeclineEvent P((void));
\r
113 void RematchEvent P((void));
\r
114 void DrawEvent P((void));
\r
115 void AbortEvent P((void));
\r
116 void AdjournEvent P((void));
\r
117 void ResignEvent P((void));
\r
118 void UserAdjudicationEvent P((int result));
\r
119 void StopObservingEvent P((void));
\r
120 void StopExaminingEvent P((void));
\r
121 void PonderNextMoveEvent P((int newState));
\r
122 void NewSettingeEvent P((int option, char *command, int value));
\r
123 void ShowThinkingEvent P(());
\r
124 void PeriodicUpdatesEvent P((int newState));
\r
125 void HintEvent P((void));
\r
126 void BookEvent P((void));
\r
127 void AboutGameEvent P((void));
\r
128 void ExitEvent P((int status));
\r
129 char *DefaultFileName P((char *));
\r
130 ChessMove UserMoveTest P((int fromX, int fromY, int toX, int toY, int promoChar));
\r
131 void UserMoveEvent P((int fromX, int fromY, int toX, int toY, int promoChar));
\r
132 void DecrementClocks P((void));
\r
133 char *TimeString P((long millisec));
\r
134 void AutoPlayGameLoop P((void));
\r
135 void AdjustClock P((Boolean which, int dir));
\r
136 void DisplayBothClocks P((void));
\r
137 void EditPositionMenuEvent P((ChessSquare selection, int x, int y));
\r
138 void DropMenuEvent P((ChessSquare selection, int x, int y));
\r
139 int ParseTimeControl P((char *tc, int ti, int mps));
\r
140 void ProcessICSInitScript P((FILE * f));
\r
141 void EditCommentEvent P((void));
\r
142 void ReplaceComment P((int index, char *text));
\r
143 int ReplaceTags P((char *tags, GameInfo *gi));/* returns nonzero on error */
\r
144 void AppendComment P((int index, char *text));
\r
145 void ReloadCmailMsgEvent P((int unregister));
\r
146 void MailMoveEvent P((void));
\r
147 void EditTagsEvent P((void));
\r
148 void GetMoveListEvent P((void));
\r
149 void ExitAnalyzeMode P((void));
\r
150 void AnalyzeModeEvent P((void));
\r
151 void AnalyzeFileEvent P((void));
\r
152 void DoEcho P((void));
\r
153 void DontEcho P((void));
\r
154 void TidyProgramName P((char *prog, char *host, char *buf));
\r
155 void AskQuestionEvent P((char *title, char *question,
\r
156 char *replyPrefix, char *which));
\r
157 Boolean ParseOneMove P((char *move, int moveNum,
\r
158 ChessMove *moveType, int *fromX, int *fromY,
\r
159 int *toX, int *toY, char *promoChar));
\r
160 char *VariantName P((VariantClass v));
\r
161 VariantClass StringToVariant P((char *e));
\r
163 char *StrStr P((char *string, char *match));
\r
164 char *StrCaseStr P((char *string, char *match));
\r
165 char *StrSave P((char *s));
\r
166 char *StrSavePtr P((char *s, char **savePtr));
\r
169 int StrCaseCmp P((char *s1, char *s2));
\r
170 int ToLower P((int c));
\r
171 int ToUpper P((int c));
\r
173 #define StrCaseCmp Stricmp /* Use utility.library functions */
\r
174 #include <proto/utility.h>
\r
177 extern GameInfo gameInfo;
\r
180 /* pgntags.c prototypes
\r
182 char *PGNTags P((GameInfo *));
\r
183 void PrintPGNTags P((FILE *f, GameInfo *));
\r
184 int ParsePGNTag P((char *, GameInfo *));
\r
185 char *PGNResult P((ChessMove result));
\r
188 /* gamelist.c prototypes
\r
190 /* A game node in the double linked list of games.
\r
192 typedef struct _ListGame {
\r
195 unsigned long offset; /* Byte offset of game within file. */
\r
196 GameInfo gameInfo; /* Note that some entries may be NULL. */
\r
199 extern List gameList;
\r
200 void ClearGameInfo P((GameInfo *));
\r
201 int GameListBuild P((FILE *));
\r
202 void GameListInitGameInfo P((GameInfo *));
\r
203 char *GameListLine P((int, GameInfo *));
\r
204 char * GameListLineFull P(( int, GameInfo *));
\r
206 extern char* StripHighlight P((char *)); /* returns static data */
\r
207 extern char* StripHighlightAndTitle P((char *)); /* returns static data */
\r
209 typedef struct _CPS {
\r
213 InputSourceRef isr;
\r
214 char *twoMachinesColor; /* "white\n" or "black\n" */
\r
218 struct _CPS *other;
\r
220 char *computerString;
\r
221 int sendTime; /* 0=don't, 1=do, 2=test */
\r
222 int sendDrawOffers;
\r
225 int offeredDraw; /* countdown */
\r
227 int useSetboard; /* 0=use "edit"; 1=use "setboard" */
\r
228 int useSAN; /* 0=use coordinate notation; 1=use SAN */
\r
229 int usePing; /* 0=not OK to use ping; 1=OK */
\r
232 int usePlayother;/* 0=not OK to use playother; 1=OK */
\r
233 int useColors; /* 0=avoid obsolete white/black commands; 1=use them */
\r
234 int useUsermove; /* 0=just send move; 1=send "usermove move" */
\r
235 int sendICS; /* 0=don't use "ics" command; 1=do */
\r
236 int sendName; /* 0=don't use "name" command; 1=do */
\r
237 int sdKludge; /* 0=use "sd DEPTH" command; 1=use "depth\nDEPTH" */
\r
238 int stKludge; /* 0=use "st TIME" command; 1=use "level 1 TIME" */
\r
239 char tidy[MSG_SIZ];
\r
241 char variants[MSG_SIZ];
\r
242 int analysisSupport;
\r
244 int protocolVersion;
\r
247 /* Added by Tord: */
\r
248 int useFEN960; /* 0=use "KQkq" style FENs, 1=use "HAha" style FENs */
\r
249 int useOOCastle; /* 0="O-O" notation for castling, 1="king capture rook" notation */
\r
250 /* End of additions by Tord */
\r
252 int scoreIsAbsolute; /* [AS] 0=don't know (standard), 1=score is always from white side */
\r
253 int isUCI; /* [AS] 0=no (Winboard), 1=UCI (requires Polyglot) */
\r
254 int hasOwnBookUCI; /* [AS] 0=use GUI or Polyglot book, 1=has own book */
\r
256 /* [HGM] time odds */
\r
257 int timeOdds; /* factor through which we divide time for this engine */
\r
258 int debug; /* [HGM] ignore engine debug lines starting with '#' */
\r
259 int maxNrOfSessions; /* [HGM] secondary TC: max args in 'level' command */
\r
260 int accumulateTC; /* [HGM] secondary TC: how to handle extra sessions */
\r
261 int nps; /* [HGM] nps: factor for node count to replace time */
\r
263 int alphaRank; /* [HGM] shogi: engine uses shogi-type coordinates */
\r
264 int maxCores; /* [HGM] SMP: engine understands cores command */
\r
265 int memSize; /* [HGM] memsize: engine understands memory command */
\r
266 char egtFormats[MSG_SIZ]; /* [HGM] EGT: supported tablebase formats */
267 int bookSuspend; /* HGM book: go was deferred bcause of book hit */
\r
268 } ChessProgramState;
\r
270 extern ChessProgramState first, second;
\r
272 /* [AS] Search stats from chessprogram, for the played move */
\r
274 int score; /* Centipawns */
\r
275 int depth; /* Plies */
\r
276 int time; /* Milliseconds */
\r
277 } ChessProgramStats_Move;
\r
279 extern ChessProgramStats_Move pvInfoList[MAX_MOVES];
\r
280 extern shuffleOpenings;
\r
282 #endif /* _BACKEND */
\r