Updated copyright notice to 2015
[xboard.git] / frontend.h
1 /*
2  * frontend.h -- Interface exported by all XBoard front ends
3  *
4  * Copyright 1991 by Digital Equipment Corporation, Maynard,
5  * Massachusetts.
6  *
7  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8  * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
9  *
10  * Enhancements Copyright 2005 Alessandro Scotti
11  *
12  * The following terms apply to Digital Equipment Corporation's copyright
13  * interest in XBoard:
14  * ------------------------------------------------------------------------
15  * All Rights Reserved
16  *
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.
24  *
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
31  * SOFTWARE.
32  * ------------------------------------------------------------------------
33  *
34  * The following terms apply to the enhanced version of XBoard
35  * distributed by the Free Software Foundation:
36  * ------------------------------------------------------------------------
37  *
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.
42  *
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.
47  *
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/.  *
50  *
51  *------------------------------------------------------------------------
52  ** See the file ChangeLog for a revision history.  */
53
54 #ifndef XB_FRONTEND
55 #define XB_FRONTEND
56
57 #include <stdio.h>
58
59 char *T_ P((char *s));
60 void ModeHighlight P((void));
61 void SetICSMode P((void));
62 void SetGNUMode P((void));
63 void SetNCPMode P((void));
64 void SetCmailMode P((void));
65 void SetTrainingModeOn P((void));
66 void SetTrainingModeOff P((void));
67 void SetUserThinkingEnables P((void));
68 void SetMachineThinkingEnables P((void));
69 void DisplayTitle P((String title));
70 void DisplayMessage P((String message, String extMessage));
71 void DisplayMoveError P((String message));
72
73 void DisplayNote P((String message));
74
75 void DisplayInformation P((String message));
76 void AskQuestion P((String title, String question, String replyPrefix,
77                     ProcRef pr));
78 void DisplayIcsInteractionTitle P((String title));
79 void ParseArgsFromString P((char *p));
80 void ParseArgsFromFile P((FILE *f));
81 void DrawPosition P((int fullRedraw, Board board));
82 void ResetFrontEnd P((void));
83 void NotifyFrontendLogin P((void));
84 void CommentPopUp P((String title, String comment));
85 void CommentPopDown P((void));
86 void EditCommentPopUp P((int index, String title, String text));
87 void ErrorPopDown P((void));
88 int  EventToSquare P((int x, int limit));
89 void DrawSeekAxis P(( int x, int y, int xTo, int yTo ));
90 void DrawSeekBackground P(( int left, int top, int right, int bottom ));
91 void DrawSeekText P((char *buf, int x, int y));
92 void DrawSeekDot P((int x, int y, int color));
93 void PopUpMoveDialog P((char first));
94
95 void RingBell P((void));
96 int  Roar P((void));
97 void PlayIcsWinSound P((void));
98 void PlayIcsLossSound P((void));
99 void PlayIcsDrawSound P((void));
100 void PlayIcsUnfinishedSound P((void));
101 void PlayAlarmSound P((void));
102 void PlayTellSound P((void));
103 int  PlaySoundFile P((char *name));
104 void PlaySoundByColor P((void));
105 void EchoOn P((void));
106 void EchoOff P((void));
107 void Raw P((void));
108 void Colorize P((ColorClass cc, int continuation));
109 char *InterpretFileName P((char *name, char *dir));
110 void DoSleep P((int n));
111 void DoEvents P((void));
112
113 char *UserName P((void));
114 char *HostName P((void));
115
116 int ClockTimerRunning P((void));
117 int StopClockTimer P((void));
118 void StartClockTimer P((long millisec));
119 void DisplayWhiteClock P((long timeRemaining, int highlight));
120 void DisplayBlackClock P((long timeRemaining, int highlight));
121 void UpdateLogos P((int display));
122
123 int LoadGameTimerRunning P((void));
124 int StopLoadGameTimer P((void));
125 void StartLoadGameTimer P((long millisec));
126 void AutoSaveGame P((void));
127
128 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));
129 DelayedEventCallback GetDelayedEvent P((void));
130 void CancelDelayedEvent P((void));
131 // [HGM] mouse: next six used by mouse handler, which was moved to backend
132 extern int fromX, fromY, toX, toY;
133 void PromotionPopUp P((char choice));
134 void DragPieceBegin P((int x, int y, Boolean instantly));
135 void DragPieceEnd P((int x, int y));
136 void DragPieceMove P((int x, int y));
137 void LeftClick P((ClickType c, int x, int y));
138 int  RightClick P((ClickType c, int x, int y, int *col, int *row));
139
140 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));
141 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));
142 void InterruptChildProcess P((ProcRef pr));
143 void RunCommand P((char *buf));
144
145 int OpenTelnet P((char *host, char *port, ProcRef *pr));
146 int OpenTCP P((char *host, char *port, ProcRef *pr));
147 int OpenCommPort P((char *name, ProcRef *pr));
148 int OpenLoopback P((ProcRef *pr));
149 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));
150
151 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,
152                                  char *buf, int count, int error));
153 /* pr == NoProc means the local keyboard */
154 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,
155                                  InputCallback func, VOIDSTAR closure));
156 void RemoveInputSource P((InputSourceRef isr));
157
158 /* pr == NoProc means the local display */
159 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));
160 int OutputToProcessDelayed P((ProcRef pr, char *message, int count,
161                               int *outError, long msdelay));
162
163 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,
164                                 char *buf, int count, int error));
165
166 extern ProcRef cmailPR;
167 extern int shiftKey, controlKey;
168
169 /* in xgamelist.c or winboard.c */
170 void GLT_ClearList();
171 void GLT_DeSelectList();
172 void GLT_AddToList( char *name );
173 Boolean GLT_GetFromList( int index, char *name );
174
175 extern char lpUserGLT[];
176 extern char *homeDir;
177
178 /* these are in wgamelist.c */
179 void GameListPopUp P((FILE *fp, char *filename));
180 void GameListPopDown P((void));
181 void GameListHighlight P((int index));
182 void GameListDestroy P((void));
183 void GameListUpdate P((void));
184 FILE *GameFile P((void));
185
186 /* these are in wedittags.c */
187 void EditTagsPopUp P((char *tags, char **dest));
188 void TagsPopUp P((char *tags, char *msg));
189 void TagsPopDown P((void));
190
191 void ParseIcsTextColors P((void));
192 int  ICSInitScript P((void));
193 void StartAnalysisClock P((void));
194 void EngineOutputPopUp P((void));
195 void EgineOutputPopDown P((void));
196
197 void SetHighlights P((int fromX, int fromY, int toX, int toY));
198 void ClearHighlights P((void));
199 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));
200 void ClearPremoveHighlights P((void));
201
202 void AnimateAtomicCapture P((Board board, int fromX, int fromY, int toX, int toY));
203 void ShutDownFrontEnd P((void));
204 void BoardToTop P((void));
205 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));
206 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));
207 void FreezeUI P((void));
208 void ThawUI P((void));
209 void ChangeDragPiece P((ChessSquare piece));
210 void CopyFENToClipboard P((void));
211 extern char *programName;
212 extern int commentUp;
213 extern char *firstChessProgramNames;
214
215 void GreyRevert P((Boolean grey));
216 void EnableNamedMenuItem P((char *menuRef, int state));
217
218 typedef struct FrontEndProgramStats_TAG {
219     int which;
220     int depth;
221     u64 nodes;
222     int score;
223     int time;
224     char * pv;
225     char * hint;
226     int an_move_index;
227     int an_move_count;
228 } FrontEndProgramStats;
229
230 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */
231
232 void EngineOutputPopUp P((void));
233 void EngineOutputPopDown P((void));
234 int  EngineOutputIsUp P((void));
235 int  EngineOutputDialogExists P((void));
236 void EvalGraphPopUp P((void));
237 Boolean EvalGraphIsUp P((void));
238 int  EvalGraphDialogExists P((void));
239 void SlavePopUp P((void));
240 void ActivateTheme P((int new));
241 char *Col2Text P((int n));
242
243 /* these are in xhistory.c  */
244 Boolean MoveHistoryIsUp P((void));
245 void HistoryPopUp P((void));
246 void FindMoveByCharIndex P(( int char_index ));
247
248 #endif /* XB_FRONTEND */