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