2 * frontend.h -- Interface exported by all XBoard front ends
4 * Copyright 1991 by Digital Equipment Corporation, Maynard,
7 * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8 * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
10 * Enhancements Copyright 2005 Alessandro Scotti
12 * The following terms apply to Digital Equipment Corporation's copyright
14 * ------------------------------------------------------------------------
17 * Permission to use, copy, modify, and distribute this software and its
18 * documentation for any purpose and without fee is hereby granted,
19 * provided that the above copyright notice appear in all copies and that
20 * both that copyright notice and this permission notice appear in
21 * supporting documentation, and that the name of Digital not be
22 * used in advertising or publicity pertaining to distribution of the
23 * software without specific, written prior permission.
25 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
26 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
27 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
28 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
29 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
30 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32 * ------------------------------------------------------------------------
34 * The following terms apply to the enhanced version of XBoard
35 * distributed by the Free Software Foundation:
36 * ------------------------------------------------------------------------
38 * GNU XBoard is free software: you can redistribute it and/or modify
39 * it under the terms of the GNU General Public License as published by
40 * the Free Software Foundation, either version 3 of the License, or (at
41 * your option) any later version.
43 * GNU XBoard is distributed in the hope that it will be useful, but
44 * WITHOUT ANY WARRANTY; without even the implied warranty of
45 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
46 * General Public License for more details.
48 * You should have received a copy of the GNU General Public License
49 * along with this program. If not, see http://www.gnu.org/licenses/. *
51 *------------------------------------------------------------------------
52 ** See the file ChangeLog for a revision history. */
59 typedef VOIDSTAR ProcRef;
60 #define NoProc ((ProcRef) 0)
61 typedef VOIDSTAR InputSourceRef;
63 char *T_ P((char *s));
64 void ModeHighlight P((void));
65 void SetICSMode P((void));
66 void SetGNUMode P((void));
67 void SetNCPMode P((void));
68 void SetCmailMode P((void));
69 void SetTrainingModeOn P((void));
70 void SetTrainingModeOff P((void));
71 void SetUserThinkingEnables P((void));
72 void SetMachineThinkingEnables P((void));
73 void DisplayTitle P((String title));
74 void DisplayMessage P((String message, String extMessage));
75 void DisplayError P((String message, int error));
76 void DisplayMoveError P((String message));
78 /* If status == 0, we are exiting with a benign message, not an error */
79 void DisplayFatalError P((String message, int error, int status));
81 void DisplayInformation P((String message));
82 void DisplayNote P((String message));
83 void AskQuestion P((String title, String question, String replyPrefix,
85 void DisplayIcsInteractionTitle P((String title));
86 void ParseArgsFromString P((char *p));
87 void ParseArgsFromFile P((FILE *f));
88 void DrawPosition P((int fullRedraw, Board board));
89 void ResetFrontEnd P((void));
90 void NotifyFrontendLogin P((void));
91 void CommentPopUp P((String title, String comment));
92 void CommentPopDown P((void));
93 void EditCommentPopUp P((int index, String title, String text));
94 void ErrorPopDown P((void));
95 int EventToSquare P((int x, int limit));
96 void DrawSeekAxis P(( int x, int y, int xTo, int yTo ));
97 void DrawSeekBackground P(( int left, int top, int right, int bottom ));
98 void DrawSeekText P((char *buf, int x, int y));
99 void DrawSeekDot P((int x, int y, int color));
100 void DrawSeekOpen P((void));
101 void DrawSeekClose P((void));
102 void PopUpMoveDialog P((char first));
104 void RingBell P((void));
105 void PlayIcsWinSound P((void));
106 void PlayIcsLossSound P((void));
107 void PlayIcsDrawSound P((void));
108 void PlayIcsUnfinishedSound P((void));
109 void PlayAlarmSound P((void));
110 void PlayTellSound P((void));
111 void PlaySoundFile P((char *name));
112 void PlaySoundByColor P((void));
113 void EchoOn P((void));
114 void EchoOff P((void));
116 void Colorize P((ColorClass cc, int continuation));
117 char *InterpretFileName P((char *name, char *dir));
118 void DoSleep P((int n));
120 char *UserName P((void));
121 char *HostName P((void));
123 int ClockTimerRunning P((void));
124 int StopClockTimer P((void));
125 void StartClockTimer P((long millisec));
126 void DisplayWhiteClock P((long timeRemaining, int highlight));
127 void DisplayBlackClock P((long timeRemaining, int highlight));
128 void UpdateLogos P((int display));
130 int LoadGameTimerRunning P((void));
131 int StopLoadGameTimer P((void));
132 void StartLoadGameTimer P((long millisec));
133 void AutoSaveGame P((void));
135 typedef void (*DelayedEventCallback) P((void));
136 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));
137 DelayedEventCallback GetDelayedEvent P((void));
138 void CancelDelayedEvent P((void));
139 // [HGM] mouse: next six used by mouse handler, which was moved to backend
140 extern int fromX, fromY, toX, toY;
141 typedef enum { Press, Release } ClickType;
142 void PromotionPopUp P((void));
143 void DragPieceBegin P((int x, int y, Boolean instantly));
144 void DragPieceEnd P((int x, int y));
145 void DragPieceMove P((int x, int y));
146 void LeftClick P((ClickType c, int x, int y));
147 int RightClick P((ClickType c, int x, int y, int *col, int *row));
149 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));
150 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));
151 void InterruptChildProcess P((ProcRef pr));
152 void RunCommand P((char *buf));
154 int OpenTelnet P((char *host, char *port, ProcRef *pr));
155 int OpenTCP P((char *host, char *port, ProcRef *pr));
156 int OpenCommPort P((char *name, ProcRef *pr));
157 int OpenLoopback P((ProcRef *pr));
158 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));
160 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,
161 char *buf, int count, int error));
162 /* pr == NoProc means the local keyboard */
163 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,
164 InputCallback func, VOIDSTAR closure));
165 void RemoveInputSource P((InputSourceRef isr));
167 /* pr == NoProc means the local display */
168 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));
169 int OutputToProcessDelayed P((ProcRef pr, char *message, int count,
170 int *outError, long msdelay));
172 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,
173 char *buf, int count, int error));
175 extern ProcRef cmailPR;
176 extern int shiftKey, controlKey;
178 /* in xgamelist.c or winboard.c */
179 void GLT_ClearList();
180 void GLT_DeSelectList();
181 void GLT_AddToList( char *name );
182 Boolean GLT_GetFromList( int index, char *name );
184 extern char lpUserGLT[];
185 extern char *homeDir;
187 /* these are in wgamelist.c */
188 void GameListPopUp P((FILE *fp, char *filename));
189 void GameListPopDown P((void));
190 void GameListHighlight P((int index));
191 void GameListDestroy P((void));
193 /* these are in wedittags.c */
194 void EditTagsPopUp P((char *tags, char **dest));
195 void TagsPopUp P((char *tags, char *msg));
196 void TagsPopDown P((void));
198 void ParseIcsTextColors P((void));
199 void ICSInitScript P((void));
200 void StartAnalysisClock P((void));
201 void EngineOutputPopUp P((void));
202 void EgineOutputPopDown P((void));
204 void SetHighlights P((int fromX, int fromY, int toX, int toY));
205 void ClearHighlights P((void));
206 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));
207 void ClearPremoveHighlights P((void));
209 void AnimateAtomicCapture P((Board board, int fromX, int fromY, int toX, int toY));
210 void ShutDownFrontEnd P((void));
211 void BoardToTop P((void));
212 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));
213 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));
214 void FreezeUI P((void));
215 void ThawUI P((void));
216 void ChangeDragPiece P((ChessSquare piece));
217 void CopyFENToClipboard P((void));
218 extern char *programName;
219 extern int commentUp;
220 extern char *firstChessProgramNames;
222 void GreyRevert P((Boolean grey));
223 void MarkMenuItem P((char *menuRef, int state));
224 void EnableNamedMenuItem P((char *menuRef, int state));
226 typedef struct FrontEndProgramStats_TAG {
236 } FrontEndProgramStats;
238 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */
240 void EngineOutputPopUp P((void));
241 void EngineOutputPopDown P((void));
242 int EngineOutputIsUp P((void));
243 int EngineOutputDialogExists P((void));
244 void EvalGraphPopUp P((void));
245 Boolean EvalGraphIsUp P((void));
246 int EvalGraphDialogExists P((void));
247 void SlavePopUp P((void));
249 /* these are in xhistory.c */
250 Boolean MoveHistoryIsUp P((void));
251 void HistoryPopUp P((void));
253 #endif /* XB_FRONTEND */