2 * args.c -- Option parsing and saving for X and Windows versions of XBoard
4 * Copyright 1991 by Digital Equipment Corporation, Maynard,
7 * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8 * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
10 * Enhancements Copyright 2005 Alessandro Scotti
12 * The following terms apply to Digital Equipment Corporation's copyright
14 * ------------------------------------------------------------------------
17 * Permission to use, copy, modify, and distribute this software and its
18 * documentation for any purpose and without fee is hereby granted,
19 * provided that the above copyright notice appear in all copies and that
20 * both that copyright notice and this permission notice appear in
21 * supporting documentation, and that the name of Digital not be
22 * used in advertising or publicity pertaining to distribution of the
23 * software without specific, written prior permission.
25 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
26 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
27 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
28 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
29 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
30 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
32 * ------------------------------------------------------------------------
34 * The following terms apply to the enhanced version of XBoard
35 * distributed by the Free Software Foundation:
36 * ------------------------------------------------------------------------
38 * GNU XBoard is free software: you can redistribute it and/or modify
39 * it under the terms of the GNU General Public License as published by
40 * the Free Software Foundation, either version 3 of the License, or (at
41 * your option) any later version.
43 * GNU XBoard is distributed in the hope that it will be useful, but
44 * WITHOUT ANY WARRANTY; without even the implied warranty of
45 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
46 * General Public License for more details.
48 * You should have received a copy of the GNU General Public License
49 * along with this program. If not, see http://www.gnu.org/licenses/. *
51 *------------------------------------------------------------------------
52 ** See the file ChangeLog for a revision history.
55 // Note: this file is not a normal header, but contains executable code
56 // for #inclusion in winboard.c and xboard.c, rather than separate compilation,
57 // so that it can make use of the proper context of #defined symbols and
58 // declarations in those files.
61 ArgString, ArgInt, ArgFloat, ArgBoolean, ArgTrue, ArgFalse, ArgNone,
62 ArgColor, ArgAttribs, ArgFilename, ArgBoardSize, ArgFont, ArgCommSettings,
63 ArgSettingsFilename, ArgTwo,
64 ArgX, ArgY, ArgZ // [HGM] placement: for window-placement options stored relative to main window
67 typedef void *ArgIniType;
69 #define INVALID (ArgIniType) 6915 /* Some number unlikely to be needed as default for anything */
70 #define MAX_ARG_LEN 128*1024 /* [AS] For Roger Brown's very long list! */
77 String *pString; // ArgString
79 float *pFloat; // ArgFloat
80 Boolean *pBoolean; // ArgBoolean
81 COLORREF *pColor; // ArgColor
82 ColorClass cc; // ArgAttribs
83 String *pFilename; // ArgFilename
84 BoardSize *pBoardSize; // ArgBoardSize
85 int whichFont; // ArgFont
86 DCB *pDCB; // ArgCommSettings
87 String *pFilename; // ArgSettingsFilename
92 ArgIniType defaultValue;
102 IcsTextMenuEntry icsTextMenuEntry[ICS_TEXT_MENU_SIZE];
107 char *firstEngineLine;
108 char *secondEngineLine;
111 void EnsureOnScreen(int *x, int *y, int minX, int minY);
112 char StringGet(void *getClosure);
113 void ParseFont(char *name, int number);
114 void SetFontDefaults();
116 void ParseColor(int n, char *name);
117 void ParseTextAttribs(ColorClass cc, char *s);
118 void ParseBoardSize(void * addr, char *name);
119 void ParseCommPortSettings(char *name);
120 void LoadAllSounds();
121 void SetCommPortDefaults();
122 void SaveFontArg(FILE *f, ArgDescriptor *ad);
124 void SaveAttribsArg(FILE *f, ArgDescriptor *ad);
125 void SaveColor(FILE *f, ArgDescriptor *ad);
126 void SaveBoardSize(FILE *f, char *name, void *addr);
127 void PrintCommPortSettings(FILE *f, char *name);
128 void GetWindowCoords();
130 void PopUpStartupDialog();
131 typedef char GetFunc(void *getClosure);
132 void ParseArgs(GetFunc get, void *cl);
134 // [HGM] this is an exact duplicate of something in winboard.c. Move to backend.c?
135 char *defaultTextAttribs[] =
137 COLOR_SHOUT, COLOR_SSHOUT, COLOR_CHANNEL1, COLOR_CHANNEL, COLOR_KIBITZ,
138 COLOR_TELL, COLOR_CHALLENGE, COLOR_REQUEST, COLOR_SEEK, COLOR_NORMAL,
142 ArgDescriptor argDescriptors[] = {
143 /* positional arguments */
144 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
145 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
146 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
147 { "is", ArgString, (void *) &icsNick, FALSE, INVALID },
148 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
149 { "", ArgNone, NULL, FALSE, INVALID },
150 /* keyword arguments */
152 { "whitePieceColor", ArgColor, (void *) 0, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
153 { "wpc", ArgColor, (void *) 0, FALSE, INVALID },
154 { "blackPieceColor", ArgColor, (void *) 1, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
155 { "bpc", ArgColor, (void *) 1, FALSE, INVALID },
156 { "lightSquareColor", ArgColor, (void *) 2, TRUE, (ArgIniType) LIGHT_SQUARE_COLOR },
157 { "lsc", ArgColor, (void *) 2, FALSE, INVALID },
158 { "darkSquareColor", ArgColor, (void *) 3, TRUE, (ArgIniType) DARK_SQUARE_COLOR },
159 { "dsc", ArgColor, (void *) 3, FALSE, INVALID },
160 { "highlightSquareColor", ArgColor, (void *) 4, TRUE, (ArgIniType) HIGHLIGHT_SQUARE_COLOR },
161 { "hsc", ArgColor, (void *) 4, FALSE, INVALID },
162 { "premoveHighlightColor", ArgColor, (void *) 5, TRUE, (ArgIniType) PREMOVE_HIGHLIGHT_COLOR },
163 { "phc", ArgColor, (void *) 5, FALSE, INVALID },
164 { "movesPerSession", ArgInt, (void *) &appData.movesPerSession, TRUE, (ArgIniType) MOVES_PER_SESSION },
165 { "mps", ArgInt, (void *) &appData.movesPerSession, FALSE, INVALID },
166 { "initString", ArgString, (void *) &appData.firstInitString, FALSE, INVALID },
167 { "firstInitString", ArgString, (void *) &appData.firstInitString, FALSE, (ArgIniType) INIT_STRING },
168 { "secondInitString", ArgString, (void *) &appData.secondInitString, FALSE, (ArgIniType) INIT_STRING },
169 { "firstComputerString", ArgString, (void *) &appData.firstComputerString,
170 FALSE, (ArgIniType) COMPUTER_STRING },
171 { "secondComputerString", ArgString, (void *) &appData.secondComputerString,
172 FALSE, (ArgIniType) COMPUTER_STRING },
173 { "firstChessProgram", ArgFilename, (void *) &appData.firstChessProgram,
174 FALSE, (ArgIniType) FIRST_CHESS_PROGRAM },
175 { "fcp", ArgFilename, (void *) &appData.firstChessProgram, FALSE, INVALID },
176 { "secondChessProgram", ArgFilename, (void *) &appData.secondChessProgram,
177 FALSE, (ArgIniType) SECOND_CHESS_PROGRAM },
178 { "scp", ArgFilename, (void *) &appData.secondChessProgram, FALSE, INVALID },
179 { "fe", ArgString, (void *) &firstEngineLine, FALSE, "" },
180 { "se", ArgString, (void *) &secondEngineLine, FALSE, "" },
181 { "firstPlaysBlack", ArgBoolean, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
182 { "fb", ArgTrue, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
183 { "xfb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
184 { "-fb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
185 { "noChessProgram", ArgBoolean, (void *) &appData.noChessProgram, FALSE, FALSE },
186 { "ncp", ArgTrue, (void *) &appData.noChessProgram, FALSE, INVALID },
187 { "xncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
188 { "-ncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
189 { "firstHost", ArgString, (void *) &appData.firstHost, FALSE, (ArgIniType) FIRST_HOST },
190 { "fh", ArgString, (void *) &appData.firstHost, FALSE, INVALID },
191 { "secondHost", ArgString, (void *) &appData.secondHost, FALSE, (ArgIniType) SECOND_HOST },
192 { "sh", ArgString, (void *) &appData.secondHost, FALSE, INVALID },
193 { "firstDirectory", ArgFilename, (void *) &appData.firstDirectory, FALSE, (ArgIniType) FIRST_DIRECTORY },
194 { "fd", ArgFilename, (void *) &appData.firstDirectory, FALSE, INVALID },
195 { "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY },
196 { "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID },
197 { "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE },
199 /* some options only used by the XBoard front end, and ignored in WinBoard */
200 /* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */
201 { "internetChessServerInputBox", ArgBoolean, (void *) &appData.icsInputBox, XBOARD, (ArgIniType) FALSE },
202 { "icsinput", ArgTrue, (void *) &appData.icsInputBox, FALSE, INVALID },
203 { "xicsinput", ArgFalse, (void *) &appData.icsInputBox, FALSE, INVALID },
204 { "cmail", ArgString, (void *) &appData.cmailGameName, FALSE, (ArgIniType) "" },
205 { "soundProgram", ArgFilename, (void *) &appData.soundProgram, XBOARD, (ArgIniType) "play" },
206 { "fontSizeTolerance", ArgInt, (void *) &appData.fontSizeTolerance, XBOARD, (ArgIniType) 4 },
207 { "lowTimeWarningColor", ArgColor, (void *) 6, XBOARD, (ArgIniType) LOWTIMEWARNING_COLOR },
208 { "lowTimeWarning", ArgBoolean, (void *) &appData.lowTimeWarning, XBOARD, (ArgIniType) FALSE },
209 { "titleInWindow", ArgBoolean, (void *) &appData.titleInWindow, XBOARD, (ArgIniType) FALSE },
210 { "title", ArgTrue, (void *) &appData.titleInWindow, FALSE, INVALID },
211 { "xtitle", ArgFalse, (void *) &appData.titleInWindow, FALSE, INVALID },
212 { "flashCount", ArgInt, (void *) &appData.flashCount, XBOARD, INVALID }, // let X handle this
213 { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE },
214 { "pixmapDirectory", ArgFilename, (void *) &appData.pixmapDirectory, XBOARD, (ArgIniType) "" },
215 { "pixmap", ArgFilename, (void *) &appData.pixmapDirectory, FALSE, INVALID },
216 { "bitmapDirectory", ArgFilename, (void *) &appData.bitmapDirectory, XBOARD, (ArgIniType) "" },
217 { "bm", ArgFilename, (void *) &appData.bitmapDirectory, FALSE, INVALID },
218 { "pngDirectory", ArgFilename, (void *) &appData.pngDirectory, XBOARD, (ArgIniType) "" },
219 { "png", ArgFilename, (void *) &appData.pngDirectory, FALSE, INVALID },
220 { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" },
221 { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY },
222 { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE },
224 { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE },
225 { "pieceMenu", ArgBoolean, (void *) &appData.pieceMenu, TRUE, (ArgIniType) TRUE },
226 { "sweepPromotions", ArgBoolean, (void *) &appData.sweepSelect, TRUE, (ArgIniType) FALSE },
227 { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL },
228 { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID },
229 { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, (ArgIniType) "" },
230 { "ruser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID },
231 { "timeDelay", ArgFloat, (void *) &appData.timeDelay, TRUE, INVALID },
232 { "td", ArgFloat, (void *) &appData.timeDelay, FALSE, INVALID },
233 { "timeControl", ArgString, (void *) &appData.timeControl, TRUE, (ArgIniType) TIME_CONTROL },
234 { "tc", ArgString, (void *) &appData.timeControl, FALSE, INVALID },
235 { "timeIncrement", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
236 { "inc", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
237 { "internetChessServerMode", ArgBoolean, (void *) &appData.icsActive, FALSE, INVALID },
238 { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE },
239 { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
240 { "-ics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
241 { "is", ArgString, (void *) &icsNick, FALSE, "" },
242 { "internetChessServerHost", ArgString, (void *) &appData.icsHost, FALSE, (ArgIniType) "" },
243 { "icshost", ArgString, (void *) &appData.icsHost, FALSE, INVALID },
244 { "internetChessServerPort", ArgString, (void *) &appData.icsPort, FALSE, (ArgIniType) ICS_PORT },
245 { "icsport", ArgString, (void *) &appData.icsPort, FALSE, INVALID },
246 { "internetChessServerCommPort", ArgString, (void *) &appData.icsCommPort, FALSE, (ArgIniType) ICS_COMM_PORT },
247 { "icscomm", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
248 { "internetChessServerComPort", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
249 { "icscom", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
250 { "internetChessServerLogonScript", ArgFilename, (void *) &appData.icsLogon, FALSE, (ArgIniType) ICS_LOGON },
251 { "icslogon", ArgFilename, (void *) &appData.icsLogon, FALSE, INVALID },
252 { "useTelnet", ArgBoolean, (void *) &appData.useTelnet, FALSE, INVALID },
253 { "telnet", ArgTrue, (void *) &appData.useTelnet, FALSE, INVALID },
254 { "xtelnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
255 { "-telnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
256 { "telnetProgram", ArgFilename, (void *) &appData.telnetProgram, FALSE, (ArgIniType) TELNET_PROGRAM },
257 { "internetChessserverHelper", ArgFilename, (void *) &appData.icsHelper,
258 FALSE, INVALID }, // for XB
259 { "icshelper", ArgFilename, (void *) &appData.icsHelper, FALSE, (ArgIniType) "" },
260 { "seekGraph", ArgBoolean, (void *) &appData.seekGraph, TRUE, (ArgIniType) FALSE },
261 { "sg", ArgTrue, (void *) &appData.seekGraph, FALSE, INVALID },
262 { "autoRefresh", ArgBoolean, (void *) &appData.autoRefresh, TRUE, (ArgIniType) FALSE },
263 { "gateway", ArgString, (void *) &appData.gateway, FALSE, (ArgIniType) "" },
264 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, (ArgIniType) "" },
265 { "lgf", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
266 { "loadGameIndex", ArgInt, (void *) &appData.loadGameIndex, FALSE, (ArgIniType) 0 },
267 { "lgi", ArgInt, (void *) &appData.loadGameIndex, FALSE, INVALID },
268 { "saveGameFile", ArgFilename, (void *) &appData.saveGameFile, TRUE, (ArgIniType) "" },
269 { "sgf", ArgFilename, (void *) &appData.saveGameFile, FALSE, INVALID },
270 { "autoSaveGames", ArgBoolean, (void *) &appData.autoSaveGames, TRUE, (ArgIniType) FALSE },
271 { "autosave", ArgTrue, (void *) &appData.autoSaveGames, FALSE, INVALID },
272 { "xautosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
273 { "-autosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
274 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, (ArgIniType) "" },
275 { "lpf", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
276 { "loadPositionIndex", ArgInt, (void *) &appData.loadPositionIndex, FALSE, (ArgIniType) 1 },
277 { "lpi", ArgInt, (void *) &appData.loadPositionIndex, FALSE, INVALID },
278 { "savePositionFile", ArgFilename, (void *) &appData.savePositionFile, FALSE, (ArgIniType) "" },
279 { "spf", ArgFilename, (void *) &appData.savePositionFile, FALSE, INVALID },
280 { "matchMode", ArgBoolean, (void *) &appData.matchMode, FALSE, (ArgIniType) FALSE },
281 { "mm", ArgTrue, (void *) &appData.matchMode, FALSE, INVALID },
282 { "xmm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
283 { "-mm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
284 { "matchGames", ArgInt, (void *) &appData.matchGames, FALSE, (ArgIniType) 0 },
285 { "mg", ArgInt, (void *) &appData.matchGames, FALSE, INVALID },
286 { "monoMode", ArgBoolean, (void *) &appData.monoMode, TRUE, (ArgIniType) FALSE },
287 { "mono", ArgTrue, (void *) &appData.monoMode, FALSE, INVALID },
288 { "xmono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
289 { "-mono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
290 { "debugMode", ArgBoolean, (void *) &appData.debugMode, FALSE, (ArgIniType) FALSE },
291 { "debug", ArgTrue, (void *) &appData.debugMode, FALSE, INVALID },
292 { "xdebug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
293 { "-debug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
294 { "clockMode", ArgBoolean, (void *) &appData.clockMode, FALSE, (ArgIniType) TRUE },
295 { "clock", ArgTrue, (void *) &appData.clockMode, FALSE, INVALID },
296 { "xclock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
297 { "-clock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
298 { "searchTime", ArgString, (void *) &appData.searchTime, FALSE, (ArgIniType) "" },
299 { "st", ArgString, (void *) &appData.searchTime, FALSE, INVALID },
300 { "searchDepth", ArgInt, (void *) &appData.searchDepth, FALSE, (ArgIniType) 0 },
301 { "depth", ArgInt, (void *) &appData.searchDepth, FALSE, INVALID },
302 { "showCoords", ArgBoolean, (void *) &appData.showCoords, TRUE, (ArgIniType) FALSE },
303 { "coords", ArgTrue, (void *) &appData.showCoords, FALSE, INVALID },
304 { "xcoords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
305 { "-coords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
306 { "showThinking", ArgBoolean, (void *) &appData.showThinking, TRUE, (ArgIniType) FALSE },
307 { "thinking", ArgTrue, (void *) &appData.showThinking, FALSE, INVALID },
308 { "xthinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
309 { "-thinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
310 { "ponderNextMove", ArgBoolean, (void *) &appData.ponderNextMove, TRUE, (ArgIniType) TRUE },
311 { "ponder", ArgTrue, (void *) &appData.ponderNextMove, FALSE, INVALID },
312 { "xponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
313 { "-ponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
314 { "periodicUpdates", ArgBoolean, (void *) &appData.periodicUpdates, TRUE, (ArgIniType) TRUE },
315 { "periodic", ArgTrue, (void *) &appData.periodicUpdates, FALSE, INVALID },
316 { "xperiodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
317 { "-periodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
318 { "popupExitMessage", ArgBoolean, (void *) &appData.popupExitMessage, TRUE, (ArgIniType) TRUE },
319 { "exit", ArgTrue, (void *) &appData.popupExitMessage, FALSE, INVALID },
320 { "xexit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
321 { "-exit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
322 { "popupMoveErrors", ArgBoolean, (void *) &appData.popupMoveErrors, TRUE, (ArgIniType) FALSE },
323 { "popup", ArgTrue, (void *) &appData.popupMoveErrors, FALSE, INVALID },
324 { "xpopup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
325 { "-popup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
326 { "popUpErrors", ArgBoolean, (void *) &appData.popupMoveErrors,
327 FALSE, INVALID }, /* only so that old WinBoard.ini files from betas can be read */
328 { "clockFont", ArgFont, (void *) CLOCK_FONT, TRUE, INVALID },
329 { "messageFont", ArgFont, (void *) MESSAGE_FONT, TRUE, INVALID },
330 { "font", ArgFont, (void *) MESSAGE_FONT, FALSE, INVALID }, /* only so that old .xboardrc files will parse. -font does not work from the command line because it is captured by the X libraries. */
331 { "coordFont", ArgFont, (void *) COORD_FONT, TRUE, INVALID },
332 { "tagsFont", ArgFont, (void *) EDITTAGS_FONT, TRUE, INVALID },
333 { "commentFont", ArgFont, (void *) COMMENT_FONT, TRUE, INVALID },
334 { "icsFont", ArgFont, (void *) CONSOLE_FONT, TRUE, INVALID },
335 { "moveHistoryFont", ArgFont, (void *) MOVEHISTORY_FONT, TRUE, INVALID }, /* [AS] */
336 { "gameListFont", ArgFont, (void *) GAMELIST_FONT, TRUE, INVALID }, /* [HGM] */
337 { "boardSize", ArgBoardSize, (void *) &boardSize,
338 TRUE, (ArgIniType) -1 }, /* must come after all fonts */
339 { "size", ArgBoardSize, (void *) &boardSize, FALSE, INVALID },
340 { "ringBellAfterMoves", ArgBoolean, (void *) &appData.ringBellAfterMoves,
341 FALSE, (ArgIniType) TRUE }, /* historical; kept only so old winboard.ini files will parse */
342 { "bell", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
343 { "xbell", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
344 { "movesound", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
345 { "xmovesound", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
346 { "alwaysOnTop", ArgBoolean, (void *) &alwaysOnTop, TRUE, INVALID },
347 { "top", ArgTrue, (void *) &alwaysOnTop, FALSE, INVALID },
348 { "xtop", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
349 { "-top", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
350 { "autoCallFlag", ArgBoolean, (void *) &appData.autoCallFlag, TRUE, (ArgIniType) FALSE },
351 { "autoflag", ArgTrue, (void *) &appData.autoCallFlag, FALSE, INVALID },
352 { "xautoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
353 { "-autoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
354 { "autoComment", ArgBoolean, (void *) &appData.autoComment, TRUE, (ArgIniType) FALSE },
355 { "autocomm", ArgTrue, (void *) &appData.autoComment, FALSE, INVALID },
356 { "xautocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
357 { "-autocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
358 { "autoObserve", ArgBoolean, (void *) &appData.autoObserve, TRUE, (ArgIniType) FALSE },
359 { "autobs", ArgTrue, (void *) &appData.autoObserve, FALSE, INVALID },
360 { "xautobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
361 { "-autobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
362 { "flipView", ArgBoolean, (void *) &appData.flipView, FALSE, (ArgIniType) FALSE },
363 { "flip", ArgTrue, (void *) &appData.flipView, FALSE, INVALID },
364 { "xflip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
365 { "-flip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
366 { "autoFlipView", ArgBoolean, (void *) &appData.autoFlipView, TRUE, (ArgIniType) TRUE },
367 { "autoflip", ArgTrue, (void *) &appData.autoFlipView, FALSE, INVALID },
368 { "xautoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
369 { "-autoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
370 { "autoRaiseBoard", ArgBoolean, (void *) &appData.autoRaiseBoard, TRUE, (ArgIniType) TRUE },
371 { "autoraise", ArgTrue, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
372 { "xautoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
373 { "-autoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
374 { "alwaysPromoteToQueen", ArgBoolean, (void *) &appData.alwaysPromoteToQueen, TRUE, (ArgIniType) FALSE },
375 { "queen", ArgTrue, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
376 { "xqueen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
377 { "-queen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
378 { "oldSaveStyle", ArgBoolean, (void *) &appData.oldSaveStyle, TRUE, (ArgIniType) FALSE },
379 { "oldsave", ArgTrue, (void *) &appData.oldSaveStyle, FALSE, INVALID },
380 { "xoldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
381 { "-oldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
382 { "quietPlay", ArgBoolean, (void *) &appData.quietPlay, TRUE, (ArgIniType) FALSE },
383 { "quiet", ArgTrue, (void *) &appData.quietPlay, FALSE, INVALID },
384 { "xquiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
385 { "-quiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
386 { "getMoveList", ArgBoolean, (void *) &appData.getMoveList, TRUE, (ArgIniType) TRUE },
387 { "moves", ArgTrue, (void *) &appData.getMoveList, FALSE, INVALID },
388 { "xmoves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
389 { "-moves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
390 { "testLegality", ArgBoolean, (void *) &appData.testLegality, TRUE, (ArgIniType) TRUE },
391 { "legal", ArgTrue, (void *) &appData.testLegality, FALSE, INVALID },
392 { "xlegal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
393 { "-legal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
394 { "premove", ArgBoolean, (void *) &appData.premove, TRUE, (ArgIniType) TRUE },
395 { "pre", ArgTrue, (void *) &appData.premove, FALSE, INVALID },
396 { "xpre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
397 { "-pre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
398 { "premoveWhite", ArgBoolean, (void *) &appData.premoveWhite, TRUE, (ArgIniType) FALSE },
399 { "prewhite", ArgTrue, (void *) &appData.premoveWhite, FALSE, INVALID },
400 { "xprewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
401 { "-prewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
402 { "premoveWhiteText", ArgString, (void *) &appData.premoveWhiteText, TRUE, (ArgIniType) "" },
403 { "premoveBlack", ArgBoolean, (void *) &appData.premoveBlack, TRUE, (ArgIniType) FALSE },
404 { "preblack", ArgTrue, (void *) &appData.premoveBlack, FALSE, INVALID },
405 { "xpreblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
406 { "-preblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
407 { "premoveBlackText", ArgString, (void *) &appData.premoveBlackText, TRUE, (ArgIniType) "" },
408 { "icsAlarm", ArgBoolean, (void *) &appData.icsAlarm, TRUE, (ArgIniType) TRUE},
409 { "alarm", ArgTrue, (void *) &appData.icsAlarm, FALSE},
410 { "xalarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
411 { "-alarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
412 { "icsAlarmTime", ArgInt, (void *) &appData.icsAlarmTime, TRUE, (ArgIniType) 5000},
413 { "localLineEditing", ArgBoolean, (void *) &appData.localLineEditing, FALSE, (ArgIniType) TRUE},
414 { "edit", ArgTrue, (void *) &appData.localLineEditing, FALSE, INVALID },
415 { "xedit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
416 { "-edit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
417 { "animateMoving", ArgBoolean, (void *) &appData.animate, TRUE, (ArgIniType) TRUE },
418 { "animate", ArgTrue, (void *) &appData.animate, FALSE, INVALID },
419 { "xanimate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
420 { "-animate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
421 { "animateSpeed", ArgInt, (void *) &appData.animSpeed, TRUE, (ArgIniType) 10 },
422 { "animateDragging", ArgBoolean, (void *) &appData.animateDragging, TRUE, (ArgIniType) TRUE },
423 { "drag", ArgTrue, (void *) &appData.animateDragging, FALSE, INVALID },
424 { "xdrag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
425 { "-drag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
426 { "blindfold", ArgBoolean, (void *) &appData.blindfold, TRUE, (ArgIniType) FALSE },
427 { "blind", ArgTrue, (void *) &appData.blindfold, FALSE, INVALID },
428 { "xblind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
429 { "-blind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
430 { "highlightLastMove", ArgBoolean,
431 (void *) &appData.highlightLastMove, TRUE, (ArgIniType) TRUE },
432 { "highlight", ArgTrue, (void *) &appData.highlightLastMove, FALSE, INVALID },
433 { "xhighlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
434 { "-highlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
435 { "highlightDragging", ArgBoolean,
436 (void *) &appData.highlightDragging, !XBOARD, (ArgIniType) TRUE },
437 { "highdrag", ArgTrue, (void *) &appData.highlightDragging, FALSE, INVALID },
438 { "xhighdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
439 { "-highdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
440 { "colorizeMessages", ArgBoolean, (void *) &appData.colorize, TRUE, (ArgIniType) TRUE },
441 { "colorize", ArgTrue, (void *) &appData.colorize, FALSE, INVALID },
442 { "xcolorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
443 { "-colorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
444 { "colorShout", ArgAttribs, (void *) ColorShout, TRUE, INVALID },
445 { "colorSShout", ArgAttribs, (void *) ColorSShout, TRUE, INVALID },
446 { "colorCShout", ArgAttribs, (void *) ColorSShout, FALSE, INVALID }, // for XB
447 { "colorChannel1", ArgAttribs, (void *) ColorChannel1, TRUE, INVALID },
448 { "colorChannel", ArgAttribs, (void *) ColorChannel, TRUE, INVALID },
449 { "colorKibitz", ArgAttribs, (void *) ColorKibitz, TRUE, INVALID },
450 { "colorTell", ArgAttribs, (void *) ColorTell, TRUE, INVALID },
451 { "colorChallenge", ArgAttribs, (void *) ColorChallenge, TRUE, INVALID },
452 { "colorRequest", ArgAttribs, (void *) ColorRequest, TRUE, INVALID },
453 { "colorSeek", ArgAttribs, (void *) ColorSeek, TRUE, INVALID },
454 { "colorNormal", ArgAttribs, (void *) ColorNormal, TRUE, INVALID },
455 { "colorBackground", ArgColor, (void *) 7, TRUE, COLOR_BKGD },
456 { "soundShout", ArgFilename, (void *) &appData.soundShout, TRUE, (ArgIniType) "" },
457 { "soundSShout", ArgFilename, (void *) &appData.soundSShout, TRUE, (ArgIniType) "" },
458 { "soundCShout", ArgFilename, (void *) &appData.soundSShout, FALSE, (ArgIniType) "" }, // for XB
459 { "soundChannel1", ArgFilename, (void *) &appData.soundChannel1, TRUE, (ArgIniType) "" },
460 { "soundChannel", ArgFilename, (void *) &appData.soundChannel, TRUE, (ArgIniType) "" },
461 { "soundKibitz", ArgFilename, (void *) &appData.soundKibitz, TRUE, (ArgIniType) "" },
462 { "soundTell", ArgFilename, (void *) &appData.soundTell, TRUE, (ArgIniType) "" },
463 { "soundChallenge", ArgFilename, (void *) &appData.soundChallenge, TRUE, (ArgIniType) "" },
464 { "soundRequest", ArgFilename, (void *) &appData.soundRequest, TRUE, (ArgIniType) "" },
465 { "soundSeek", ArgFilename, (void *) &appData.soundSeek, TRUE, (ArgIniType) "" },
466 { "soundMove", ArgFilename, (void *) &appData.soundMove, TRUE, (ArgIniType) "" },
467 { "soundBell", ArgFilename, (void *) &appData.soundBell, TRUE, (ArgIniType) SOUND_BELL },
468 { "soundIcsWin", ArgFilename, (void *) &appData.soundIcsWin, TRUE, (ArgIniType) "" },
469 { "soundIcsLoss", ArgFilename, (void *) &appData.soundIcsLoss, TRUE, (ArgIniType) "" },
470 { "soundIcsDraw", ArgFilename, (void *) &appData.soundIcsDraw, TRUE, (ArgIniType) "" },
471 { "soundIcsUnfinished", ArgFilename, (void *) &appData.soundIcsUnfinished, TRUE, (ArgIniType) "" },
472 { "soundIcsAlarm", ArgFilename, (void *) &appData.soundIcsAlarm, TRUE, (ArgIniType) "" },
473 { "disguisePromotedPieces", ArgBoolean, (void *) &appData.disguise, TRUE, (ArgIniType) TRUE },
474 { "reuseFirst", ArgBoolean, (void *) &appData.reuseFirst, FALSE, (ArgIniType) TRUE },
475 { "reuse", ArgTrue, (void *) &appData.reuseFirst, FALSE, INVALID },
476 { "xreuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
477 { "-reuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
478 { "reuseChessPrograms", ArgBoolean,
479 (void *) &appData.reuseFirst, FALSE, INVALID }, /* backward compat only */
480 { "reuseSecond", ArgBoolean, (void *) &appData.reuseSecond, FALSE, (ArgIniType) TRUE },
481 { "reuse2", ArgTrue, (void *) &appData.reuseSecond, FALSE, INVALID },
482 { "xreuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
483 { "-reuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
484 { "comPortSettings", ArgCommSettings, (void *) /*&dcb*/ 0, TRUE, INVALID },
485 { "settingsFile", ArgSettingsFilename, (void *) &settingsFileName, FALSE, (ArgIniType) SETTINGS_FILE },
486 { "ini", ArgSettingsFilename, (void *) &settingsFileName, FALSE, INVALID },
487 { "at", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
488 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
489 { "saveSettingsFile", ArgFilename, (void *) &settingsFileName, FALSE, INVALID },
490 { "saveSettingsOnExit", ArgBoolean, (void *) &saveSettingsOnExit, TRUE, (ArgIniType) TRUE },
491 { "chessProgram", ArgBoolean, (void *) &chessProgram, FALSE, (ArgIniType) FALSE },
492 { "cp", ArgTrue, (void *) &chessProgram, FALSE, INVALID },
493 { "xcp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
494 { "-cp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
495 { "icsMenu", ArgString, (void *) &icsTextMenuString, TRUE, (ArgIniType) ICS_TEXT_MENU_DEFAULT },
496 { "icsNames", ArgString, (void *) &icsNames, TRUE, (ArgIniType) ICS_NAMES },
497 { "singleEngineList", ArgBoolean, (void *) &singleList, !XBOARD, (ArgIniType) FALSE },
498 { "recentEngines", ArgInt, (void *) &appData.recentEngines, TRUE, (ArgIniType) 6 },
499 { "recentEngineList", ArgString, (void *) &appData.recentEngineList, TRUE, (ArgIniType) "" },
500 { "firstChessProgramNames", ArgString, (void *) &firstChessProgramNames,
501 TRUE, (ArgIniType) FCP_NAMES },
502 { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
503 !XBOARD, (ArgIniType) SCP_NAMES },
504 { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
505 { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
506 { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
507 { "firstProtocolVersion", ArgInt, (void *) &appData.firstProtocolVersion, FALSE, (ArgIniType) PROTOVER },
508 { "secondProtocolVersion", ArgInt, (void *) &appData.secondProtocolVersion,FALSE, (ArgIniType) PROTOVER },
509 { "showButtonBar", ArgBoolean, (void *) &appData.showButtonBar, TRUE, (ArgIniType) TRUE },
510 { "buttons", ArgTrue, (void *) &appData.showButtonBar, FALSE, INVALID },
511 { "xbuttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
512 { "-buttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
514 /* [AS] New features */
515 { "firstScoreAbs", ArgBoolean, (void *) &appData.firstScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
516 { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
517 { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
518 { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
519 { "liteBackTextureFile", ArgString, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
520 { "darkBackTextureFile", ArgString, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
521 { "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
522 { "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
523 { "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
524 { "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
525 { "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
526 { "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
527 { "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
528 { "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
529 { "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
530 { "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
531 { "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
532 { "delayBeforeQuit", ArgInt, (void *) &appData.delayBeforeQuit, TRUE, (ArgIniType) 0 },
533 { "delayAfterQuit", ArgInt, (void *) &appData.delayAfterQuit, TRUE, (ArgIniType) 0 },
534 { "nameOfDebugFile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, (ArgIniType) DEBUG_FILE },
535 { "debugfile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, INVALID },
536 { "pgnEventHeader", ArgString, (void *) &appData.pgnEventHeader, TRUE, (ArgIniType) "Computer Chess Game" },
537 { "defaultFrcPosition", ArgInt, (void *) &appData.defaultFrcPosition, TRUE, (ArgIniType) -1 },
538 { "shuffleOpenings", ArgTrue, (void *) &shuffleOpenings, FALSE, INVALID },
539 { "gameListTags", ArgString, (void *) &appData.gameListTags, TRUE, (ArgIniType) GLT_DEFAULT_TAGS },
540 { "saveOutOfBookInfo", ArgBoolean, (void *) &appData.saveOutOfBookInfo, TRUE, (ArgIniType) TRUE },
541 { "showEvalInMoveHistory", ArgBoolean, (void *) &appData.showEvalInMoveHistory, TRUE, (ArgIniType) TRUE },
542 { "evalHistColorWhite", ArgColor, (void *) 12, TRUE, (ArgIniType) "#FFFFB0" },
543 { "evalHistColorBlack", ArgColor, (void *) 13, TRUE, (ArgIniType) "#AD5D3D" },
544 { "highlightMoveWithArrow", ArgBoolean, (void *) &appData.highlightMoveWithArrow, TRUE, (ArgIniType) FALSE },
545 { "highlightArrowColor", ArgColor, (void *) 14, TRUE, (ArgIniType) "#FFFF80" },
546 { "stickyWindows", ArgBoolean, (void *) &appData.useStickyWindows, TRUE, (ArgIniType) TRUE },
547 { "adjudicateDrawMoves", ArgInt, (void *) &appData.adjudicateDrawMoves, TRUE, (ArgIniType) 0 },
548 { "autoDisplayComment", ArgBoolean, (void *) &appData.autoDisplayComment, TRUE, (ArgIniType) TRUE },
549 { "autoDisplayTags", ArgBoolean, (void *) &appData.autoDisplayTags, TRUE, (ArgIniType) TRUE },
550 { "firstIsUCI", ArgBoolean, (void *) &appData.firstIsUCI, FALSE, (ArgIniType) FALSE },
551 { "fUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
552 { "firstUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
553 { "secondIsUCI", ArgBoolean, (void *) &appData.secondIsUCI, FALSE, (ArgIniType) FALSE },
554 { "secondUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
555 { "sUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
556 { "fUCCI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
557 { "sUCCI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
558 { "fUSI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
559 { "sUSI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
560 { "firstHasOwnBookUCI", ArgBoolean, (void *) &appData.firstHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
561 { "fNoOwnBookUCI", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
562 { "firstXBook", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
563 { "secondHasOwnBookUCI", ArgBoolean, (void *) &appData.secondHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
564 { "sNoOwnBookUCI", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
565 { "secondXBook", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
566 { "adapterCommand", ArgFilename, (void *) &appData.adapterCommand, TRUE, (ArgIniType) "polyglot -noini -ec \"%fcp\" -ed \"%fd\"" },
567 { "uxiAdapter", ArgFilename, (void *) &appData.ucciAdapter, TRUE, (ArgIniType) "" },
568 { "polyglotDir", ArgFilename, (void *) &appData.polyglotDir, TRUE, (ArgIniType) "" },
569 { "usePolyglotBook", ArgBoolean, (void *) &appData.usePolyglotBook, TRUE, (ArgIniType) FALSE },
570 { "polyglotBook", ArgFilename, (void *) &appData.polyglotBook, TRUE, (ArgIniType) "" },
571 { "bookDepth", ArgInt, (void *) &appData.bookDepth, TRUE, (ArgIniType) 12 },
572 { "bookVariation", ArgInt, (void *) &appData.bookStrength, TRUE, (ArgIniType) 50 },
573 { "discourageOwnBooks", ArgBoolean, (void *) &appData.defNoBook, TRUE, (ArgIniType) FALSE },
574 { "defaultHashSize", ArgInt, (void *) &appData.defaultHashSize, TRUE, (ArgIniType) 64 },
575 { "defaultCacheSizeEGTB", ArgInt, (void *) &appData.defaultCacheSizeEGTB, TRUE, (ArgIniType) 4 },
576 { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
577 { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
578 { "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
579 { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
580 { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
582 // [HGM] tournament options
583 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
584 { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
585 { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" },
586 { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 },
587 { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID },
588 { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 },
589 { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID },
590 { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" },
591 { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE },
592 { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE },
593 { "seedBase", ArgInt, (void *) &appData.seedBase, FALSE, (ArgIniType) 1 },
594 { "pgnNumberTag", ArgBoolean, (void *) &appData.numberTag, TRUE, (ArgIniType) FALSE },
595 { "afterGame", ArgString, (void *) &appData.afterGame, FALSE, INVALID },
596 { "afterTourney", ArgString, (void *) &appData.afterTourney, FALSE, INVALID },
598 /* [HGM] board-size, adjudication and misc. options */
599 { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE },
600 { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 },
601 { "boardHeight", ArgInt, (void *) &appData.NrRanks, FALSE, (ArgIniType) -1 },
602 { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, FALSE, (ArgIniType) -1 },
603 { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 },
604 { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 },
605 { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID },
606 { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID },
607 { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID },
608 { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE },
609 { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE },
610 { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE },
611 { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE },
612 { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE },
613 { "testClaims", ArgBoolean, (void *) &appData.testClaims, TRUE, (ArgIniType) FALSE },
614 { "checkMates", ArgBoolean, (void *) &appData.checkMates, TRUE, (ArgIniType) FALSE },
615 { "materialDraws", ArgBoolean, (void *) &appData.materialDraws, TRUE, (ArgIniType) FALSE },
616 { "trivialDraws", ArgBoolean, (void *) &appData.trivialDraws, TRUE, (ArgIniType) FALSE },
617 { "ruleMoves", ArgInt, (void *) &appData.ruleMoves, TRUE, (ArgIniType) 51 },
618 { "repeatsToDraw", ArgInt, (void *) &appData.drawRepeats, TRUE, (ArgIniType) 6 },
619 { "backgroundObserve", ArgBoolean, (void *) &appData.bgObserve, TRUE, (ArgIniType) FALSE },
620 { "dualBoard", ArgBoolean, (void *) &appData.dualBoard, TRUE, (ArgIniType) FALSE },
621 { "autoKibitz", ArgTrue, (void *) &appData.autoKibitz, FALSE, INVALID },
622 { "engineDebugOutput", ArgInt, (void *) &appData.engineComments, FALSE, (ArgIniType) 1 },
623 { "userName", ArgString, (void *) &appData.userName, FALSE, INVALID },
624 { "rewindIndex", ArgInt, (void *) &appData.rewindIndex, FALSE, INVALID },
625 { "sameColorGames", ArgInt, (void *) &appData.sameColorGames, FALSE, INVALID },
626 { "smpCores", ArgInt, (void *) &appData.smpCores, TRUE, (ArgIniType) 1 },
627 { "egtFormats", ArgString, (void *) &appData.egtFormats, TRUE, (ArgIniType) "" },
628 { "niceEngines", ArgInt, (void *) &appData.niceEngines, TRUE, INVALID },
629 { "logoSize", ArgInt, (void *) &appData.logoSize, XBOARD, INVALID },
630 { "logoDir", ArgFilename, (void *) &appData.logoDir, XBOARD, (ArgIniType) "." },
631 { "firstLogo", ArgFilename, (void *) &appData.firstLogo, FALSE, (ArgIniType) "" },
632 { "secondLogo", ArgFilename, (void *) &appData.secondLogo, FALSE, (ArgIniType) "" },
633 { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID },
634 { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" },
635 { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" },
636 { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" },
637 { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" },
638 { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" },
639 { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL },
640 { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL },
641 { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
642 { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
643 { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
644 { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, (ArgIniType) FALSE },
645 { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" },
646 { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID },
647 { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
648 { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
649 { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
650 { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
651 { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 },
652 { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 },
653 { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
654 { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
655 { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
656 { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
657 { "eloThresholdAny", ArgInt, (void *) &appData.eloThreshold1, FALSE, (ArgIniType) 0 },
658 { "eloThresholdBoth", ArgInt, (void *) &appData.eloThreshold2, FALSE, (ArgIniType) 0 },
659 { "dateThreshold", ArgInt, (void *) &appData.dateThreshold, FALSE, (ArgIniType) 0 },
660 { "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
661 { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
662 { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
663 { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
664 { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE },
665 { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" },
666 { "tourneyOptions", ArgString, (void *) &appData.tourneyOptions, TRUE, (ArgIniType) "-ncp -mm -saveSettingsOnExit false" },
667 { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE },
668 { "topLevel", ArgBoolean, (void *) &appData.topLevel, XBOARD, (ArgIniType) TOPLEVEL },
669 { "dialogColor", ArgString, (void *) &appData.dialogColor, XBOARD, (ArgIniType) "" },
670 { "buttonColor", ArgString, (void *) &appData.buttonColor, XBOARD, (ArgIniType) "" },
673 { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
674 { "zt", ArgTrue, (void *) &appData.zippyTalk, FALSE, INVALID },
675 { "xzt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
676 { "-zt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
677 { "zippyPlay", ArgBoolean, (void *) &appData.zippyPlay, FALSE, (ArgIniType) ZIPPY_PLAY },
678 { "zp", ArgTrue, (void *) &appData.zippyPlay, FALSE, INVALID },
679 { "xzp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
680 { "-zp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
681 { "zippyLines", ArgFilename, (void *) &appData.zippyLines, FALSE, (ArgIniType) ZIPPY_LINES },
682 { "zippyPinhead", ArgString, (void *) &appData.zippyPinhead, FALSE, (ArgIniType) ZIPPY_PINHEAD },
683 { "zippyPassword", ArgString, (void *) &appData.zippyPassword, FALSE, (ArgIniType) ZIPPY_PASSWORD },
684 { "zippyPassword2", ArgString, (void *) &appData.zippyPassword2, FALSE, (ArgIniType) ZIPPY_PASSWORD2 },
685 { "zippyWrongPassword", ArgString, (void *) &appData.zippyWrongPassword,
686 FALSE, (ArgIniType) ZIPPY_WRONG_PASSWORD },
687 { "zippyAcceptOnly", ArgString, (void *) &appData.zippyAcceptOnly, FALSE, (ArgIniType) ZIPPY_ACCEPT_ONLY },
688 { "zippyUseI", ArgBoolean, (void *) &appData.zippyUseI, FALSE, (ArgIniType) ZIPPY_USE_I },
689 { "zui", ArgTrue, (void *) &appData.zippyUseI, FALSE, INVALID },
690 { "xzui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
691 { "-zui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
692 { "zippyBughouse", ArgInt, (void *) &appData.zippyBughouse, FALSE, (ArgIniType) ZIPPY_BUGHOUSE },
693 { "zippyNoplayCrafty", ArgBoolean, (void *) &appData.zippyNoplayCrafty,
694 FALSE, (ArgIniType) ZIPPY_NOPLAY_CRAFTY },
695 { "znc", ArgTrue, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
696 { "xznc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
697 { "-znc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
698 { "zippyGameEnd", ArgString, (void *) &appData.zippyGameEnd, FALSE, (ArgIniType) ZIPPY_GAME_END },
699 { "zippyGameStart", ArgString, (void *) &appData.zippyGameStart, FALSE, (ArgIniType) ZIPPY_GAME_START },
700 { "zippyAdjourn", ArgBoolean, (void *) &appData.zippyAdjourn, FALSE, (ArgIniType) ZIPPY_ADJOURN },
701 { "zadj", ArgTrue, (void *) &appData.zippyAdjourn, FALSE, INVALID },
702 { "xzadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
703 { "-zadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
704 { "zippyAbort", ArgBoolean, (void *) &appData.zippyAbort, FALSE, (ArgIniType) ZIPPY_ABORT },
705 { "zab", ArgTrue, (void *) &appData.zippyAbort, FALSE, INVALID },
706 { "xzab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
707 { "-zab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
708 { "zippyVariants", ArgString, (void *) &appData.zippyVariants, FALSE, (ArgIniType) ZIPPY_VARIANTS },
709 { "zippyMaxGames", ArgInt, (void *)&appData.zippyMaxGames, FALSE, (ArgIniType) ZIPPY_MAX_GAMES},
710 { "zippyReplayTimeout", ArgInt, (void *)&appData.zippyReplayTimeout, FALSE, (ArgIniType) ZIPPY_REPLAY_TIMEOUT },
711 { "zippyShortGame", ArgInt, (void *)&appData.zippyShortGame, FALSE, INVALID },
712 /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */
713 { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
715 /* [HGM] options for broadcasting and time odds */
716 { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
717 { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
718 { "serverFile", ArgString, (void *) &appData.serverFileName, FALSE, (ArgIniType) NULL },
719 { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
720 { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
721 { "firstTimeOdds", ArgInt, (void *) &appData.firstTimeOdds, FALSE, (ArgIniType) 1 },
722 { "secondTimeOdds", ArgInt, (void *) &appData.secondTimeOdds, FALSE, (ArgIniType) 1 },
723 { "timeOddsMode", ArgInt, (void *) &appData.timeOddsMode, TRUE, INVALID },
724 { "firstAccumulateTC", ArgInt, (void *) &appData.firstAccumulateTC, FALSE, (ArgIniType) 1 },
725 { "secondAccumulateTC", ArgInt, (void *) &appData.secondAccumulateTC, FALSE, (ArgIniType) 1 },
726 { "firstNPS", ArgInt, (void *) &appData.firstNPS, FALSE, (ArgIniType) -1 },
727 { "secondNPS", ArgInt, (void *) &appData.secondNPS, FALSE, (ArgIniType) -1 },
728 { "noGUI", ArgTrue, (void *) &appData.noGUI, FALSE, INVALID },
729 { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID },
730 { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID },
731 { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */
732 { "openCommand", ArgString, (void *) &appData.sysOpen, FALSE, "xdg-open" },
734 // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others
735 { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed
736 { "minY", ArgZ, (void *) &minY, FALSE, INVALID },
737 { "winWidth", ArgInt, (void *) &wpMain.width, TRUE, INVALID }, // [HGM] placement: dummies to remember right & bottom
738 { "winHeight", ArgInt, (void *) &wpMain.height, TRUE, INVALID }, // for attaching auxiliary windows to them
739 { "x", ArgInt, (void *) &wpMain.x, TRUE, (ArgIniType) CW_USEDEFAULT },
740 { "y", ArgInt, (void *) &wpMain.y, TRUE, (ArgIniType) CW_USEDEFAULT },
741 { "icsX", ArgX, (void *) &wpConsole.x, TRUE, (ArgIniType) CW_USEDEFAULT },
742 { "icsY", ArgY, (void *) &wpConsole.y, TRUE, (ArgIniType) CW_USEDEFAULT },
743 { "icsW", ArgInt, (void *) &wpConsole.width, TRUE, (ArgIniType) CW_USEDEFAULT },
744 { "icsH", ArgInt, (void *) &wpConsole.height, TRUE, (ArgIniType) CW_USEDEFAULT },
745 { "commentX", ArgX, (void *) &wpComment.x, TRUE, (ArgIniType) CW_USEDEFAULT },
746 { "commentY", ArgY, (void *) &wpComment.y, TRUE, (ArgIniType) CW_USEDEFAULT },
747 { "commentW", ArgInt, (void *) &wpComment.width, TRUE, (ArgIniType) CW_USEDEFAULT },
748 { "commentH", ArgInt, (void *) &wpComment.height, TRUE, (ArgIniType) CW_USEDEFAULT },
749 { "tagsX", ArgX, (void *) &wpTags.x, TRUE, (ArgIniType) CW_USEDEFAULT },
750 { "tagsY", ArgY, (void *) &wpTags.y, TRUE, (ArgIniType) CW_USEDEFAULT },
751 { "tagsW", ArgInt, (void *) &wpTags.width, TRUE, (ArgIniType) CW_USEDEFAULT },
752 { "tagsH", ArgInt, (void *) &wpTags.height, TRUE, (ArgIniType) CW_USEDEFAULT },
753 { "gameListX", ArgX, (void *) &wpGameList.x, TRUE, (ArgIniType) CW_USEDEFAULT },
754 { "gameListY", ArgY, (void *) &wpGameList.y, TRUE, (ArgIniType) CW_USEDEFAULT },
755 { "gameListW", ArgInt, (void *) &wpGameList.width, TRUE, (ArgIniType) CW_USEDEFAULT },
756 { "gameListH", ArgInt, (void *) &wpGameList.height, TRUE, (ArgIniType) CW_USEDEFAULT },
757 /* [AS] Layout stuff */
758 { "moveHistoryUp", ArgBoolean, (void *) &wpMoveHistory.visible, TRUE, (ArgIniType) TRUE },
759 { "moveHistoryX", ArgX, (void *) &wpMoveHistory.x, TRUE, (ArgIniType) CW_USEDEFAULT },
760 { "moveHistoryY", ArgY, (void *) &wpMoveHistory.y, TRUE, (ArgIniType) CW_USEDEFAULT },
761 { "moveHistoryW", ArgInt, (void *) &wpMoveHistory.width, TRUE, (ArgIniType) CW_USEDEFAULT },
762 { "moveHistoryH", ArgInt, (void *) &wpMoveHistory.height, TRUE, (ArgIniType) CW_USEDEFAULT },
764 { "evalGraphUp", ArgBoolean, (void *) &wpEvalGraph.visible, TRUE, (ArgIniType) TRUE },
765 { "evalGraphX", ArgX, (void *) &wpEvalGraph.x, TRUE, (ArgIniType) CW_USEDEFAULT },
766 { "evalGraphY", ArgY, (void *) &wpEvalGraph.y, TRUE, (ArgIniType) CW_USEDEFAULT },
767 { "evalGraphW", ArgInt, (void *) &wpEvalGraph.width, TRUE, (ArgIniType) CW_USEDEFAULT },
768 { "evalGraphH", ArgInt, (void *) &wpEvalGraph.height, TRUE, (ArgIniType) CW_USEDEFAULT },
770 { "engineOutputUp", ArgBoolean, (void *) &wpEngineOutput.visible, TRUE, (ArgIniType) TRUE },
771 { "engineOutputX", ArgX, (void *) &wpEngineOutput.x, TRUE, (ArgIniType) CW_USEDEFAULT },
772 { "engineOutputY", ArgY, (void *) &wpEngineOutput.y, TRUE, (ArgIniType) CW_USEDEFAULT },
773 { "engineOutputW", ArgInt, (void *) &wpEngineOutput.width, TRUE, (ArgIniType) CW_USEDEFAULT },
774 { "engineOutputH", ArgInt, (void *) &wpEngineOutput.height, TRUE, (ArgIniType) CW_USEDEFAULT },
776 { NULL, ArgNone, NULL, FALSE, INVALID }
780 /* Kludge for indirection files on command line */
781 char* lastIndirectionFilename;
782 ArgDescriptor argDescriptorIndirection =
783 { "", ArgSettingsFilename, (void *) NULL, FALSE };
786 ExitArgError(char *msg, char *badArg, Boolean quit)
791 len = snprintf(buf, MSG_SIZ, msg, badArg);
792 if( (len >= MSG_SIZ) && appData.debugMode )
793 fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
795 if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
796 DisplayFatalError(buf, 0, 2);
804 if(*p == '-' || *p == '+') p++;
805 while(*p) if(!isdigit(*p++)) ExitArgError(_("Bad integer value %s"), s, TRUE);
810 StringGet(void *getClosure)
812 char **p = (char **) getClosure;
817 FileGet(void *getClosure)
820 FILE* f = (FILE*) getClosure;
823 if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely
830 /* Parse settings file named "name". If file found, return the
831 full name in fullname and return TRUE; else return FALSE */
833 ParseSettingsFile(char *name, char **addr)
837 char buf[MSG_SIZ], fullname[MSG_SIZ];
840 ok = MySearchPath(installDir, name, fullname);
841 if(!ok && strchr(name, '.') == NULL)
842 { // append default file-name extension '.ini' when needed
843 len = snprintf(buf,MSG_SIZ, "%s.ini", name);
844 if( (len >= MSG_SIZ) && appData.debugMode )
845 fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
847 ok = MySearchPath(installDir, buf, fullname);
850 f = fopen(fullname, "r");
853 ASSIGN(*addr, fullname);
855 ParseArgs(FileGet, f);
864 ParseArgs(GetFunc get, void *cl)
866 char argName[MAX_ARG_LEN];
867 char argValue[MAX_ARG_LEN];
873 int posarg = 4; // default is game file
878 while (ch == ' ' || ch == '\n' || ch == '\t') ch = get(cl);
879 if (ch == NULLCHAR) break;
881 /* Comment to end of line */
883 while (ch != '\n' && ch != NULLCHAR) ch = get(cl);
885 } else if (ch == '/' || ch == '-') {
888 while (ch != ' ' && ch != '=' && ch != ':' && ch != NULLCHAR &&
889 ch != '\n' && ch != '\t') {
894 for (ad = argDescriptors; ad->argName != NULL; ad++)
895 if (strcmp(ad->argName, argName + 1) == 0) break;
896 if (ad->argName == NULL) {
897 ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
898 while (ch != '\n' && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on
899 continue; // so that when it is in a settings file, it is the only setting that will be purged from it
901 } else if (ch == '@') {
902 /* Indirection file */
903 ad = &argDescriptorIndirection;
906 /* Positional argument */
907 ad = &argDescriptors[posarg++];
909 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
912 if (ad->argType == ArgTwo) { // [HGM] kludgey arg type, not suitable for saving
913 *(Boolean *) ad->argLoc = 2;
916 if (ad->argType == ArgTrue) {
917 *(Boolean *) ad->argLoc = TRUE;
920 if (ad->argType == ArgFalse) {
921 *(Boolean *) ad->argLoc = FALSE;
925 while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
926 if (ch == NULLCHAR || ch == '\n') {
927 ExitArgError(_("No value provided for argument %s"), argName, TRUE);
931 // Quoting with { }. No characters have to (or can) be escaped.
932 // Thus the string cannot contain a '}' character.
952 } else if (ch == '\'' || ch == '"') {
953 // Quoting with ' ' or " ", with \ as escape character.
954 // Inconvenient for long strings that may contain Windows filenames.
980 if (ad->argType == ArgFilename
981 || ad->argType == ArgSettingsFilename) {
987 ExitArgError(_("Incomplete \\ escape in value for %s"), argName, TRUE);
1011 for (i = 0; i < 3; i++) {
1012 if (ch >= '0' && ch <= '7') {
1013 octval = octval*8 + (ch - '0');
1020 *q++ = (char) octval;
1031 while ((ch != ' ' || posflag) && ch != NULLCHAR && ch != '\t' && ch != '\n') { // space allowed in positional arg
1038 if(posflag) { // positional argument: the argName was implied, and per default set as -lgf
1039 int len = strlen(argValue) - 4; // start of filename extension
1040 if(len < 0) len = 0;
1041 if(!strcasecmp(argValue + len, ".trn")) {
1042 ad = &argDescriptors[2]; // correct implied type to -tf
1043 appData.tourney = TRUE; // let it parse -tourneyOptions later
1044 } else if(!strcasecmp(argValue + len, ".fen") || !strcasecmp(argValue + len, ".epd")) {
1045 ad = &argDescriptors[1]; // correct implied type to -lpf
1046 appData.viewer = TRUE;
1047 } else if(!strcasecmp(argValue + len, ".ini") || !strcasecmp(argValue + len, ".xop")) {
1048 ad = &argDescriptors[0]; // correct implied type to -opt
1049 } else if(GetEngineLine(argValue, 11)) {
1050 ad = &argDescriptors[3]; // correct implied type to -is
1051 } else { // keep default -lgf, but let it imply viewer mode as well
1052 appData.viewer = TRUE;
1054 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1057 switch (ad->argType) {
1059 *(int *) ad->argLoc = ValidateInt(argValue);
1063 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute
1067 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...)
1071 *(int *) ad->argLoc = ValidateInt(argValue);
1072 EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);
1076 *(float *) ad->argLoc = (float) atof(argValue);
1081 ASSIGN(*(char **) ad->argLoc, argValue);
1084 case ArgSettingsFilename:
1086 if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
1088 if (ad->argLoc != NULL) {
1090 ExitArgError(_("Failed to open indirection file %s"), argValue, TRUE);
1097 switch (argValue[0]) {
1100 *(Boolean *) ad->argLoc = TRUE;
1104 *(Boolean *) ad->argLoc = FALSE;
1107 ExitArgError(_("Unrecognized boolean argument value %s"), argValue, TRUE);
1113 ParseColor((int)(intptr_t)ad->argLoc, argValue);
1117 ColorClass cc = (ColorClass)ad->argLoc;
1118 ParseTextAttribs(cc, argValue); // [HGM] wrapper for platform independency
1123 ParseBoardSize(ad->argLoc, argValue);
1127 ParseFont(argValue, (int)(intptr_t)ad->argLoc);
1130 case ArgCommSettings:
1131 ParseCommPortSettings(argValue);
1135 ExitArgError(_("Unrecognized argument %s"), argValue, TRUE);
1145 ParseArgsFromString(char *p)
1147 ParseArgs(StringGet, &p);
1151 ParseArgsFromFile(FILE *f)
1153 ParseArgs(FileGet, f);
1157 ParseIcsTextMenu(char *icsTextMenuString)
1160 IcsTextMenuEntry *e = icsTextMenuEntry;
1161 char *p = icsTextMenuString;
1162 while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1165 if (e->command != NULL) {
1171 e = icsTextMenuEntry;
1172 while (*p && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1173 if (*p == ';' || *p == '\n') {
1174 e->item = strdup("-");
1177 } else if (*p == '-') {
1178 e->item = strdup("-");
1183 char *q, *r, *s, *t;
1186 if (q == NULL) break;
1188 r = strchr(q + 1, ',');
1189 if (r == NULL) break;
1191 s = strchr(r + 1, ',');
1192 if (s == NULL) break;
1195 t = strchr(s + 1, c);
1198 t = strchr(s + 1, c);
1200 if (t != NULL) *t = NULLCHAR;
1201 e->item = strdup(p);
1202 e->command = strdup(q + 1);
1203 e->getname = *(r + 1) != '0';
1204 e->immediate = *(s + 1) != '0';
1208 if (t == NULL) break;
1217 SetDefaultTextAttribs()
1220 for (cc = (ColorClass)0; cc < ColorNone; cc++) {
1221 ParseTextAttribs(cc, defaultTextAttribs[cc]);
1226 SetDefaultsFromList()
1227 { // [HGM] ini: take defaults from argDescriptor list
1230 for(i=0; argDescriptors[i].argName != NULL; i++) {
1231 if(argDescriptors[i].defaultValue != INVALID)
1232 switch(argDescriptors[i].argType) {
1237 *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1243 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1247 case ArgSettingsFilename:
1248 if((char *)argDescriptors[i].defaultValue)
1249 *(char **) argDescriptors[i].argLoc = strdup((char *)argDescriptors[i].defaultValue);
1252 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1255 ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue);
1257 case ArgFloat: // floats cannot be casted to int without precision loss
1258 default: ; // some arg types cannot be initialized through table
1264 InitAppData(char *lpCmdLine)
1267 char buf[MAX_ARG_LEN], currDir[MSG_SIZ];
1270 /* Initialize to defaults */
1271 SetDefaultsFromList(); // this sets most defaults
1273 // some parameters for which there are no options!
1274 appData.Iconic = FALSE; /*unused*/
1275 appData.icsEngineAnalyze = FALSE;
1277 // float: casting to int is not harmless, so default cannot be contained in table
1278 appData.timeDelay = TIME_DELAY;
1279 appData.timeIncrement = -314159;
1281 // some complex, platform-dependent stuff that could not be handled from table
1282 SetDefaultTextAttribs();
1284 SetCommPortDefaults();
1286 /* Parse default settings file if any */
1287 ParseSettingsFile(settingsFileName, &settingsFileName);
1289 /* Parse command line */
1290 ParseArgs(StringGet, &lpCmdLine);
1292 if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
1293 if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
1294 chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);
1295 appData.icsActive |= GetEngineLine(icsNick, 10);
1297 /* [HGM] make sure board size is acceptable */
1298 if(appData.NrFiles > BOARD_FILES ||
1299 appData.NrRanks > BOARD_RANKS )
1300 DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);
1302 /* [HGM] After parsing the options from the .ini file, and overruling them
1303 * with options from the command line, we now make an even higher priority
1304 * overrule by WB options attached to the engine command line. This so that
1305 * tournament managers can use WB options (such as /timeOdds) that follow
1308 if(appData.firstChessProgram != NULL) {
1309 char *p = StrStr(appData.firstChessProgram, "WBopt");
1310 static char *f = "first";
1311 char buf[MSG_SIZ], *q = buf;
1315 { // engine command line contains WinBoard options
1316 len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
1317 if( (len >= MSG_SIZ) && appData.debugMode )
1318 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1320 ParseArgs(StringGet, &q);
1321 p[-1] = 0; // cut them offengine command line
1324 // now do same for second chess program
1325 if(appData.secondChessProgram != NULL) {
1326 char *p = StrStr(appData.secondChessProgram, "WBopt");
1327 static char *s = "second";
1328 char buf[MSG_SIZ], *q = buf;
1332 { // engine command line contains WinBoard options
1333 len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
1334 if( (len >= MSG_SIZ) && appData.debugMode )
1335 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1337 ParseArgs(StringGet, &q);
1338 p[-1] = 0; // cut them offengine command line
1342 /* Propagate options that affect others */
1343 if (appData.matchMode || appData.matchGames) chessProgram = TRUE;
1344 if (appData.icsActive || appData.noChessProgram) {
1345 chessProgram = FALSE; /* not local chess program mode */
1347 if(appData.timeIncrement == -314159) { // new storage mechanism of (mps,inc) in use and no -inc on command line
1348 if(appData.movesPerSession <= 0) { // new encoding of incremental mode
1349 appData.timeIncrement = -appData.movesPerSession/1000.;
1350 } else appData.timeIncrement = -1;
1352 if(appData.movesPerSession <= 0) appData.movesPerSession = MOVES_PER_SESSION; // mps <= 0 is invalid in any case
1354 /* Open startup dialog if needed */
1355 if ((!appData.noChessProgram && !chessProgram && !appData.icsActive) ||
1356 (appData.icsActive && *appData.icsHost == NULLCHAR) ||
1357 (chessProgram && (*appData.firstChessProgram == NULLCHAR ||
1358 *appData.secondChessProgram == NULLCHAR)))
1359 PopUpStartupDialog();
1361 /* Make sure save files land in the right (?) directory */
1362 if (MyGetFullPathName(appData.saveGameFile, buf)) {
1363 appData.saveGameFile = strdup(buf);
1365 if (MyGetFullPathName(appData.savePositionFile, buf)) {
1366 appData.savePositionFile = strdup(buf);
1369 /* Finish initialization for fonts and sounds */
1372 GetCurrentDirectory(MSG_SIZ, currDir);
1373 SetCurrentDirectory(installDir);
1375 SetCurrentDirectory(currDir);
1377 p = icsTextMenuString;
1379 FILE* f = fopen(p + 1, "r");
1381 DisplayFatalError(p + 1, errno, 2);
1384 i = fread(buf, 1, sizeof(buf)-1, f);
1389 ParseIcsTextMenu(strdup(p));
1393 SaveSettings(char* name)
1397 char dir[MSG_SIZ], buf[MSG_SIZ];
1398 int mps = appData.movesPerSession;
1400 if (!MainWindowUp()) return;
1402 GetCurrentDirectory(MSG_SIZ, dir);
1403 if(MySearchPath(installDir, name, buf)) {
1404 f = fopen(buf, "w");
1406 SetCurrentDirectory(installDir);
1407 f = fopen(name, "w");
1408 SetCurrentDirectory(dir);
1411 DisplayError(name, errno);
1416 fprintf(f, "; %s Save Settings file\n", PACKAGE_STRING);
1418 fprintf(f, "; You can edit the values of options that are already set in this file,\n");
1419 fprintf(f, "; but if you add other options, the next Save Settings will not save them.\n");
1420 fprintf(f, "; Use a shortcut, an @indirection file, or a .bat file instead.\n");
1425 /* [AS] Move history */
1426 wpMoveHistory.visible = MoveHistoryIsUp();
1428 /* [AS] Eval graph */
1429 wpEvalGraph.visible = EvalGraphIsUp();
1431 /* [AS] Engine output */
1432 wpEngineOutput.visible = EngineOutputIsUp();
1434 // [HGM] in WB we have to copy sound names to appData first
1437 if(appData.timeIncrement >= 0) appData.movesPerSession = -1000*appData.timeIncrement; // kludge to store mps & inc as one
1439 for (ad = argDescriptors; ad->argName != NULL; ad++) {
1440 if (!ad->save) continue;
1441 switch (ad->argType) {
1444 char *p = *(char **)ad->argLoc;
1445 if(p == NULL) break; // just in case
1446 if ((strchr(p, '\\') || strchr(p, '\n')) && !strchr(p, '}')) {
1447 /* Quote multiline values or \-containing values
1448 with { } if possible */
1449 fprintf(f, OPTCHAR "%s" SEPCHAR "{%s}\n", ad->argName, p);
1451 /* Else quote with " " */
1452 fprintf(f, OPTCHAR "%s" SEPCHAR "\"", ad->argName);
1454 if (*p == '\n') fprintf(f, "\n");
1455 else if (*p == '\r') fprintf(f, "\\r");
1456 else if (*p == '\t') fprintf(f, "\\t");
1457 else if (*p == '\b') fprintf(f, "\\b");
1458 else if (*p == '\f') fprintf(f, "\\f");
1459 else if (*p < ' ') fprintf(f, "\\%03o", *p);
1460 else if (*p == '\"') fprintf(f, "\\\"");
1461 else if (*p == '\\') fprintf(f, "\\\\");
1471 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc);
1474 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.x); // [HGM] placement: store relative value
1477 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.y);
1480 fprintf(f, OPTCHAR "%s" SEPCHAR "%g\n", ad->argName, *(float *)ad->argLoc);
1483 fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName,
1484 (*(Boolean *)ad->argLoc) ? "true" : "false");
1487 if (*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1490 if (!*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1496 SaveAttribsArg(f, ad);
1499 if(*(char**)ad->argLoc == NULL) break; // just in case
1500 if (strchr(*(char **)ad->argLoc, '\"')) {
1501 fprintf(f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, *(char **)ad->argLoc);
1503 fprintf(f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, *(char **)ad->argLoc);
1507 SaveBoardSize(f, ad->argName, ad->argLoc);
1512 case ArgCommSettings:
1513 PrintCommPortSettings(f, ad->argName);
1516 case ArgSettingsFilename: ;
1520 appData.movesPerSession = mps;
1524 GetArgValue(char *name)
1525 { // retrieve (as text) current value of string or int argument given by name
1526 // (this is used for maing the values available in the adapter command)
1530 for (ad = argDescriptors; ad->argName != NULL; ad++)
1531 if (strcmp(ad->argName, name) == 0) break;
1533 if (ad->argName == NULL) return FALSE;
1535 switch(ad->argType) {
1538 strncpy(name, *(char**) ad->argLoc, MSG_SIZ);
1542 len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
1543 if( (len >= MSG_SIZ) && appData.debugMode )
1544 fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1548 len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
1549 if( (len >= MSG_SIZ) && appData.debugMode )
1550 fprintf(debugFP, "GetArgValue: buffer truncated.\n");