Fix multi-leg promotions
[xboard.git] / frontend.h
index dacd12a..16d1f5b 100644 (file)
-/*\r
- * frontend.h -- Interface exported by all XBoard front ends\r
- * $Id: frontend.h,v 2.2 2003/11/06 07:22:14 mann Exp $\r
- *\r
- * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
- * Enhancements Copyright 1992-95 Free Software Foundation, Inc.\r
- *\r
- * The following terms apply to Digital Equipment Corporation's copyright\r
- * interest in XBoard:\r
- * ------------------------------------------------------------------------\r
- * All Rights Reserved\r
- *\r
- * Permission to use, copy, modify, and distribute this software and its\r
- * documentation for any purpose and without fee is hereby granted,\r
- * provided that the above copyright notice appear in all copies and that\r
- * both that copyright notice and this permission notice appear in\r
- * supporting documentation, and that the name of Digital not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission.\r
- *\r
- * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\r
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\r
- * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\r
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
- * SOFTWARE.\r
- * ------------------------------------------------------------------------\r
- *\r
- * The following terms apply to the enhanced version of XBoard distributed\r
- * by the Free Software Foundation:\r
- * ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
- * ------------------------------------------------------------------------\r
- */\r
-\r
-#ifndef _FRONTEND\r
-#define _FRONTEND\r
-\r
-#include <stdio.h>\r
-\r
-typedef VOIDSTAR ProcRef;\r
-#define NoProc ((ProcRef) 0)\r
-typedef VOIDSTAR InputSourceRef;\r
-\r
-void ModeHighlight P((void));\r
-void SetICSMode P((void));\r
-void SetGNUMode P((void));\r
-void SetNCPMode P((void));\r
-void SetCmailMode P((void));\r
-void SetTrainingModeOn P((void));\r
-void SetTrainingModeOff P((void));\r
-void SetUserThinkingEnables P((void));\r
-void SetMachineThinkingEnables P((void));\r
-void DisplayTitle P((String title));\r
-void DisplayMessage P((String message, String extMessage));\r
-void DisplayError P((String message, int error));\r
-void DisplayMoveError P((String message));\r
-\r
-/* If status == 0, we are exiting with a benign message, not an error */\r
-void DisplayFatalError P((String message, int error, int status));\r
-\r
-void DisplayInformation P((String message));\r
-void DisplayNote P((String message));\r
-void AskQuestion P((String title, String question, String replyPrefix,\r
-                   ProcRef pr));\r
-void DisplayIcsInteractionTitle P((String title));\r
-void DrawPosition P((int fullRedraw, Board board));\r
-void ResetFrontEnd P((void));\r
-void CommentPopUp P((String title, String comment));\r
-void CommentPopDown P((void));\r
-void EditCommentPopUp P((int index, String title, String text));\r
-\r
-void RingBell P((void));\r
-void PlayIcsWinSound P((void));\r
-void PlayIcsLossSound P((void));\r
-void PlayIcsDrawSound P((void));\r
-void PlayIcsUnfinishedSound P((void));\r
-void PlayAlarmSound P((void));\r
-void EchoOn P((void));\r
-void EchoOff P((void));\r
-void Raw P((void));\r
-void Colorize P((ColorClass cc, int continuation));\r
-\r
-char *UserName P((void));\r
-char *HostName P((void));\r
-\r
-int ClockTimerRunning P((void));\r
-int StopClockTimer P((void));\r
-void StartClockTimer P((long millisec));\r
-void DisplayWhiteClock P((long timeRemaining, int highlight));\r
-void DisplayBlackClock P((long timeRemaining, int highlight));\r
-\r
-int LoadGameTimerRunning P((void));\r
-int StopLoadGameTimer P((void));\r
-void StartLoadGameTimer P((long millisec));\r
-void AutoSaveGame P((void));\r
-\r
-typedef void (*DelayedEventCallback) P((void));\r
-void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));\r
-DelayedEventCallback GetDelayedEvent P((void));\r
-void CancelDelayedEvent P((void));\r
-\r
-int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));\r
-void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));\r
-void InterruptChildProcess P((ProcRef pr));\r
-\r
-int OpenTelnet P((char *host, char *port, ProcRef *pr));\r
-int OpenTCP P((char *host, char *port, ProcRef *pr));\r
-int OpenCommPort P((char *name, ProcRef *pr));\r
-int OpenLoopback P((ProcRef *pr));\r
-int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));\r
-\r
-typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,\r
-                                char *buf, int count, int error));\r
-/* pr == NoProc means the local keyboard */\r
-InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,\r
-                                InputCallback func, VOIDSTAR closure));\r
-void RemoveInputSource P((InputSourceRef isr));\r
-\r
-/* pr == NoProc means the local display */\r
-int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));\r
-int OutputToProcessDelayed P((ProcRef pr, char *message, int count,\r
-                             int *outError, long msdelay));\r
-\r
-void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,\r
-                               char *buf, int count, int error));\r
-\r
-extern ProcRef cmailPR;\r
-\r
-/* these are in wgamelist.c */\r
-void GameListPopUp P((FILE *fp, char *filename));\r
-void GameListPopDown P((void));\r
-void GameListHighlight P((int index));\r
-void GameListDestroy P((void));\r
-\r
-/* these are in wedittags.c */\r
-void EditTagsPopUp P((char *tags));\r
-void TagsPopUp P((char *tags, char *msg));\r
-void TagsPopDown P((void));\r
-\r
-void ICSInitScript P((void));\r
-void StartAnalysisClock P((void));\r
-void AnalysisPopUp P((char *title, char *label));\r
-void AnalysisPopDown P((void));\r
-\r
-void SetHighlights P((int fromX, int fromY, int toX, int toY));\r
-void ClearHighlights P((void));\r
-void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));\r
-void ClearPremoveHighlights P((void));\r
-\r
-void ShutDownFrontEnd P((void));\r
-void BoardToTop P((void));\r
-void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));\r
-void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));\r
-void FreezeUI P((void));\r
-void ThawUI P((void));\r
-extern char *programName;\r
-\r
-typedef struct FrontEndProgramStats_TAG {\r
-    int which;\r
-    int depth;\r
-    unsigned long nodes;\r
-    int score;\r
-    int time;\r
-    char * pv;\r
-    char * hint;\r
-    int an_move_index;\r
-    int an_move_count;\r
-} FrontEndProgramStats;\r
-\r
-void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */\r
-\r
-#endif\r
+/*
+ * frontend.h -- Interface exported by all XBoard front ends
+ *
+ * Copyright 1991 by Digital Equipment Corporation, Maynard,
+ * Massachusetts.
+ *
+ * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
+ * Software Foundation, Inc.
+ *
+ * Enhancements Copyright 2005 Alessandro Scotti
+ *
+ * The following terms apply to Digital Equipment Corporation's copyright
+ * interest in XBoard:
+ * ------------------------------------------------------------------------
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * ------------------------------------------------------------------------
+ *
+ * The following terms apply to the enhanced version of XBoard
+ * distributed by the Free Software Foundation:
+ * ------------------------------------------------------------------------
+ *
+ * GNU XBoard is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * GNU XBoard is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.  *
+ *
+ *------------------------------------------------------------------------
+ ** See the file ChangeLog for a revision history.  */
+
+#ifndef XB_FRONTEND
+#define XB_FRONTEND
+
+#include <stdio.h>
+
+char *T_ P((char *s));
+void ModeHighlight P((void));
+void SetICSMode P((void));
+void SetGNUMode P((void));
+void SetNCPMode P((void));
+void SetCmailMode P((void));
+void SetTrainingModeOn P((void));
+void SetTrainingModeOff P((void));
+void SetUserThinkingEnables P((void));
+void SetMachineThinkingEnables P((void));
+void DisplayTitle P((String title));
+void DisplayMessage P((String message, String extMessage));
+void DisplayMoveError P((String message));
+
+void DisplayNote P((String message));
+
+void DisplayInformation P((String message));
+void AskQuestion P((String title, String question, String replyPrefix,
+                   ProcRef pr));
+void DisplayIcsInteractionTitle P((String title));
+void ParseArgsFromString P((char *p));
+void ParseArgsFromFile P((FILE *f));
+void DrawPosition P((int fullRedraw, Board board));
+void ResetFrontEnd P((void));
+void NotifyFrontendLogin P((void));
+void CommentPopUp P((String title, String comment));
+void CommentPopDown P((void));
+void EditCommentPopUp P((int index, String title, String text));
+void ErrorPopDown P((void));
+int  EventToSquare P((int x, int limit));
+void DrawSeekAxis P(( int x, int y, int xTo, int yTo ));
+void DrawSeekBackground P(( int left, int top, int right, int bottom ));
+void DrawSeekText P((char *buf, int x, int y));
+void DrawSeekDot P((int x, int y, int color));
+void PopUpMoveDialog P((char first));
+
+void RingBell P((void));
+int  Roar P((void));
+void PlayIcsWinSound P((void));
+void PlayIcsLossSound P((void));
+void PlayIcsDrawSound P((void));
+void PlayIcsUnfinishedSound P((void));
+void PlayAlarmSound P((void));
+void PlayTellSound P((void));
+int  PlaySoundFile P((char *name));
+void PlaySoundByColor P((void));
+void EchoOn P((void));
+void EchoOff P((void));
+void Raw P((void));
+void Colorize P((ColorClass cc, int continuation));
+char *InterpretFileName P((char *name, char *dir));
+void DoSleep P((int n));
+void DoEvents P((void));
+
+char *UserName P((void));
+char *HostName P((void));
+
+int ClockTimerRunning P((void));
+int StopClockTimer P((void));
+void StartClockTimer P((long millisec));
+void DisplayWhiteClock P((long timeRemaining, int highlight));
+void DisplayBlackClock P((long timeRemaining, int highlight));
+void UpdateLogos P((int display));
+
+int LoadGameTimerRunning P((void));
+int StopLoadGameTimer P((void));
+void StartLoadGameTimer P((long millisec));
+void AutoSaveGame P((void));
+
+void ScheduleDelayedEvent P((DelayedEventCallback cb, long millisec));
+DelayedEventCallback GetDelayedEvent P((void));
+void CancelDelayedEvent P((void));
+// [HGM] mouse: next six used by mouse handler, which was moved to backend
+extern int fromX, fromY, toX, toY;
+void PromotionPopUp P((char choice));
+void DragPieceBegin P((int x, int y, Boolean instantly));
+void DragPieceEnd P((int x, int y));
+void DragPieceMove P((int x, int y));
+void LeftClick P((ClickType c, int x, int y));
+int  RightClick P((ClickType c, int x, int y, int *col, int *row));
+void Wheel P((int dir, int x, int y));
+
+int StartChildProcess P((char *cmdLine, char *dir, ProcRef *pr));
+void DestroyChildProcess P((ProcRef pr, int/*boolean*/ signal));
+void InterruptChildProcess P((ProcRef pr));
+char *BufferCommandOutput P((char *command, int size));
+void RunCommand P((char *buf));
+
+int OpenTelnet P((char *host, char *port, ProcRef *pr));
+int OpenTCP P((char *host, char *port, ProcRef *pr));
+int OpenCommPort P((char *name, ProcRef *pr));
+int OpenLoopback P((ProcRef *pr));
+int OpenRcmd P((char *host, char *user, char *cmd, ProcRef *pr));
+
+typedef void (*InputCallback) P((InputSourceRef isr, VOIDSTAR closure,
+                                char *buf, int count, int error));
+/* pr == NoProc means the local keyboard */
+InputSourceRef AddInputSource P((ProcRef pr, int lineByLine,
+                                InputCallback func, VOIDSTAR closure));
+void RemoveInputSource P((InputSourceRef isr));
+
+/* pr == NoProc means the local display */
+int OutputToProcess P((ProcRef pr, char *message, int count, int *outError));
+int OutputToProcessDelayed P((ProcRef pr, char *message, int count,
+                             int *outError, long msdelay));
+
+void CmailSigHandlerCallBack P((InputSourceRef isr, VOIDSTAR closure,
+                               char *buf, int count, int error));
+
+extern ProcRef cmailPR;
+extern int shiftKey, controlKey;
+extern char dataDir[], manDir[];
+
+/* in xgamelist.c or winboard.c */
+void GLT_ClearList();
+void GLT_DeSelectList();
+void GLT_AddToList( char *name );
+Boolean GLT_GetFromList( int index, char *name );
+
+extern char lpUserGLT[];
+extern char *homeDir;
+
+/* these are in wgamelist.c */
+void GameListPopUp P((FILE *fp, char *filename));
+void GameListPopDown P((void));
+void GameListHighlight P((int index));
+void GameListDestroy P((void));
+void GameListUpdate P((void));
+FILE *GameFile P((void));
+
+/* these are in wedittags.c */
+void EditTagsPopUp P((char *tags, char **dest));
+void TagsPopUp P((char *tags, char *msg));
+void TagsPopDown P((void));
+
+void ParseIcsTextColors P((void));
+int  ICSInitScript P((void));
+void StartAnalysisClock P((void));
+void EngineOutputPopUp P((void));
+void EgineOutputPopDown P((void));
+
+void SetHighlights P((int fromX, int fromY, int toX, int toY));
+void ClearHighlights P((void));
+void SetPremoveHighlights P((int fromX, int fromY, int toX, int toY));
+void ClearPremoveHighlights P((void));
+
+void AnimateAtomicCapture P((Board board, int fromX, int fromY, int toX, int toY));
+void ShutDownFrontEnd P((void));
+void BoardToTop P((void));
+void AnimateMove P((Board board, int fromX, int fromY, int toX, int toY));
+void HistorySet P((char movelist[][2*MOVE_LEN], int first, int last, int current));
+void FreezeUI P((void));
+void ThawUI P((void));
+void ChangeDragPiece P((ChessSquare piece));
+void CopyFENToClipboard P((void));
+extern char *programName;
+extern int commentUp;
+extern char *firstChessProgramNames;
+extern char *icsTextMenuString;
+
+void GreyRevert P((Boolean grey));
+void EnableNamedMenuItem P((char *menuRef, int state));
+
+typedef struct FrontEndProgramStats_TAG {
+    int which;
+    int depth;
+    u64 nodes;
+    int score;
+    int time;
+    char * pv;
+    char * hint;
+    int an_move_index;
+    int an_move_count;
+} FrontEndProgramStats;
+
+void SetProgramStats P(( FrontEndProgramStats * stats )); /* [AS] */
+
+void EngineOutputPopUp P((void));
+void EngineOutputPopDown P((void));
+int  EngineOutputIsUp P((void));
+int  EngineOutputDialogExists P((void));
+void EvalGraphPopUp P((void));
+Boolean EvalGraphIsUp P((void));
+int  EvalGraphDialogExists P((void));
+void SlavePopUp P((void));
+void ActivateTheme P((int new));
+char *Col2Text P((int n));
+
+/* these are in xhistory.c  */
+Boolean MoveHistoryIsUp P((void));
+void HistoryPopUp P((void));
+void FindMoveByCharIndex P(( int char_index ));
+
+#endif /* XB_FRONTEND */