cleaned up some more copyright notices
[xboard.git] / backend.h
index 8ef5bf3..a7b6074 100644 (file)
--- a/backend.h
+++ b/backend.h
@@ -1,9 +1,13 @@
 /*\r
  * backend.h -- Interface exported by XBoard back end\r
- * $Id: backend.h,v 2.1 2003/10/27 19:21:00 mann Exp $\r
  *\r
- * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
- * Enhancements Copyright 1992-95 Free Software Foundation, Inc.\r
+ * Copyright 1991 by Digital Equipment Corporation, Maynard,\r
+ * Massachusetts.\r
+ *\r
+ * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,\r
+ * 2007, 2008, 2009 Free Software Foundation, Inc.\r
+ *\r
+ * Enhancements Copyright 2005 Alessandro Scotti\r
  *\r
  * The following terms apply to Digital Equipment Corporation's copyright\r
  * interest in XBoard:\r
  * SOFTWARE.\r
  * ------------------------------------------------------------------------\r
  *\r
- * The following terms apply to the enhanced version of XBoard distributed\r
- * by the Free Software Foundation:\r
+ * The following terms apply to the enhanced version of XBoard\r
+ * distributed by the Free Software Foundation:\r
  * ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
+ *\r
+ * GNU XBoard 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
+ * the Free Software Foundation, either version 3 of the License, or (at\r
+ * 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
+ * GNU XBoard is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * 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
+ * along with this program. If not, see http://www.gnu.org/licenses/.  *\r
+ *\r
+ *------------------------------------------------------------------------\r
+ ** See the file ChangeLog for a revision history.  */\r
+\r
 #ifndef _BACKEND\r
 #define _BACKEND\r
 \r
+/* unsigned int 64 for engine nodes work and display */\r
+#ifdef WIN32\r
+       /* I don't know the name for this type of other compiler\r
+        * If it not work, just modify here\r
+        * This is for MS Visual Studio\r
+        */\r
+       #ifdef _MSC_VER\r
+               #define u64 unsigned __int64\r
+               #define s64 signed __int64\r
+               #define u64Display "%I64u"\r
+               #define s64Display "%I64d"\r
+               #define u64Const(c) (c ## UI64)\r
+               #define s64Const(c) (c ## I64)\r
+       #else\r
+               /* place holder\r
+                * or dummy types for other compiler\r
+                */\r
+               #define u64 unsigned long long\r
+               #define s64 signed long long\r
+               #define u64Display "%llu"\r
+               #define s64Display "%lld"\r
+               #define u64Const(c) (c ## ULL)\r
+               #define s64Const(c) (c ## LL)\r
+       #endif\r
+#else\r
+       /* GNU gcc */\r
+       #define u64 unsigned long long\r
+       #define s64 signed long long\r
+       #define u64Display "%llu"\r
+       #define s64Display "%lld"\r
+       #define u64Const(c) (c ## ull)\r
+       #define s64Const(c) (c ## ll)\r
+#endif\r
+\r
 #include "lists.h"\r
 #include "frontend.h"\r
 \r
@@ -64,7 +104,7 @@ extern Board boards[];
 \r
 char *CmailMsg P((void));\r
 /* Tord: Added the useFEN960 parameter in PositionToFEN() below */\r
-char *PositionToFEN P((int move, int useFEN960));\r
+char *PositionToFEN P((int move, char* useFEN960));\r
 void AlphaRank P((char *s, int n)); /* [HGM] Shogi move preprocessor */\r
 void EditPositionPasteFEN P((char *fen));\r
 void TimeDelay P((long ms));\r
@@ -119,7 +159,8 @@ void UserAdjudicationEvent P((int result));
 void StopObservingEvent P((void));\r
 void StopExaminingEvent P((void));\r
 void PonderNextMoveEvent P((int newState));\r
-void ShowThinkingEvent P((int newState));\r
+void NewSettingeEvent P((int option, char *command, int value));\r
+void ShowThinkingEvent P(());\r
 void PeriodicUpdatesEvent P((int newState));\r
 void HintEvent P((void));\r
 void BookEvent P((void));\r
@@ -158,6 +199,7 @@ Boolean ParseOneMove P((char *move, int moveNum,
                        int *toX, int *toY, char *promoChar));\r
 char *VariantName P((VariantClass v));\r
 VariantClass StringToVariant P((char *e));\r
+double u64ToDouble P((u64 value));\r
 \r
 char *StrStr P((char *string, char *match));\r
 char *StrCaseStr P((char *string, char *match));\r
@@ -175,6 +217,14 @@ int ToUpper P((int c));
 \r
 extern GameInfo gameInfo;\r
 \r
+/* ICS vars used with backend.c and zippy.c */\r
+#define ICS_GENERIC 0\r
+#define ICS_ICC 1\r
+#define ICS_FICS 2\r
+#define ICS_CHESSNET 3 /* not really supported */\r
+int ics_type;\r
+\r
\r
 \r
 /* pgntags.c prototypes\r
  */\r
@@ -205,6 +255,19 @@ char * GameListLineFull P(( int, GameInfo *));
 extern char* StripHighlight P((char *));  /* returns static data */\r
 extern char* StripHighlightAndTitle P((char *));  /* returns static data */\r
 \r
+typedef enum { CheckBox, ComboBox, TextBox, Button, Spin, SaveButton } Control;\r
+\r
+typedef struct _OPT {   // [HGM] options: descriptor of UCI-style option\r
+    int value;          // current setting, starts as default\r
+    int min;\r
+    int max;\r
+    void *handle;       // for use by front end\r
+    char *textValue;    // points to beginning of text value in name field\r
+    char **choice;      // points to array of combo choices in cps->combo\r
+    Control type;\r
+    char name[MSG_SIZ]; // holds both option name and text value\r
+} Option;\r
+\r
 typedef struct _CPS {\r
     char *which;\r
     int maybeThinking;\r
@@ -251,6 +314,27 @@ typedef struct _CPS {
     int scoreIsAbsolute; /* [AS] 0=don't know (standard), 1=score is always from white side */\r
     int isUCI;           /* [AS] 0=no (Winboard), 1=UCI (requires Polyglot) */\r
     int hasOwnBookUCI;   /* [AS] 0=use GUI or Polyglot book, 1=has own book */\r
+\r
+    /* [HGM] time odds */\r
+    int timeOdds;   /* factor through which we divide time for this engine  */\r
+    int debug;      /* [HGM] ignore engine debug lines starting with '#'    */\r
+    int maxNrOfSessions; /* [HGM] secondary TC: max args in 'level' command */\r
+    int accumulateTC; /* [HGM] secondary TC: how to handle extra sessions   */\r
+    int nps;          /* [HGM] nps: factor for node count to replace time   */\r
+    int supportsNPS;\r
+    int alphaRank;    /* [HGM] shogi: engine uses shogi-type coordinates    */\r
+    int maxCores;     /* [HGM] SMP: engine understands cores command        */\r
+    int memSize;      /* [HGM] memsize: engine understands memory command   */\r
+    char egtFormats[MSG_SIZ];     /* [HGM] EGT: supported tablebase formats */\r
+    int bookSuspend;  /* [HGM] book: go was deferred because of book hit    */\r
+    int nrOptions;    /* [HGM] options: remembered option="..." features    */\r
+#define MAX_OPTIONS 50\r
+    Option option[MAX_OPTIONS];\r
+    int comboCnt;\r
+    char *comboList[10*MAX_OPTIONS];\r
+    char *optionSettings;\r
+    void *programLogo; /* [HGM] logo: bitmap of the logo                    */\r
+    char *fenOverride; /* [HGM} FRC: force FEN casling & ep fields by hand  */\r
 } ChessProgramState;\r
 \r
 extern ChessProgramState first, second;\r
@@ -262,6 +346,25 @@ typedef struct {
     int time;   /* Milliseconds */\r
 } ChessProgramStats_Move;\r
 \r
+/* Search stats from chessprogram */\r
+typedef struct {\r
+  char movelist[2*MSG_SIZ]; /* Last PV we were sent */\r
+  int depth;              /* Current search depth */\r
+  int nr_moves;           /* Total nr of root moves */\r
+  int moves_left;         /* Moves remaining to be searched */\r
+  char move_name[MOVE_LEN];  /* Current move being searched, if provided */\r
+  u64 nodes;    /* # of nodes searched */\r
+  int time;               /* Search time (centiseconds) */\r
+  int score;              /* Score (centipawns) */\r
+  int got_only_move;      /* If last msg was "(only move)" */\r
+  int got_fail;           /* 0 - nothing, 1 - got "--", 2 - got "++" */\r
+  int ok_to_send;         /* handshaking between send & recv */\r
+  int line_is_book;       /* 1 if movelist is book moves */\r
+  int seen_stat;          /* 1 if we've seen the stat01: line */\r
+} ChessProgramStats;\r
+\r
 extern ChessProgramStats_Move pvInfoList[MAX_MOVES];\r
+extern int shuffleOpenings;\r
+extern ChessProgramStats programStats;\r
 \r
 #endif /* _BACKEND */\r