X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.h;h=43a479d22418da53363784e59f7463d927df03ce;hb=e59f2b1735fb0ef47b63a1fc560edcc58826ef58;hp=0057b9d10d290f6cf88d2cafc554d8cc560fffa4;hpb=7e4f4f5718bf4efee8be4abfc981d18cfd6f8438;p=xboard.git diff --git a/backend.h b/backend.h index 0057b9d..43a479d 100644 --- a/backend.h +++ b/backend.h @@ -48,6 +48,40 @@ #ifndef _BACKEND #define _BACKEND +/* unsigned int 64 for engine nodes work and display */ +#ifdef WIN32 + /* I don't know the name for this type of other compiler + * If it not work, just modify here + * This is for MS Visual Studio + */ + #ifdef _MSC_VER + #define u64 unsigned __int64 + #define s64 signed __int64 + #define u64Display "%I64u" + #define s64Display "%I64d" + #define u64Const(c) (c ## UI64) + #define s64Const(c) (c ## I64) + #else + /* place holder + * or dummy types for other compiler + */ + #define u64 unsigned long long + #define s64 signed long long + #define u64Display "%llu" + #define s64Display "%lld" + #define u64Const(c) (c ## ULL) + #define s64Const(c) (c ## LL) + #endif +#else + /* GNU gcc */ + #define u64 unsigned long long + #define s64 signed long long + #define u64Display "%llu" + #define s64Display "%lld" + #define u64Const(c) (c ## ull) + #define s64Const(c) (c ## ll) +#endif + #include "lists.h" #include "frontend.h" @@ -119,7 +153,8 @@ void UserAdjudicationEvent P((int result)); void StopObservingEvent P((void)); void StopExaminingEvent P((void)); void PonderNextMoveEvent P((int newState)); -void ShowThinkingEvent P((int newState)); +void NewSettingeEvent P((int option, char *command, int value)); +void ShowThinkingEvent P(()); void PeriodicUpdatesEvent P((int newState)); void HintEvent P((void)); void BookEvent P((void)); @@ -131,6 +166,7 @@ void UserMoveEvent P((int fromX, int fromY, int toX, int toY, int promoChar)); void DecrementClocks P((void)); char *TimeString P((long millisec)); void AutoPlayGameLoop P((void)); +void AdjustClock P((Boolean which, int dir)); void DisplayBothClocks P((void)); void EditPositionMenuEvent P((ChessSquare selection, int x, int y)); void DropMenuEvent P((ChessSquare selection, int x, int y)); @@ -157,6 +193,7 @@ Boolean ParseOneMove P((char *move, int moveNum, int *toX, int *toY, char *promoChar)); char *VariantName P((VariantClass v)); VariantClass StringToVariant P((char *e)); +double u64ToDouble P((u64 value)); char *StrStr P((char *string, char *match)); char *StrCaseStr P((char *string, char *match)); @@ -174,6 +211,14 @@ int ToUpper P((int c)); extern GameInfo gameInfo; +/* ICS vars used with backend.c and zippy.c */ +#define ICS_GENERIC 0 +#define ICS_ICC 1 +#define ICS_FICS 2 +#define ICS_CHESSNET 3 /* not really supported */ +int ics_type; + + /* pgntags.c prototypes */ @@ -204,6 +249,19 @@ char * GameListLineFull P(( int, GameInfo *)); extern char* StripHighlight P((char *)); /* returns static data */ extern char* StripHighlightAndTitle P((char *)); /* returns static data */ +typedef enum { CheckBox, ComboBox, TextBox, Button, Spin, SaveButton } Control; + +typedef struct _OPT { // [HGM] options: descriptor of UCI-style option + int value; // current setting, starts as default + int min; + int max; + void *handle; // for use by front end + char *textValue; // points to beginning of text value in name field + char **choice; // points to array of combo choices in cps->combo + Control type; + char name[MSG_SIZ]; // holds both option name and text value +} Option; + typedef struct _CPS { char *which; int maybeThinking; @@ -250,6 +308,26 @@ typedef struct _CPS { int scoreIsAbsolute; /* [AS] 0=don't know (standard), 1=score is always from white side */ int isUCI; /* [AS] 0=no (Winboard), 1=UCI (requires Polyglot) */ int hasOwnBookUCI; /* [AS] 0=use GUI or Polyglot book, 1=has own book */ + + /* [HGM] time odds */ + int timeOdds; /* factor through which we divide time for this engine */ + int debug; /* [HGM] ignore engine debug lines starting with '#' */ + int maxNrOfSessions; /* [HGM] secondary TC: max args in 'level' command */ + int accumulateTC; /* [HGM] secondary TC: how to handle extra sessions */ + int nps; /* [HGM] nps: factor for node count to replace time */ + int supportsNPS; + int alphaRank; /* [HGM] shogi: engine uses shogi-type coordinates */ + int maxCores; /* [HGM] SMP: engine understands cores command */ + int memSize; /* [HGM] memsize: engine understands memory command */ + char egtFormats[MSG_SIZ]; /* [HGM] EGT: supported tablebase formats */ + int bookSuspend; /* [HGM] book: go was deferred because of book hit */ + int nrOptions; /* [HGM] options: remembered option="..." features */ +#define MAX_OPTIONS 50 + Option option[MAX_OPTIONS]; + int comboCnt; + char *comboList[10*MAX_OPTIONS]; + char *optionSettings; + void *programLogo; /* [HGM] logo: bitmap of the logo */ } ChessProgramState; extern ChessProgramState first, second; @@ -261,6 +339,25 @@ typedef struct { int time; /* Milliseconds */ } ChessProgramStats_Move; +/* Search stats from chessprogram */ +typedef struct { + char movelist[2*MSG_SIZ]; /* Last PV we were sent */ + int depth; /* Current search depth */ + int nr_moves; /* Total nr of root moves */ + int moves_left; /* Moves remaining to be searched */ + char move_name[MOVE_LEN]; /* Current move being searched, if provided */ + u64 nodes; /* # of nodes searched */ + int time; /* Search time (centiseconds) */ + int score; /* Score (centipawns) */ + int got_only_move; /* If last msg was "(only move)" */ + int got_fail; /* 0 - nothing, 1 - got "--", 2 - got "++" */ + int ok_to_send; /* handshaking between send & recv */ + int line_is_book; /* 1 if movelist is book moves */ + int seen_stat; /* 1 if we've seen the stat01: line */ +} ChessProgramStats; + extern ChessProgramStats_Move pvInfoList[MAX_MOVES]; +extern shuffleOpenings; +extern ChessProgramStats programStats; #endif /* _BACKEND */