2 * common.h -- Common definitions for X and Windows NT versions of XBoard
5 * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
6 * Enhancements Copyright 1992-95 Free Software Foundation, Inc.
8 * The following terms apply to Digital Equipment Corporation's copyright
10 * ------------------------------------------------------------------------
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.
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
28 * ------------------------------------------------------------------------
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.
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.
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 * ------------------------------------------------------------------------
52 /* Begin compatibility grunge */
54 #if defined(__STDC__) || defined(WIN32) || defined(_amigados)
56 typedef void *VOIDSTAR;
59 typedef char *VOIDSTAR;
66 #define pclose _pclose
69 #ifdef _amigados /* It is important, that these types have */
70 typedef int Boolean; /* a length of 4 bytes each, as we are */
71 typedef char *String; /* using ReadArgs() for argument parsing. */
73 FILE *popen(const char *, const char *);
78 #include <X11/Intrinsic.h>
90 # define srandom srand48
91 # define random lrand48
92 # else /* not HAVE_RAND48 */
93 # define srandom srand
95 # endif /* not HAVE_RAND48 */
96 #endif /* !HAVE_RANDOM */
98 /* End compatibility grunge */
100 #define PROTOVER 2 /* engine protocol version */
104 #define MAX_MOVES 1000
106 #define DIALOG_SIZE 256
107 #define STAR_MATCH_N 16
109 #define TIME_CONTROL "5" /* in minutes */
110 #define TIME_DELAY_QUOTE "1.0" /* seconds between moves */
111 #define TIME_DELAY ((float) 1.0)
112 #define MOVES_PER_SESSION 40 /* moves per TIME_CONTROL */
113 #define TIME_INCREMENT -1 /* if >= 0, MOVES_PER_SESSION unused */
114 #define WhiteOnMove(move) (((move) % 2) == 0)
115 #define ICS_HOST "chessclub.com"
116 #define ICS_PORT "5000"
117 #define ICS_COMM_PORT ""
118 #define FIRST_HOST "localhost"
119 #define SECOND_HOST "localhost"
120 #define TELNET_PROGRAM "telnet"
121 #define MATCH_MODE "False"
122 #define INIT_STRING "new\nrandom\n"
123 #define WHITE_STRING "white\ngo\n"
124 #define BLACK_STRING "black\ngo\n"
125 #define COMPUTER_STRING "computer\n"
126 #define REUSE_CHESS_PROGRAMS 1
127 #define WHITE_PIECE_COLOR "#FFFFCC"
128 #define BLACK_PIECE_COLOR "#202020"
129 #define LIGHT_SQUARE_COLOR "#C8C365"
130 #define DARK_SQUARE_COLOR "#77A26D"
131 #define JAIL_SQUARE_COLOR "#808080"
132 #define HIGHLIGHT_SQUARE_COLOR "#FFFF00"
133 #define PREMOVE_HIGHLIGHT_COLOR "#FF0000"
134 #define BELLCHAR '\007'
135 #define NULLCHAR '\000'
136 #define FEATURE_TIMEOUT 10000 /*ms*/
139 #define ZIPPY_TALK FALSE
140 #define ZIPPY_PLAY FALSE
141 #define ZIPPY_LINES "yow.lines"
142 #define ZIPPY_PINHEAD ""
143 #define ZIPPY_PASSWORD ""
144 #define ZIPPY_PASSWORD2 ""
145 #define ZIPPY_PASSWORD3 ""
146 #define ZIPPY_WRONG_PASSWORD ""
147 #define ZIPPY_ACCEPT_ONLY ""
148 #define ZIPPY_USE_I TRUE
149 #define ZIPPY_BUGHOUSE 0
150 #define ZIPPY_NOPLAY_CRAFTY FALSE
151 #define ZIPPY_GAME_END "gameend\n"
152 #define ZIPPY_GAME_START ""
153 #define ZIPPY_ADJOURN FALSE
154 #define ZIPPY_ABORT FALSE
155 #define ZIPPY_VARIANTS "normal"
156 #define ZIPPY_MAX_GAMES 0
157 #define ZIPPY_REPLAY_TIMEOUT 120
160 BeginningOfGame, MachinePlaysWhite, MachinePlaysBlack,
161 AnalyzeMode, AnalyzeFile, TwoMachinesPlay,
162 EditGame, PlayFromGameFile, EndOfGame, EditPosition, Training,
163 IcsIdle, IcsPlayingWhite, IcsPlayingBlack, IcsObserving,
170 WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, WhiteKing,
171 BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, BlackKing,
173 ClearBoard, WhitePlay, BlackPlay /*for use on EditPosition menus*/
176 typedef ChessSquare Board[BOARD_SIZE][BOARD_SIZE];
179 WhiteKingSideCastle = 1, WhiteQueenSideCastle,
180 WhiteKingSideCastleWild, WhiteQueenSideCastleWild,
181 WhiteHSideCastleFR, WhiteASideCastleFR,
182 BlackKingSideCastle, BlackQueenSideCastle,
183 BlackKingSideCastleWild, BlackQueenSideCastleWild,
184 BlackHSideCastleFR, BlackASideCastleFR,
185 WhitePromotionKnight, WhitePromotionBishop,
186 WhitePromotionRook, WhitePromotionQueen, WhitePromotionKing,
187 BlackPromotionKnight, BlackPromotionBishop,
188 BlackPromotionRook, BlackPromotionQueen, BlackPromotionKing,
189 WhiteCapturesEnPassant, BlackCapturesEnPassant,
190 WhiteDrop, BlackDrop,
191 NormalMove, AmbiguousMove, IllegalMove, ImpossibleMove,
192 WhiteWins, BlackWins, GameIsDrawn, GameUnfinished,
193 GNUChessGame, XBoardGame, MoveNumberOne,
194 Comment, PositionDiagram, ElapsedTime, PGNTag, NAG
198 ColorShout, ColorSShout, ColorChannel1, ColorChannel, ColorKibitz,
199 ColorTell, ColorChallenge, ColorRequest, ColorSeek, ColorNormal,
200 ColorNone, NColorClasses
204 SoundMove, SoundBell, SoundAlarm, SoundIcsWin, SoundIcsLoss,
205 SoundIcsDraw, SoundIcsUnfinished, NSoundClasses
208 /* Names for chess variants, not necessarily supported */
210 VariantNormal, /* Normal chess */
211 VariantLoadable, /* "loadgame" command allowed (not really a variant)*/
212 VariantWildCastle, /* Shuffle chess where king can castle from d file */
213 VariantNoCastle, /* Shuffle chess with no castling at all */
214 VariantFischeRandom, /* FischeRandom */
215 VariantBughouse, /* Bughouse, ICC/FICS rules */
216 VariantCrazyhouse, /* Crazyhouse, ICC/FICS rules */
217 VariantLosers, /* Try to lose all pieces or get mated (ICC wild 17)*/
218 VariantSuicide, /* Try to lose all pieces incl. king (FICS) */
219 VariantGiveaway, /* Try to have no legal moves left (ICC wild 26) */
220 VariantTwoKings, /* Weird ICC wild 9 */
221 VariantKriegspiel, /* Kriegspiel; pawns can capture invisible pieces */
222 VariantAtomic, /* Capturing piece explodes (ICC wild 27) */
223 Variant3Check, /* Win by giving check 3 times (ICC wild 25) */
224 VariantShatranj, /* Unsupported (ICC wild 28) */
225 Variant29, /* Temporary name for possible future ICC wild 29 */
226 Variant30, /* Temporary name for possible future ICC wild 30 */
227 Variant31, /* Temporary name for possible future ICC wild 31 */
228 Variant32, /* Temporary name for possible future ICC wild 32 */
229 Variant33, /* Temporary name for possible future ICC wild 33 */
230 Variant34, /* Temporary name for possible future ICC wild 34 */
231 Variant35, /* Temporary name for possible future ICC wild 35 */
232 Variant36, /* Temporary name for possible future ICC wild 36 */
233 VariantUnknown /* Catchall for other unknown variants */
236 #define VARIANT_NAMES { \
264 #if !defined(_amigados)
265 char *whitePieceColor;
266 char *blackPieceColor;
267 char *lightSquareColor;
268 char *darkSquareColor;
269 char *jailSquareColor;
270 char *highlightSquareColor;
271 char *premoveHighlightColor;
275 int lightSquareColor;
278 int highlightSquareColor;
279 int premoveHighlightColor;
284 char *secondInitString;
285 char *firstComputerString;
286 char *secondComputerString;
287 char *firstChessProgram;
288 char *secondChessProgram;
289 char *firstDirectory;
290 char *secondDirectory;
291 Boolean firstPlaysBlack;
292 Boolean noChessProgram;
295 char *bitmapDirectory;
303 char *icsCommPort; /* if set, use serial port instead of tcp host/port */
304 char *icsLogon; /* Hack to permit variable logon scripts. */
311 int loadGameIndex; /* game # within file */
313 Boolean autoSaveGames;
314 char *loadPositionFile;
315 int loadPositionIndex; /* position # within file */
316 char *savePositionFile;
323 Boolean userVersion; /* programmer version */
325 Boolean icsEngineKillPV;
326 Boolean icsEngineWhisper;
327 Boolean icsEngineKibitz;
328 Boolean icsEngineTell;
329 Boolean icsEngineNone;
330 Boolean icsAnalyzeWindow;
331 Boolean smartQueue; /* Live broadcast quere */
332 Boolean ICC_feature; /* Enable special ICC fetures */
333 Boolean windowMove; /* Drop fail high/low moves at icsAnalyzeOutPut */
334 int icsAnalyzeOutPut; /* 1=whisper 2=kibitz 3=tell 4=none */
336 char icsTells[MSG_SIZ]; /* handle/channel do we tell somthing */
337 Boolean icsWBprotoNorm;
338 Boolean icsWBprotoAgr;
339 int icsWBproto; /* dummy */
340 int icsSmartQueue; /* 0 = standard game 1 = Blitzgame */
341 /* Split smartQueue with int because i want more for the future */
342 Boolean icsSmartQueueStd;
343 Boolean icsSmartQueueBlitz;
344 Boolean icsShowBook; /* True = show book False = disable */
345 Boolean AnalysisWindow; /* Engine Room */
346 Boolean engineStart; /* EngineRoom Button */
347 Boolean engineTourneyMode; /* EngineRoom checkbox tourneyMode */
348 Boolean engineStatLine; /* EngineRoom Statline disable */
349 Boolean zippyDraw; /* active zippy draw Handling ? */
350 int SendOutPutToICS; /* Analysis window: Send thinking lines to ICS */
351 /* 0 none 1 whisper 2 kibitz */
352 Boolean ButtonSendOutPutToICS; /* Checkbox analysis window */
359 char *messageFont; /* WinBoard only */
361 char *font; /* xboard only: all other fonts */
362 char *tagsFont; /* WinBoard only */
363 char *commentFont; /* WinBoard only */
364 char *icsFont; /* WinBoard only */
365 Boolean ringBellAfterMoves;
366 Boolean autoCallFlag;
368 Boolean autoFlipView;
369 char *cmailGameName; /* xboard only */
370 Boolean alwaysPromoteToQueen;
371 Boolean oldSaveStyle;
373 Boolean showThinking;
374 Boolean ponderNextMove;
375 Boolean periodicUpdates;
379 Boolean testLegality;
380 int borderXoffset; /* xboard only */
381 int borderYoffset; /* xboard only */
382 Boolean titleInWindow; /* xboard only */
383 Boolean localLineEditing; /* WinBoard only */
386 int flashCount; /* Number of times to flash (xboard only) */
387 int flashRate; /* Flashes per second (xboard only) */
388 char *pixmapDirectory; /* Path to XPM/XIM files to use (xboard only) */
389 int msLoginDelay; /* Delay per character (in msec) while sending
390 ICS logon script (xboard only) */
391 Boolean colorize; /* If True, use the following colors to color text */
392 /* Strings for colors, as "fg, bg, bold" (strings used in xboard only) */
399 char *colorChallenge;
403 char *soundProgram; /* sound-playing program */
410 char *soundChallenge;
417 char *soundIcsUnfinished;
421 Boolean animateDragging; /* If True, animate mouse dragging of pieces */
422 Boolean animate; /* If True, animate non-mouse moves */
423 int animSpeed; /* Delay in milliseconds between animation frames */
424 Boolean popupMoveErrors;
425 Boolean popupExitMessage;
427 Boolean highlightLastMove;
428 Boolean highlightDragging;
429 Boolean blindfold; /* if true, no pieces are drawn */
430 Boolean premove; /* true if premove feature enabled */
431 Boolean premoveWhite; /* true if premoving White first move */
432 char *premoveWhiteText; /* text of White premove 1 */
433 Boolean premoveBlack; /* true if premoving Black first move */
434 char *premoveBlackText; /* text of Black premove 1 */
435 Boolean icsAlarm; /* true if sounding alarm at a certain time */
436 int icsAlarmTime; /* time to sound alarm, in milliseconds */
437 Boolean autoRaiseBoard;
438 int fontSizeTolerance; /* xboard only */
441 int firstProtocolVersion;
442 int secondProtocolVersion;
443 Boolean showButtonBar;
448 char *zippyPassword2;
449 char *zippyPassword3;
450 char *zippyWrongPassword;
451 char *zippyAcceptOnly;
454 int zippyNoplayCrafty;
456 char *zippyGameStart;
461 int zippyReplayTimeout; /*seconds*/
463 } AppData, *AppDataPtr;
465 extern AppData appData;
476 /* Additional info */
477 char *fen; /* NULL or FEN for starting position; input only */
480 char *extraTags; /* NULL or "[Tag \"Value\"]\n", etc. */
481 int whiteRating; /* -1 if unknown */
482 int blackRating; /* -1 if unknown */
483 VariantClass variant;