Updated all files to GPL version 3.
[xboard.git] / frontend.h
1 /*
2  * frontend.h -- Interface exported by all XBoard front ends
3  * $Id: frontend.h,v 2.2 2003/11/06 07:22:14 mann Exp $
4  *
5  * Copyright 1991 by Digital Equipment Corporation, Maynard,
6  * Massachusetts.  Enhancements Copyright
7  * 1992-2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software
8  * Foundation, Inc.
9  *
10  * The following terms apply to Digital Equipment Corporation's copyright
11  * interest in XBoard:
12  * ------------------------------------------------------------------------
13  * All Rights Reserved
14  *
15  * Permission to use, copy, modify, and distribute this software and its
16  * documentation for any purpose and without fee is hereby granted,
17  * provided that the above copyright notice appear in all copies and that
18  * both that copyright notice and this permission notice appear in
19  * supporting documentation, and that the name of Digital not be
20  * used in advertising or publicity pertaining to distribution of the
21  * software without specific, written prior permission.
22  *
23  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
24  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
25  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
26  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
27  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
29  * SOFTWARE.
30  * ------------------------------------------------------------------------
31  *
32  * The following terms apply to the enhanced version of XBoard
33  * distributed by the Free Software Foundation:
34  * ------------------------------------------------------------------------
35  *
36  * GNU XBoard is free software: you can redistribute it and/or modify
37  * it under the terms of the GNU General Public License as published by
38  * the Free Software Foundation, either version 3 of the License, or (at
39  * your option) any later version.
40  *
41  * GNU XBoard is distributed in the hope that it will be useful, but
42  * WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44  * General Public License for more details.
45  *
46  * You should have received a copy of the GNU General Public License
47  * along with this program. If not, see http://www.gnu.org/licenses/.  *
48  *
49  *------------------------------------------------------------------------
50  ** See the file ChangeLog for a revision history.  */
51
52 #ifndef _FRONTEND
53 #define _FRONTEND
54
55 #include <stdio.h>
56
57 typedef VOIDSTAR ProcRef;
58 #define NoProc ((ProcRef) 0)
59 typedef VOIDSTAR InputSourceRef;
60
61 void ModeHighlight P((void));
62 void SetICSMode P((void));
63 void SetGNUMode P((void));
64 void SetNCPMode P((void));
65 void SetCmailMode P((void));
66 void SetTrainingModeOn P((void));
67 void SetTrainingModeOff P((void));
68 void SetUserThinkingEnables P((void));
69 void SetMachineThinkingEnables P((void));
70 void DisplayTitle P((String title));
71 void DisplayMessage P((String message, String extMessage));
72 void DisplayError P((String message, int error));
73 void DisplayMoveError P((String message));
74
75 /* If status == 0, we are exiting with a benign message, not an error */
76 void DisplayFatalError P((String message, int error, int status));
77
78 void DisplayInformation P((String message));
79 void DisplayNote P((String message));
80 void AskQuestion P((String title, String question, String replyPrefix,
81                     ProcRef pr));
82 void DisplayIcsInteractionTitle P((String title));
83 void DrawPosition P((int fullRedraw, Board board));
84 void ResetFrontEnd P((void));
85 void CommentPopUp P((String title, String comment));
86 void CommentPopDown P((void));
87 void EditCommentPopUp P((int index, String title, String text));
88
89 void RingBell P((void));
90 void PlayIcsWinSound P((void));
91 void PlayIcsLossSound P((void));
92 void PlayIcsDrawSound P((void));
93 void PlayIcsUnfinishedSound P((void));
94 void PlayAlarmSound P((void));
95 void EchoOn P((void));
96 void EchoOff P((void));
97 void Raw P((void));
98 void Colorize P((ColorClass cc, int continuation));
99
100 char *UserName P((void));
101 char *HostName P((void));
102
103 int ClockTimerRunning P((void));
104 int StopClockTimer P((void));
105 void StartClockTimer P((long millisec));
106 void DisplayWhiteClock P((long timeRemaining, int highlight));
107 void DisplayBlackClock P((long timeRemaining, int highlight));
108
109 int LoadGameTimerRunning P((void));
110 int StopLoadGameTimer P((void));
111 void StartLoadGameTimer P((long millisec));
112 void AutoSaveGame P((void));
113
114 typedef void (*DelayedEventCallback) P((void));
115 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));
116 DelayedEventCallback GetDelayedEvent P((void));
117 void CancelDelayedEvent P((void));
118
119 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));
120 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));
121 void InterruptChildProcess P((ProcRef pr));
122
123 int OpenTelnet P((char *host, char *port, ProcRef *pr));
124 int OpenTCP P((char *host, char *port, ProcRef *pr));
125 int OpenCommPort P((char *name, ProcRef *pr));
126 int OpenLoopback P((ProcRef *pr));
127 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));
128
129 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,
130                                  char *buf, int count, int error));
131 /* pr == NoProc means the local keyboard */
132 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,
133                                  InputCallback func, VOIDSTAR closure));
134 void RemoveInputSource P((InputSourceRef isr));
135
136 /* pr == NoProc means the local display */
137 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));
138 int OutputToProcessDelayed P((ProcRef pr, char *message, int count,
139                               int *outError, long msdelay));
140
141 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,
142                                 char *buf, int count, int error));
143
144 extern ProcRef cmailPR;
145
146 /* these are in wgamelist.c */
147 void GameListPopUp P((FILE *fp, char *filename));
148 void GameListPopDown P((void));
149 void GameListHighlight P((int index));
150 void GameListDestroy P((void));
151
152 /* these are in wedittags.c */
153 void EditTagsPopUp P((char *tags));
154 void TagsPopUp P((char *tags, char *msg));
155 void TagsPopDown P((void));
156
157 void ICSInitScript P((void));
158 void StartAnalysisClock P((void));
159 void AnalysisPopUp P((char *title, char *label));
160 void AnalysisPopDown P((void));
161
162 void SetHighlights P((int fromX, int fromY, int toX, int toY));
163 void ClearHighlights P((void));
164 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));
165 void ClearPremoveHighlights P((void));
166
167 void ShutDownFrontEnd P((void));
168 void BoardToTop P((void));
169 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));
170 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));
171 void FreezeUI P((void));
172 void ThawUI P((void));
173 extern char *programName;
174
175 typedef struct FrontEndProgramStats_TAG {
176     int which;
177     int depth;
178     unsigned long nodes;
179     int score;
180     int time;
181     char * pv;
182     char * hint;
183     int an_move_index;
184     int an_move_count;
185 } FrontEndProgramStats;
186
187 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */
188
189 #endif