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