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_WRONG_PASSWORD ""
146 #define ZIPPY_ACCEPT_ONLY ""
147 #define ZIPPY_USE_I TRUE
148 #define ZIPPY_BUGHOUSE 0
149 #define ZIPPY_NOPLAY_CRAFTY FALSE
150 #define ZIPPY_GAME_END "gameend\n"
151 #define ZIPPY_GAME_START ""
152 #define ZIPPY_ADJOURN FALSE
153 #define ZIPPY_ABORT FALSE
154 #define ZIPPY_VARIANTS "normal"
155 #define ZIPPY_MAX_GAMES 0
156 #define ZIPPY_REPLAY_TIMEOUT 120
159 BeginningOfGame, MachinePlaysWhite, MachinePlaysBlack,
160 AnalyzeMode, AnalyzeFile, TwoMachinesPlay,
161 EditGame, PlayFromGameFile, EndOfGame, EditPosition, Training,
162 IcsIdle, IcsPlayingWhite, IcsPlayingBlack, IcsObserving,
167 WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, WhiteKing,
168 BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, BlackKing,
170 ClearBoard, WhitePlay, BlackPlay /*for use on EditPosition menus*/
173 typedef ChessSquare Board[BOARD_SIZE][BOARD_SIZE];
176 WhiteKingSideCastle = 1, WhiteQueenSideCastle,
177 WhiteKingSideCastleWild, WhiteQueenSideCastleWild,
178 WhiteHSideCastleFR, WhiteASideCastleFR,
179 BlackKingSideCastle, BlackQueenSideCastle,
180 BlackKingSideCastleWild, BlackQueenSideCastleWild,
181 BlackHSideCastleFR, BlackASideCastleFR,
182 WhitePromotionKnight, WhitePromotionBishop,
183 WhitePromotionRook, WhitePromotionQueen, WhitePromotionKing,
184 BlackPromotionKnight, BlackPromotionBishop,
185 BlackPromotionRook, BlackPromotionQueen, BlackPromotionKing,
186 WhiteCapturesEnPassant, BlackCapturesEnPassant,
187 WhiteDrop, BlackDrop,
188 NormalMove, AmbiguousMove, IllegalMove, ImpossibleMove,
189 WhiteWins, BlackWins, GameIsDrawn, GameUnfinished,
190 GNUChessGame, XBoardGame, MoveNumberOne,
191 Comment, PositionDiagram, ElapsedTime, PGNTag, NAG
195 ColorShout, ColorSShout, ColorChannel1, ColorChannel, ColorKibitz,
196 ColorTell, ColorChallenge, ColorRequest, ColorSeek, ColorNormal,
197 ColorNone, NColorClasses
201 SoundMove, SoundBell, SoundAlarm, SoundIcsWin, SoundIcsLoss,
202 SoundIcsDraw, SoundIcsUnfinished, NSoundClasses
205 /* Names for chess variants, not necessarily supported */
207 VariantNormal, /* Normal chess */
208 VariantLoadable, /* "loadgame" command allowed (not really a variant)*/
209 VariantWildCastle, /* Shuffle chess where king can castle from d file */
210 VariantNoCastle, /* Shuffle chess with no castling at all */
211 VariantFischeRandom, /* FischeRandom */
212 VariantBughouse, /* Bughouse, ICC/FICS rules */
213 VariantCrazyhouse, /* Crazyhouse, ICC/FICS rules */
214 VariantLosers, /* Try to lose all pieces or get mated (ICC wild 17)*/
215 VariantSuicide, /* Try to lose all pieces incl. king (FICS) */
216 VariantGiveaway, /* Try to have no legal moves left (ICC wild 26) */
217 VariantTwoKings, /* Weird ICC wild 9 */
218 VariantKriegspiel, /* Kriegspiel; pawns can capture invisible pieces */
219 VariantAtomic, /* Capturing piece explodes (ICC wild 27) */
220 Variant3Check, /* Win by giving check 3 times (ICC wild 25) */
221 VariantShatranj, /* Unsupported (ICC wild 28) */
222 Variant29, /* Temporary name for possible future ICC wild 29 */
223 Variant30, /* Temporary name for possible future ICC wild 30 */
224 Variant31, /* Temporary name for possible future ICC wild 31 */
225 Variant32, /* Temporary name for possible future ICC wild 32 */
226 Variant33, /* Temporary name for possible future ICC wild 33 */
227 Variant34, /* Temporary name for possible future ICC wild 34 */
228 Variant35, /* Temporary name for possible future ICC wild 35 */
229 Variant36, /* Temporary name for possible future ICC wild 36 */
230 VariantUnknown /* Catchall for other unknown variants */
233 #define VARIANT_NAMES { \
261 #if !defined(_amigados)
262 char *whitePieceColor;
263 char *blackPieceColor;
264 char *lightSquareColor;
265 char *darkSquareColor;
266 char *jailSquareColor;
267 char *highlightSquareColor;
268 char *premoveHighlightColor;
272 int lightSquareColor;
275 int highlightSquareColor;
276 int premoveHighlightColor;
281 char *secondInitString;
282 char *firstComputerString;
283 char *secondComputerString;
284 char *firstChessProgram;
285 char *secondChessProgram;
286 char *firstDirectory;
287 char *secondDirectory;
288 Boolean firstPlaysBlack;
289 Boolean noChessProgram;
292 char *bitmapDirectory;
300 char *icsCommPort; /* if set, use serial port instead of tcp host/port */
301 char *icsLogon; /* Hack to permit variable logon scripts. */
308 int loadGameIndex; /* game # within file */
310 Boolean autoSaveGames;
311 char *loadPositionFile;
312 int loadPositionIndex; /* position # within file */
313 char *savePositionFile;
325 char *messageFont; /* WinBoard only */
327 char *font; /* xboard only: all other fonts */
328 char *tagsFont; /* WinBoard only */
329 char *commentFont; /* WinBoard only */
330 char *icsFont; /* WinBoard only */
331 Boolean ringBellAfterMoves;
332 Boolean autoCallFlag;
334 Boolean autoFlipView;
335 char *cmailGameName; /* xboard only */
336 Boolean alwaysPromoteToQueen;
337 Boolean oldSaveStyle;
339 Boolean showThinking;
340 Boolean ponderNextMove;
341 Boolean periodicUpdates;
345 Boolean testLegality;
346 int borderXoffset; /* xboard only */
347 int borderYoffset; /* xboard only */
348 Boolean titleInWindow; /* xboard only */
349 Boolean localLineEditing; /* WinBoard only */
352 int flashCount; /* Number of times to flash (xboard only) */
353 int flashRate; /* Flashes per second (xboard only) */
354 char *pixmapDirectory; /* Path to XPM/XIM files to use (xboard only) */
355 int msLoginDelay; /* Delay per character (in msec) while sending
356 ICS logon script (xboard only) */
357 Boolean colorize; /* If True, use the following colors to color text */
358 /* Strings for colors, as "fg, bg, bold" (strings used in xboard only) */
365 char *colorChallenge;
369 char *soundProgram; /* sound-playing program */
376 char *soundChallenge;
383 char *soundIcsUnfinished;
387 Boolean animateDragging; /* If True, animate mouse dragging of pieces */
388 Boolean animate; /* If True, animate non-mouse moves */
389 int animSpeed; /* Delay in milliseconds between animation frames */
390 Boolean popupMoveErrors;
391 Boolean popupExitMessage;
393 Boolean highlightLastMove;
394 Boolean highlightDragging;
395 Boolean blindfold; /* if true, no pieces are drawn */
396 Boolean premove; /* true if premove feature enabled */
397 Boolean premoveWhite; /* true if premoving White first move */
398 char *premoveWhiteText; /* text of White premove 1 */
399 Boolean premoveBlack; /* true if premoving Black first move */
400 char *premoveBlackText; /* text of Black premove 1 */
401 Boolean icsAlarm; /* true if sounding alarm at a certain time */
402 int icsAlarmTime; /* time to sound alarm, in milliseconds */
403 Boolean autoRaiseBoard;
404 int fontSizeTolerance; /* xboard only */
407 int firstProtocolVersion;
408 int secondProtocolVersion;
409 Boolean showButtonBar;
414 char *zippyPassword2;
415 char *zippyWrongPassword;
416 char *zippyAcceptOnly;
419 int zippyNoplayCrafty;
421 char *zippyGameStart;
426 int zippyReplayTimeout; /*seconds*/
428 } AppData, *AppDataPtr;
430 extern AppData appData;
441 /* Additional info */
442 char *fen; /* NULL or FEN for starting position; input only */
445 char *extraTags; /* NULL or "[Tag \"Value\"]\n", etc. */
446 int whiteRating; /* -1 if unknown */
447 int blackRating; /* -1 if unknown */
448 VariantClass variant;