changes from H.G. Muller; version 4.3.13
[xboard.git] / frontend.h
1 /*\r
2  * frontend.h -- Interface exported by all XBoard front ends\r
3  * $Id: frontend.h,v 2.2 2003/11/06 07:22:14 mann Exp $\r
4  *\r
5  * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
6  * Enhancements Copyright 1992-95 Free Software Foundation, Inc.\r
7  *\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
12  *\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
20  *\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
27  * SOFTWARE.\r
28  * ------------------------------------------------------------------------\r
29  *\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
37  *\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
42  *\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
47  */\r
48 \r
49 #ifndef _FRONTEND\r
50 #define _FRONTEND\r
51 \r
52 #include <stdio.h>\r
53 \r
54 typedef VOIDSTAR ProcRef;\r
55 #define NoProc ((ProcRef) 0)\r
56 typedef VOIDSTAR InputSourceRef;\r
57 \r
58 void ModeHighlight P((void));\r
59 void SetICSMode P((void));\r
60 void SetGNUMode P((void));\r
61 void SetNCPMode P((void));\r
62 void SetCmailMode P((void));\r
63 void SetTrainingModeOn P((void));\r
64 void SetTrainingModeOff P((void));\r
65 void SetUserThinkingEnables P((void));\r
66 void SetMachineThinkingEnables P((void));\r
67 void DisplayTitle P((String title));\r
68 void DisplayMessage P((String message, String extMessage));\r
69 void DisplayError P((String message, int error));\r
70 void DisplayMoveError P((String message));\r
71 \r
72 /* If status == 0, we are exiting with a benign message, not an error */\r
73 void DisplayFatalError P((String message, int error, int status));\r
74 \r
75 void DisplayInformation P((String message));\r
76 void DisplayNote P((String message));\r
77 void AskQuestion P((String title, String question, String replyPrefix,\r
78                     ProcRef pr));\r
79 void DisplayIcsInteractionTitle P((String title));\r
80 void DrawPosition P((int fullRedraw, Board board));\r
81 void ResetFrontEnd P((void));\r
82 void CommentPopUp P((String title, String comment));\r
83 void CommentPopDown P((void));\r
84 void EditCommentPopUp P((int index, String title, String text));\r
85 \r
86 void RingBell P((void));\r
87 void PlayIcsWinSound P((void));\r
88 void PlayIcsLossSound P((void));\r
89 void PlayIcsDrawSound P((void));\r
90 void PlayIcsUnfinishedSound P((void));\r
91 void PlayAlarmSound P((void));\r
92 void EchoOn P((void));\r
93 void EchoOff P((void));\r
94 void Raw P((void));\r
95 void Colorize P((ColorClass cc, int continuation));\r
96 \r
97 char *UserName P((void));\r
98 char *HostName P((void));\r
99 \r
100 int ClockTimerRunning P((void));\r
101 int StopClockTimer P((void));\r
102 void StartClockTimer P((long millisec));\r
103 void DisplayWhiteClock P((long timeRemaining, int highlight));\r
104 void DisplayBlackClock P((long timeRemaining, int highlight));\r
105 \r
106 int LoadGameTimerRunning P((void));\r
107 int StopLoadGameTimer P((void));\r
108 void StartLoadGameTimer P((long millisec));\r
109 void AutoSaveGame P((void));\r
110 \r
111 typedef void (*DelayedEventCallback) P((void));\r
112 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));\r
113 DelayedEventCallback GetDelayedEvent P((void));\r
114 void CancelDelayedEvent P((void));\r
115 \r
116 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));\r
117 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));\r
118 void InterruptChildProcess P((ProcRef pr));\r
119 \r
120 int OpenTelnet P((char *host, char *port, ProcRef *pr));\r
121 int OpenTCP P((char *host, char *port, ProcRef *pr));\r
122 int OpenCommPort P((char *name, ProcRef *pr));\r
123 int OpenLoopback P((ProcRef *pr));\r
124 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));\r
125 \r
126 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,\r
127                                  char *buf, int count, int error));\r
128 /* pr == NoProc means the local keyboard */\r
129 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,\r
130                                  InputCallback func, VOIDSTAR closure));\r
131 void RemoveInputSource P((InputSourceRef isr));\r
132 \r
133 /* pr == NoProc means the local display */\r
134 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));\r
135 int OutputToProcessDelayed P((ProcRef pr, char *message, int count,\r
136                               int *outError, long msdelay));\r
137 \r
138 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,\r
139                                 char *buf, int count, int error));\r
140 \r
141 extern ProcRef cmailPR;\r
142 \r
143 /* these are in wgamelist.c */\r
144 void GameListPopUp P((FILE *fp, char *filename));\r
145 void GameListPopDown P((void));\r
146 void GameListHighlight P((int index));\r
147 void GameListDestroy P((void));\r
148 \r
149 /* these are in wedittags.c */\r
150 void EditTagsPopUp P((char *tags));\r
151 void TagsPopUp P((char *tags, char *msg));\r
152 void TagsPopDown P((void));\r
153 \r
154 void ICSInitScript P((void));\r
155 void StartAnalysisClock P((void));\r
156 void AnalysisPopUp P((char *title, char *label));\r
157 void AnalysisPopDown P((void));\r
158 \r
159 void SetHighlights P((int fromX, int fromY, int toX, int toY));\r
160 void ClearHighlights P((void));\r
161 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));\r
162 void ClearPremoveHighlights P((void));\r
163 \r
164 void ShutDownFrontEnd P((void));\r
165 void BoardToTop P((void));\r
166 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));\r
167 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));\r
168 void FreezeUI P((void));\r
169 void ThawUI P((void));\r
170 extern char *programName;\r
171 \r
172 typedef struct FrontEndProgramStats_TAG {\r
173     int which;\r
174     int depth;\r
175     unsigned long nodes;\r
176     int score;\r
177     int time;\r
178     char * pv;\r
179     char * hint;\r
180     int an_move_index;\r
181     int an_move_count;\r
182 } FrontEndProgramStats;\r
183 \r
184 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */\r
185 \r
186 #endif\r