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, 2016 Free 9 * Software Foundation, Inc. 10 * 11 * Enhancements Copyright 2005 Alessandro Scotti 12 * 13 * The following terms apply to Digital Equipment Corporation's copyright 14 * interest in XBoard: 15 * ------------------------------------------------------------------------ 16 * All Rights Reserved 17 * 18 * Permission to use, copy, modify, and distribute this software and its 19 * documentation for any purpose and without fee is hereby granted, 20 * provided that the above copyright notice appear in all copies and that 21 * both that copyright notice and this permission notice appear in 22 * supporting documentation, and that the name of Digital not be 23 * used in advertising or publicity pertaining to distribution of the 24 * software without specific, written prior permission. 25 * 26 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 27 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 28 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 29 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 31 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 32 * SOFTWARE. 33 * ------------------------------------------------------------------------ 34 * 35 * The following terms apply to the enhanced version of XBoard 36 * distributed by the Free Software Foundation: 37 * ------------------------------------------------------------------------ 38 * 39 * GNU XBoard is free software: you can redistribute it and/or modify 40 * it under the terms of the GNU General Public License as published by 41 * the Free Software Foundation, either version 3 of the License, or (at 42 * your option) any later version. 43 * 44 * GNU XBoard is distributed in the hope that it will be useful, but 45 * WITHOUT ANY WARRANTY; without even the implied warranty of 46 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 47 * General Public License for more details. 48 * 49 * You should have received a copy of the GNU General Public License 50 * along with this program. If not, see http://www.gnu.org/licenses/. * 51 * 52 *------------------------------------------------------------------------ 53 ** See the file ChangeLog for a revision history. */ 54 55 #ifndef XB_FRONTEND 56 #define XB_FRONTEND 57 58 #include <stdio.h> 59 60 char *T_ P((char *s)); 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 DisplayMoveError P((String message)); 73 74 void DisplayNote P((String message)); 75 76 void DisplayInformation P((String message)); 77 void AskQuestion P((String title, String question, String replyPrefix, 78 ProcRef pr)); 79 void DisplayIcsInteractionTitle P((String title)); 80 void ParseArgsFromString P((char *p)); 81 void ParseArgsFromFile P((FILE *f)); 82 void DrawPosition P((int fullRedraw, Board board)); 83 void ResetFrontEnd P((void)); 84 void NotifyFrontendLogin 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 void ErrorPopDown P((void)); 89 int EventToSquare P((int x, int limit)); 90 void DrawSeekAxis P(( int x, int y, int xTo, int yTo )); 91 void DrawSeekBackground P(( int left, int top, int right, int bottom )); 92 void DrawSeekText P((char *buf, int x, int y)); 93 void DrawSeekDot P((int x, int y, int color)); 94 void PopUpMoveDialog P((char first)); 95 96 void RingBell P((void)); 97 int Roar P((void)); 98 void PlayIcsWinSound P((void)); 99 void PlayIcsLossSound P((void)); 100 void PlayIcsDrawSound P((void)); 101 void PlayIcsUnfinishedSound P((void)); 102 void PlayAlarmSound P((void)); 103 void PlayTellSound P((void)); 104 int PlaySoundFile P((char *name)); 105 void PlaySoundByColor P((void)); 106 void EchoOn P((void)); 107 void EchoOff P((void)); 108 void Raw P((void)); 109 void Colorize P((ColorClass cc, int continuation)); 110 char *InterpretFileName P((char *name, char *dir)); 111 void DoSleep P((int n)); 112 void DoEvents P((void)); 113 114 char *UserName P((void)); 115 char *HostName P((void)); 116 117 int ClockTimerRunning P((void)); 118 int StopClockTimer P((void)); 119 void StartClockTimer P((long millisec)); 120 void DisplayWhiteClock P((long timeRemaining, int highlight)); 121 void DisplayBlackClock P((long timeRemaining, int highlight)); 122 void UpdateLogos P((int display)); 123 124 int LoadGameTimerRunning P((void)); 125 int StopLoadGameTimer P((void)); 126 void StartLoadGameTimer P((long millisec)); 127 void AutoSaveGame P((void)); 128 129 void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec)); 130 DelayedEventCallback GetDelayedEvent P((void)); 131 void CancelDelayedEvent P((void)); 132 // [HGM] mouse: next six used by mouse handler, which was moved to backend 133 extern int fromX, fromY, toX, toY; 134 void PromotionPopUp P((char choice)); 135 void DragPieceBegin P((int x, int y, Boolean instantly)); 136 void DragPieceEnd P((int x, int y)); 137 void DragPieceMove P((int x, int y)); 138 void LeftClick P((ClickType c, int x, int y)); 139 int RightClick P((ClickType c, int x, int y, int *col, int *row)); 140 void Wheel P((int dir, int x, int y)); 141 142 int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr)); 143 void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal)); 144 void InterruptChildProcess P((ProcRef pr)); 145 char *BufferCommandOutput P((char *command, int size)); 146 void RunCommand P((char *buf)); 147 148 int OpenTelnet P((char *host, char *port, ProcRef *pr)); 149 int OpenTCP P((char *host, char *port, ProcRef *pr)); 150 int OpenCommPort P((char *name, ProcRef *pr)); 151 int OpenLoopback P((ProcRef *pr)); 152 int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr)); 153 154 typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure, 155 char *buf, int count, int error)); 156 /* pr == NoProc means the local keyboard */ 157 InputSourceRef AddInputSource P((ProcRef pr, int lineByLine, 158 InputCallback func, VOIDSTAR closure)); 159 void RemoveInputSource P((InputSourceRef isr)); 160 161 /* pr == NoProc means the local display */ 162 int OutputToProcess P((ProcRef pr, char *message, int count, int *outError)); 163 int OutputToProcessDelayed P((ProcRef pr, char *message, int count, 164 int *outError, long msdelay)); 165 166 void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure, 167 char *buf, int count, int error)); 168 169 extern ProcRef cmailPR; 170 extern int shiftKey, controlKey; 171 extern char dataDir[], manDir[]; 172 173 /* in xgamelist.c or winboard.c */ 174 void GLT_ClearList(); 175 void GLT_DeSelectList(); 176 void GLT_AddToList( char *name ); 177 Boolean GLT_GetFromList( int index, char *name ); 178 179 extern char lpUserGLT[]; 180 extern char *homeDir; 181 182 /* these are in wgamelist.c */ 183 void GameListPopUp P((FILE *fp, char *filename)); 184 void GameListPopDown P((void)); 185 void GameListHighlight P((int index)); 186 void GameListDestroy P((void)); 187 void GameListUpdate P((void)); 188 FILE *GameFile P((void)); 189 190 /* these are in wedittags.c */ 191 void EditTagsPopUp P((char *tags, char **dest)); 192 void TagsPopUp P((char *tags, char *msg)); 193 void TagsPopDown P((void)); 194 195 void ParseIcsTextColors P((void)); 196 int ICSInitScript P((void)); 197 void StartAnalysisClock P((void)); 198 void EngineOutputPopUp P((void)); 199 void EgineOutputPopDown P((void)); 200 201 void SetHighlights P((int fromX, int fromY, int toX, int toY)); 202 void ClearHighlights P((void)); 203 void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY)); 204 void ClearPremoveHighlights P((void)); 205 206 void AnimateAtomicCapture P((Board board, int fromX, int fromY, int toX, int toY)); 207 void ShutDownFrontEnd P((void)); 208 void BoardToTop P((void)); 209 void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY)); 210 void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current)); 211 void FreezeUI P((void)); 212 void ThawUI P((void)); 213 void ChangeDragPiece P((ChessSquare piece)); 214 void CopyFENToClipboard P((void)); 215 extern char *programName; 216 extern int commentUp; 217 extern char *firstChessProgramNames; 218 extern char *icsTextMenuString; 219 extern int mute; 220 221 void GreyRevert P((Boolean grey)); 222 void EnableNamedMenuItem P((char *menuRef, int state)); 223 224 typedef struct FrontEndProgramStats_TAG { 225 int which; 226 int depth; 227 u64 nodes; 228 int score; 229 int time; 230 char * pv; 231 char * hint; 232 int an_move_index; 233 int an_move_count; 234 } FrontEndProgramStats; 235 236 void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */ 237 238 void EngineOutputPopUp P((void)); 239 void EngineOutputPopDown P((void)); 240 int EngineOutputIsUp P((void)); 241 int EngineOutputDialogExists P((void)); 242 void EvalGraphPopUp P((void)); 243 Boolean EvalGraphIsUp P((void)); 244 int EvalGraphDialogExists P((void)); 245 void SlavePopUp P((void)); 246 void ActivateTheme P((int new)); 247 char *Col2Text P((int n)); 248 char *Shorten P((char *s)); 249 250 /* these are in xhistory.c */ 251 Boolean MoveHistoryIsUp P((void)); 252 void HistoryPopUp P((void)); 253 void FindMoveByCharIndex P(( int char_index )); 254 255 #endif /* XB_FRONTEND */ 256