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, 2013 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;
112 void EnsureOnScreen(int *x, int *y, int minX, int minY);
113 char StringGet(void *getClosure);
114 void ParseFont(char *name, int number);
115 void SetFontDefaults();
117 void ParseColor(int n, char *name);
118 void ParseTextAttribs(ColorClass cc, char *s);
119 void ParseBoardSize(void * addr, char *name);
120 void ParseCommPortSettings(char *name);
121 void LoadAllSounds();
122 void SetCommPortDefaults();
123 void SaveFontArg(FILE *f, ArgDescriptor *ad);
125 void SaveAttribsArg(FILE *f, ArgDescriptor *ad);
126 void SaveColor(FILE *f, ArgDescriptor *ad);
127 void SaveBoardSize(FILE *f, char *name, void *addr);
128 void PrintCommPortSettings(FILE *f, char *name);
129 void GetWindowCoords();
131 void PopUpStartupDialog();
132 typedef char GetFunc(void *getClosure);
133 void ParseArgs(GetFunc get, void *cl);
135 // [HGM] this is an exact duplicate of something in winboard.c. Move to backend.c?
136 char *defaultTextAttribs[] =
138 COLOR_SHOUT, COLOR_SSHOUT, COLOR_CHANNEL1, COLOR_CHANNEL, COLOR_KIBITZ,
139 COLOR_TELL, COLOR_CHALLENGE, COLOR_REQUEST, COLOR_SEEK, COLOR_NORMAL,
143 ArgDescriptor argDescriptors[] = {
144 /* positional arguments */
145 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
146 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
147 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
148 { "is", ArgString, (void *) &icsNick, FALSE, INVALID },
149 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
150 { "", ArgNone, NULL, FALSE, INVALID },
151 /* keyword arguments */
153 { "whitePieceColor", ArgColor, (void *) 0, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
154 { "wpc", ArgColor, (void *) 0, FALSE, INVALID },
155 { "blackPieceColor", ArgColor, (void *) 1, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
156 { "bpc", ArgColor, (void *) 1, FALSE, INVALID },
157 { "lightSquareColor", ArgColor, (void *) 2, TRUE, (ArgIniType) LIGHT_SQUARE_COLOR },
158 { "lsc", ArgColor, (void *) 2, FALSE, INVALID },
159 { "darkSquareColor", ArgColor, (void *) 3, TRUE, (ArgIniType) DARK_SQUARE_COLOR },
160 { "dsc", ArgColor, (void *) 3, FALSE, INVALID },
161 { "highlightSquareColor", ArgColor, (void *) 4, TRUE, (ArgIniType) HIGHLIGHT_SQUARE_COLOR },
162 { "hsc", ArgColor, (void *) 4, FALSE, INVALID },
163 { "premoveHighlightColor", ArgColor, (void *) 5, TRUE, (ArgIniType) PREMOVE_HIGHLIGHT_COLOR },
164 { "phc", ArgColor, (void *) 5, FALSE, INVALID },
165 { "movesPerSession", ArgInt, (void *) &appData.movesPerSession, TRUE, (ArgIniType) MOVES_PER_SESSION },
166 { "mps", ArgInt, (void *) &appData.movesPerSession, FALSE, INVALID },
167 { "initString", ArgString, (void *) &appData.firstInitString, FALSE, INVALID },
168 { "firstInitString", ArgString, (void *) &appData.firstInitString, FALSE, (ArgIniType) INIT_STRING },
169 { "secondInitString", ArgString, (void *) &appData.secondInitString, FALSE, (ArgIniType) INIT_STRING },
170 { "firstComputerString", ArgString, (void *) &appData.firstComputerString,
171 FALSE, (ArgIniType) COMPUTER_STRING },
172 { "secondComputerString", ArgString, (void *) &appData.secondComputerString,
173 FALSE, (ArgIniType) COMPUTER_STRING },
174 { "firstChessProgram", ArgFilename, (void *) &appData.firstChessProgram,
175 FALSE, (ArgIniType) FIRST_CHESS_PROGRAM },
176 { "fcp", ArgFilename, (void *) &appData.firstChessProgram, FALSE, INVALID },
177 { "secondChessProgram", ArgFilename, (void *) &appData.secondChessProgram,
178 FALSE, (ArgIniType) SECOND_CHESS_PROGRAM },
179 { "scp", ArgFilename, (void *) &appData.secondChessProgram, FALSE, INVALID },
180 { "fe", ArgString, (void *) &firstEngineLine, FALSE, "" },
181 { "se", ArgString, (void *) &secondEngineLine, FALSE, "" },
182 { "firstPlaysBlack", ArgBoolean, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
183 { "fb", ArgTrue, (void *) &appData.firstPlaysBlack, FALSE, FALSE },
184 { "xfb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
185 { "-fb", ArgFalse, (void *) &appData.firstPlaysBlack, FALSE, INVALID },
186 { "noChessProgram", ArgBoolean, (void *) &appData.noChessProgram, FALSE, FALSE },
187 { "ncp", ArgTrue, (void *) &appData.noChessProgram, FALSE, INVALID },
188 { "xncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
189 { "-ncp", ArgFalse, (void *) &appData.noChessProgram, FALSE, INVALID },
190 { "firstHost", ArgString, (void *) &appData.firstHost, FALSE, (ArgIniType) FIRST_HOST },
191 { "fh", ArgString, (void *) &appData.firstHost, FALSE, INVALID },
192 { "secondHost", ArgString, (void *) &appData.secondHost, FALSE, (ArgIniType) SECOND_HOST },
193 { "sh", ArgString, (void *) &appData.secondHost, FALSE, INVALID },
194 { "firstDirectory", ArgFilename, (void *) &appData.firstDirectory, FALSE, (ArgIniType) FIRST_DIRECTORY },
195 { "fd", ArgFilename, (void *) &appData.firstDirectory, FALSE, INVALID },
196 { "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY },
197 { "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID },
198 { "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE },
199 { "theme", ArgString, (void *) &theme, FALSE, (ArgIniType) "" },
201 /* some options only used by the XBoard front end, and ignored in WinBoard */
202 /* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */
203 { "internetChessServerInputBox", ArgBoolean, (void *) &appData.icsInputBox, XBOARD, (ArgIniType) FALSE },
204 { "icsinput", ArgTrue, (void *) &appData.icsInputBox, FALSE, INVALID },
205 { "xicsinput", ArgFalse, (void *) &appData.icsInputBox, FALSE, INVALID },
206 { "cmail", ArgString, (void *) &appData.cmailGameName, FALSE, (ArgIniType) "" },
207 { "soundProgram", ArgFilename, (void *) &appData.soundProgram, XBOARD, (ArgIniType) "play" },
208 { "fontSizeTolerance", ArgInt, (void *) &appData.fontSizeTolerance, XBOARD, (ArgIniType) 4 },
209 { "lowTimeWarningColor", ArgColor, (void *) 6, XBOARD, (ArgIniType) LOWTIMEWARNING_COLOR },
210 { "lowTimeWarning", ArgBoolean, (void *) &appData.lowTimeWarning, XBOARD, (ArgIniType) FALSE },
211 { "titleInWindow", ArgBoolean, (void *) &appData.titleInWindow, XBOARD, (ArgIniType) FALSE },
212 { "title", ArgTrue, (void *) &appData.titleInWindow, FALSE, INVALID },
213 { "xtitle", ArgFalse, (void *) &appData.titleInWindow, FALSE, INVALID },
214 { "flashCount", ArgInt, (void *) &appData.flashCount, XBOARD, INVALID }, // let X handle this
215 { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE },
216 { "pieceImageDirectory", ArgFilename, (void *) &appData.pieceDirectory, TRUE, (ArgIniType) "" },
217 { "pid", ArgFilename, (void *) &appData.pieceDirectory, FALSE, INVALID },
218 { "trueColors", ArgBoolean, (void *) &appData.trueColors, TRUE, (ArgIniType) FALSE },
219 { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" },
220 { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY },
221 { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE },
223 { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE },
224 { "pieceMenu", ArgBoolean, (void *) &appData.pieceMenu, TRUE, (ArgIniType) TRUE },
225 { "sweepPromotions", ArgBoolean, (void *) &appData.sweepSelect, TRUE, (ArgIniType) FALSE },
226 { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL },
227 { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID },
228 { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, (ArgIniType) "" },
229 { "ruser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID },
230 { "timeDelay", ArgFloat, (void *) &appData.timeDelay, TRUE, INVALID },
231 { "td", ArgFloat, (void *) &appData.timeDelay, FALSE, INVALID },
232 { "timeControl", ArgString, (void *) &appData.timeControl, TRUE, (ArgIniType) TIME_CONTROL },
233 { "tc", ArgString, (void *) &appData.timeControl, FALSE, INVALID },
234 { "timeIncrement", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
235 { "inc", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID },
236 { "internetChessServerMode", ArgBoolean, (void *) &appData.icsActive, FALSE, INVALID },
237 { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE },
238 { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
239 { "-ics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID },
240 { "is", ArgString, (void *) &icsNick, FALSE, "" },
241 { "internetChessServerHost", ArgString, (void *) &appData.icsHost, FALSE, (ArgIniType) "" },
242 { "icshost", ArgString, (void *) &appData.icsHost, FALSE, INVALID },
243 { "internetChessServerPort", ArgString, (void *) &appData.icsPort, FALSE, (ArgIniType) ICS_PORT },
244 { "icsport", ArgString, (void *) &appData.icsPort, FALSE, INVALID },
245 { "internetChessServerCommPort", ArgString, (void *) &appData.icsCommPort, FALSE, (ArgIniType) ICS_COMM_PORT },
246 { "icscomm", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
247 { "internetChessServerComPort", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
248 { "icscom", ArgString, (void *) &appData.icsCommPort, FALSE, INVALID },
249 { "internetChessServerLogonScript", ArgFilename, (void *) &appData.icsLogon, FALSE, (ArgIniType) ICS_LOGON },
250 { "icslogon", ArgFilename, (void *) &appData.icsLogon, FALSE, INVALID },
251 { "useTelnet", ArgBoolean, (void *) &appData.useTelnet, FALSE, INVALID },
252 { "telnet", ArgTrue, (void *) &appData.useTelnet, FALSE, INVALID },
253 { "xtelnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
254 { "-telnet", ArgFalse, (void *) &appData.useTelnet, FALSE, INVALID },
255 { "telnetProgram", ArgFilename, (void *) &appData.telnetProgram, FALSE, (ArgIniType) TELNET_PROGRAM },
256 { "internetChessserverHelper", ArgFilename, (void *) &appData.icsHelper,
257 FALSE, INVALID }, // for XB
258 { "icshelper", ArgFilename, (void *) &appData.icsHelper, FALSE, (ArgIniType) "" },
259 { "seekGraph", ArgBoolean, (void *) &appData.seekGraph, TRUE, (ArgIniType) FALSE },
260 { "sg", ArgTrue, (void *) &appData.seekGraph, FALSE, INVALID },
261 { "autoRefresh", ArgBoolean, (void *) &appData.autoRefresh, TRUE, (ArgIniType) FALSE },
262 { "gateway", ArgString, (void *) &appData.gateway, FALSE, (ArgIniType) "" },
263 { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, (ArgIniType) "" },
264 { "lgf", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID },
265 { "loadGameIndex", ArgInt, (void *) &appData.loadGameIndex, FALSE, (ArgIniType) 0 },
266 { "lgi", ArgInt, (void *) &appData.loadGameIndex, FALSE, INVALID },
267 { "saveGameFile", ArgFilename, (void *) &appData.saveGameFile, TRUE, (ArgIniType) "" },
268 { "sgf", ArgFilename, (void *) &appData.saveGameFile, FALSE, INVALID },
269 { "autoSaveGames", ArgBoolean, (void *) &appData.autoSaveGames, TRUE, (ArgIniType) FALSE },
270 { "autosave", ArgTrue, (void *) &appData.autoSaveGames, FALSE, INVALID },
271 { "xautosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
272 { "-autosave", ArgFalse, (void *) &appData.autoSaveGames, FALSE, INVALID },
273 { "loadPositionFile", ArgFilename, (void *) &appData.loadPositionFile, FALSE, (ArgIniType) "" },
274 { "lpf", ArgFilename, (void *) &appData.loadPositionFile, FALSE, INVALID },
275 { "loadPositionIndex", ArgInt, (void *) &appData.loadPositionIndex, FALSE, (ArgIniType) 1 },
276 { "lpi", ArgInt, (void *) &appData.loadPositionIndex, FALSE, INVALID },
277 { "savePositionFile", ArgFilename, (void *) &appData.savePositionFile, FALSE, (ArgIniType) "" },
278 { "spf", ArgFilename, (void *) &appData.savePositionFile, FALSE, INVALID },
279 { "matchMode", ArgBoolean, (void *) &appData.matchMode, FALSE, (ArgIniType) FALSE },
280 { "mm", ArgTrue, (void *) &appData.matchMode, FALSE, INVALID },
281 { "xmm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
282 { "-mm", ArgFalse, (void *) &appData.matchMode, FALSE, INVALID },
283 { "matchGames", ArgInt, (void *) &appData.matchGames, FALSE, (ArgIniType) 0 },
284 { "mg", ArgInt, (void *) &appData.matchGames, FALSE, INVALID },
285 { "monoMode", ArgBoolean, (void *) &appData.monoMode, TRUE, (ArgIniType) FALSE },
286 { "mono", ArgTrue, (void *) &appData.monoMode, FALSE, INVALID },
287 { "xmono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
288 { "-mono", ArgFalse, (void *) &appData.monoMode, FALSE, INVALID },
289 { "debugMode", ArgBoolean, (void *) &appData.debugMode, FALSE, (ArgIniType) FALSE },
290 { "debug", ArgTrue, (void *) &appData.debugMode, FALSE, INVALID },
291 { "xdebug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
292 { "-debug", ArgFalse, (void *) &appData.debugMode, FALSE, INVALID },
293 { "clockMode", ArgBoolean, (void *) &appData.clockMode, FALSE, (ArgIniType) TRUE },
294 { "clock", ArgTrue, (void *) &appData.clockMode, FALSE, INVALID },
295 { "xclock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
296 { "-clock", ArgFalse, (void *) &appData.clockMode, FALSE, INVALID },
297 { "searchTime", ArgString, (void *) &appData.searchTime, FALSE, (ArgIniType) "" },
298 { "st", ArgString, (void *) &appData.searchTime, FALSE, INVALID },
299 { "searchDepth", ArgInt, (void *) &appData.searchDepth, FALSE, (ArgIniType) 0 },
300 { "depth", ArgInt, (void *) &appData.searchDepth, FALSE, INVALID },
301 { "showCoords", ArgBoolean, (void *) &appData.showCoords, TRUE, (ArgIniType) FALSE },
302 { "coords", ArgTrue, (void *) &appData.showCoords, FALSE, INVALID },
303 { "xcoords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
304 { "-coords", ArgFalse, (void *) &appData.showCoords, FALSE, INVALID },
305 { "showThinking", ArgBoolean, (void *) &appData.showThinking, TRUE, (ArgIniType) FALSE },
306 { "thinking", ArgTrue, (void *) &appData.showThinking, FALSE, INVALID },
307 { "xthinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
308 { "-thinking", ArgFalse, (void *) &appData.showThinking, FALSE, INVALID },
309 { "ponderNextMove", ArgBoolean, (void *) &appData.ponderNextMove, TRUE, (ArgIniType) TRUE },
310 { "ponder", ArgTrue, (void *) &appData.ponderNextMove, FALSE, INVALID },
311 { "xponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
312 { "-ponder", ArgFalse, (void *) &appData.ponderNextMove, FALSE, INVALID },
313 { "periodicUpdates", ArgBoolean, (void *) &appData.periodicUpdates, TRUE, (ArgIniType) TRUE },
314 { "periodic", ArgTrue, (void *) &appData.periodicUpdates, FALSE, INVALID },
315 { "xperiodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
316 { "-periodic", ArgFalse, (void *) &appData.periodicUpdates, FALSE, INVALID },
317 { "popupExitMessage", ArgBoolean, (void *) &appData.popupExitMessage, TRUE, (ArgIniType) TRUE },
318 { "exit", ArgTrue, (void *) &appData.popupExitMessage, FALSE, INVALID },
319 { "xexit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
320 { "-exit", ArgFalse, (void *) &appData.popupExitMessage, FALSE, INVALID },
321 { "popupMoveErrors", ArgBoolean, (void *) &appData.popupMoveErrors, TRUE, (ArgIniType) FALSE },
322 { "popup", ArgTrue, (void *) &appData.popupMoveErrors, FALSE, INVALID },
323 { "xpopup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
324 { "-popup", ArgFalse, (void *) &appData.popupMoveErrors, FALSE, INVALID },
325 { "popUpErrors", ArgBoolean, (void *) &appData.popupMoveErrors,
326 FALSE, INVALID }, /* only so that old WinBoard.ini files from betas can be read */
327 { "clockFont", ArgFont, (void *) CLOCK_FONT, TRUE, INVALID },
328 { "messageFont", ArgFont, (void *) MESSAGE_FONT, TRUE, INVALID },
329 { "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. */
330 { "coordFont", ArgFont, (void *) COORD_FONT, TRUE, INVALID },
331 { "tagsFont", ArgFont, (void *) EDITTAGS_FONT, TRUE, INVALID },
332 { "commentFont", ArgFont, (void *) COMMENT_FONT, TRUE, INVALID },
333 { "icsFont", ArgFont, (void *) CONSOLE_FONT, TRUE, INVALID },
334 { "moveHistoryFont", ArgFont, (void *) MOVEHISTORY_FONT, TRUE, INVALID }, /* [AS] */
335 { "gameListFont", ArgFont, (void *) GAMELIST_FONT, TRUE, INVALID }, /* [HGM] */
336 { "boardSize", ArgBoardSize, (void *) &boardSize,
337 TRUE, (ArgIniType) -1 }, /* must come after all fonts */
338 { "size", ArgBoardSize, (void *) &boardSize, FALSE, INVALID },
339 { "ringBellAfterMoves", ArgBoolean, (void *) &appData.ringBellAfterMoves,
340 FALSE, (ArgIniType) TRUE }, /* historical; kept only so old winboard.ini files will parse */
341 { "bell", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
342 { "xbell", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
343 { "movesound", ArgTrue, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
344 { "xmovesound", ArgFalse, (void *) &appData.ringBellAfterMoves, FALSE, INVALID }, // for XB
345 { "alwaysOnTop", ArgBoolean, (void *) &alwaysOnTop, TRUE, INVALID },
346 { "top", ArgTrue, (void *) &alwaysOnTop, FALSE, INVALID },
347 { "xtop", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
348 { "-top", ArgFalse, (void *) &alwaysOnTop, FALSE, INVALID },
349 { "autoCallFlag", ArgBoolean, (void *) &appData.autoCallFlag, TRUE, (ArgIniType) FALSE },
350 { "autoflag", ArgTrue, (void *) &appData.autoCallFlag, FALSE, INVALID },
351 { "xautoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
352 { "-autoflag", ArgFalse, (void *) &appData.autoCallFlag, FALSE, INVALID },
353 { "autoComment", ArgBoolean, (void *) &appData.autoComment, TRUE, (ArgIniType) FALSE },
354 { "autocomm", ArgTrue, (void *) &appData.autoComment, FALSE, INVALID },
355 { "xautocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
356 { "-autocomm", ArgFalse, (void *) &appData.autoComment, FALSE, INVALID },
357 { "autoCreateLogon", ArgBoolean, (void *) &appData.autoCreateLogon, TRUE, (ArgIniType) FALSE },
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 { "themeNames", ArgString, (void *) &appData.themeNames, !XBOARD, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" },
505 { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
506 { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
507 { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
508 { "firstProtocolVersion", ArgInt, (void *) &appData.firstProtocolVersion, FALSE, (ArgIniType) PROTOVER },
509 { "secondProtocolVersion", ArgInt, (void *) &appData.secondProtocolVersion,FALSE, (ArgIniType) PROTOVER },
510 { "showButtonBar", ArgBoolean, (void *) &appData.showButtonBar, TRUE, (ArgIniType) TRUE },
511 { "buttons", ArgTrue, (void *) &appData.showButtonBar, FALSE, INVALID },
512 { "xbuttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
513 { "-buttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
515 /* [AS] New features */
516 { "firstScoreAbs", ArgBoolean, (void *) &appData.firstScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
517 { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
518 { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
519 { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
520 { "liteBackTextureFile", ArgFilename, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
521 { "lbtf", ArgFilename, (void *) &appData.liteBackTextureFile, FALSE, INVALID },
522 { "darkBackTextureFile", ArgFilename, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
523 { "dbtf", ArgFilename, (void *) &appData.darkBackTextureFile, FALSE, INVALID },
524 { "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
525 { "lbtm", ArgInt, (void *) &appData.liteBackTextureMode, FALSE, INVALID },
526 { "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
527 { "dbtm", ArgInt, (void *) &appData.darkBackTextureMode, FALSE, INVALID },
528 { "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
529 { "pf", ArgString, (void *) &appData.renderPiecesWithFont, FALSE, INVALID },
530 { "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
531 { "fptc", ArgString, (void *) &appData.fontToPieceTable, FALSE, INVALID },
532 { "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
533 { "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
534 { "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
535 { "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
536 { "fpfcw", ArgColor, (void *) 9, FALSE, INVALID },
537 { "fpbcb", ArgColor, (void *) 10, FALSE, INVALID },
538 { "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
539 { "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
540 { "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
541 { "delayBeforeQuit", ArgInt, (void *) &appData.delayBeforeQuit, TRUE, (ArgIniType) 0 },
542 { "delayAfterQuit", ArgInt, (void *) &appData.delayAfterQuit, TRUE, (ArgIniType) 0 },
543 { "nameOfDebugFile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, (ArgIniType) DEBUG_FILE },
544 { "debugfile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, INVALID },
545 { "pgnEventHeader", ArgString, (void *) &appData.pgnEventHeader, TRUE, (ArgIniType) "Computer Chess Game" },
546 { "defaultFrcPosition", ArgInt, (void *) &appData.defaultFrcPosition, TRUE, (ArgIniType) -1 },
547 { "shuffleOpenings", ArgTrue, (void *) &shuffleOpenings, FALSE, INVALID },
548 { "gameListTags", ArgString, (void *) &appData.gameListTags, TRUE, (ArgIniType) GLT_DEFAULT_TAGS },
549 { "saveOutOfBookInfo", ArgBoolean, (void *) &appData.saveOutOfBookInfo, TRUE, (ArgIniType) TRUE },
550 { "showEvalInMoveHistory", ArgBoolean, (void *) &appData.showEvalInMoveHistory, TRUE, (ArgIniType) TRUE },
551 { "evalHistColorWhite", ArgColor, (void *) 12, TRUE, (ArgIniType) "#FFFFB0" },
552 { "evalHistColorBlack", ArgColor, (void *) 13, TRUE, (ArgIniType) "#AD5D3D" },
553 { "highlightMoveWithArrow", ArgBoolean, (void *) &appData.highlightMoveWithArrow, TRUE, (ArgIniType) FALSE },
554 { "highlightArrowColor", ArgColor, (void *) 14, TRUE, (ArgIniType) "#FFFF80" },
555 { "stickyWindows", ArgBoolean, (void *) &appData.useStickyWindows, TRUE, (ArgIniType) TRUE },
556 { "adjudicateDrawMoves", ArgInt, (void *) &appData.adjudicateDrawMoves, TRUE, (ArgIniType) 0 },
557 { "autoDisplayComment", ArgBoolean, (void *) &appData.autoDisplayComment, TRUE, (ArgIniType) TRUE },
558 { "autoDisplayTags", ArgBoolean, (void *) &appData.autoDisplayTags, TRUE, (ArgIniType) TRUE },
559 { "firstIsUCI", ArgBoolean, (void *) &appData.firstIsUCI, FALSE, (ArgIniType) FALSE },
560 { "fUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
561 { "firstUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
562 { "secondIsUCI", ArgBoolean, (void *) &appData.secondIsUCI, FALSE, (ArgIniType) FALSE },
563 { "secondUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
564 { "sUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
565 { "fUCCI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
566 { "sUCCI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
567 { "fUSI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
568 { "sUSI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
569 { "firstHasOwnBookUCI", ArgBoolean, (void *) &appData.firstHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
570 { "fNoOwnBookUCI", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
571 { "firstXBook", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
572 { "secondHasOwnBookUCI", ArgBoolean, (void *) &appData.secondHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
573 { "sNoOwnBookUCI", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
574 { "secondXBook", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
575 { "adapterCommand", ArgFilename, (void *) &appData.adapterCommand, TRUE, (ArgIniType) "polyglot -noini -ec \"%fcp\" -ed \"%fd\"" },
576 { "uxiAdapter", ArgFilename, (void *) &appData.ucciAdapter, TRUE, (ArgIniType) "" },
577 { "polyglotDir", ArgFilename, (void *) &appData.polyglotDir, TRUE, (ArgIniType) "" },
578 { "usePolyglotBook", ArgBoolean, (void *) &appData.usePolyglotBook, TRUE, (ArgIniType) FALSE },
579 { "polyglotBook", ArgFilename, (void *) &appData.polyglotBook, TRUE, (ArgIniType) "" },
580 { "bookDepth", ArgInt, (void *) &appData.bookDepth, TRUE, (ArgIniType) 12 },
581 { "bookVariation", ArgInt, (void *) &appData.bookStrength, TRUE, (ArgIniType) 50 },
582 { "discourageOwnBooks", ArgBoolean, (void *) &appData.defNoBook, TRUE, (ArgIniType) FALSE },
583 { "mcBookMode", ArgTrue, (void *) &mcMode, FALSE, (ArgIniType) FALSE },
584 { "defaultHashSize", ArgInt, (void *) &appData.defaultHashSize, TRUE, (ArgIniType) 64 },
585 { "defaultCacheSizeEGTB", ArgInt, (void *) &appData.defaultCacheSizeEGTB, TRUE, (ArgIniType) 4 },
586 { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
587 { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
588 { "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
589 { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
590 { "upf", ArgBoolean, (void *) &appData.useFont, FALSE, INVALID },
591 { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
592 { "ubt", ArgBoolean, (void *) &appData.useBitmaps, FALSE, INVALID },
593 { "useBorder", ArgBoolean, (void *) &appData.useBorder, TRUE, (ArgIniType) FALSE },
594 { "ub", ArgBoolean, (void *) &appData.useBorder, FALSE, INVALID },
595 { "border", ArgFilename, (void *) &appData.border, TRUE, (ArgIniType) "" },
597 // [HGM] tournament options
598 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
599 { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
600 { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" },
601 { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 },
602 { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID },
603 { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 },
604 { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID },
605 { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" },
606 { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE },
607 { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE },
608 { "seedBase", ArgInt, (void *) &appData.seedBase, FALSE, (ArgIniType) 1 },
609 { "pgnNumberTag", ArgBoolean, (void *) &appData.numberTag, TRUE, (ArgIniType) FALSE },
610 { "afterGame", ArgString, (void *) &appData.afterGame, FALSE, INVALID },
611 { "afterTourney", ArgString, (void *) &appData.afterTourney, FALSE, INVALID },
613 /* [HGM] board-size, adjudication and misc. options */
614 { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE },
615 { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 },
616 { "boardHeight", ArgInt, (void *) &appData.NrRanks, FALSE, (ArgIniType) -1 },
617 { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, FALSE, (ArgIniType) -1 },
618 { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 },
619 { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 },
620 { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID },
621 { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID },
622 { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID },
623 { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE },
624 { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE },
625 { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE },
626 { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE },
627 { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE },
628 { "testClaims", ArgBoolean, (void *) &appData.testClaims, TRUE, (ArgIniType) FALSE },
629 { "checkMates", ArgBoolean, (void *) &appData.checkMates, TRUE, (ArgIniType) FALSE },
630 { "materialDraws", ArgBoolean, (void *) &appData.materialDraws, TRUE, (ArgIniType) FALSE },
631 { "trivialDraws", ArgBoolean, (void *) &appData.trivialDraws, TRUE, (ArgIniType) FALSE },
632 { "ruleMoves", ArgInt, (void *) &appData.ruleMoves, TRUE, (ArgIniType) 51 },
633 { "repeatsToDraw", ArgInt, (void *) &appData.drawRepeats, TRUE, (ArgIniType) 6 },
634 { "backgroundObserve", ArgBoolean, (void *) &appData.bgObserve, TRUE, (ArgIniType) FALSE },
635 { "dualBoard", ArgBoolean, (void *) &appData.dualBoard, TRUE, (ArgIniType) FALSE },
636 { "autoKibitz", ArgTrue, (void *) &appData.autoKibitz, FALSE, INVALID },
637 { "engineDebugOutput", ArgInt, (void *) &appData.engineComments, FALSE, (ArgIniType) 1 },
638 { "userName", ArgString, (void *) &appData.userName, FALSE, INVALID },
639 { "rewindIndex", ArgInt, (void *) &appData.rewindIndex, FALSE, INVALID },
640 { "sameColorGames", ArgInt, (void *) &appData.sameColorGames, FALSE, INVALID },
641 { "smpCores", ArgInt, (void *) &appData.smpCores, TRUE, (ArgIniType) 1 },
642 { "egtFormats", ArgString, (void *) &appData.egtFormats, TRUE, (ArgIniType) "" },
643 { "niceEngines", ArgInt, (void *) &appData.niceEngines, TRUE, INVALID },
644 { "logoSize", ArgInt, (void *) &appData.logoSize, XBOARD, INVALID },
645 { "logoDir", ArgFilename, (void *) &appData.logoDir, XBOARD, (ArgIniType) "." },
646 { "firstLogo", ArgFilename, (void *) &appData.firstLogo, FALSE, (ArgIniType) "" },
647 { "secondLogo", ArgFilename, (void *) &appData.secondLogo, FALSE, (ArgIniType) "" },
648 { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID },
649 { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" },
650 { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" },
651 { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" },
652 { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" },
653 { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" },
654 { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL },
655 { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL },
656 { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
657 { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
658 { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
659 { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, (ArgIniType) FALSE },
660 { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" },
661 { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID },
662 { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
663 { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
664 { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
665 { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
666 { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 },
667 { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 },
668 { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
669 { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
670 { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
671 { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
672 { "eloThresholdAny", ArgInt, (void *) &appData.eloThreshold1, FALSE, (ArgIniType) 0 },
673 { "eloThresholdBoth", ArgInt, (void *) &appData.eloThreshold2, FALSE, (ArgIniType) 0 },
674 { "dateThreshold", ArgInt, (void *) &appData.dateThreshold, FALSE, (ArgIniType) 0 },
675 { "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
676 { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
677 { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
678 { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
679 { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE },
680 { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" },
681 { "tourneyOptions", ArgString, (void *) &appData.tourneyOptions, TRUE, (ArgIniType) "-ncp -mm -saveSettingsOnExit false" },
682 { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE },
683 { "topLevel", ArgBoolean, (void *) &appData.topLevel, XBOARD, (ArgIniType) TOPLEVEL },
684 { "dialogColor", ArgString, (void *) &appData.dialogColor, XBOARD, (ArgIniType) "" },
685 { "buttonColor", ArgString, (void *) &appData.buttonColor, XBOARD, (ArgIniType) "" },
688 { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
689 { "zt", ArgTrue, (void *) &appData.zippyTalk, FALSE, INVALID },
690 { "xzt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
691 { "-zt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
692 { "zippyPlay", ArgBoolean, (void *) &appData.zippyPlay, FALSE, (ArgIniType) ZIPPY_PLAY },
693 { "zp", ArgTrue, (void *) &appData.zippyPlay, FALSE, INVALID },
694 { "xzp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
695 { "-zp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
696 { "zippyLines", ArgFilename, (void *) &appData.zippyLines, FALSE, (ArgIniType) ZIPPY_LINES },
697 { "zippyPinhead", ArgString, (void *) &appData.zippyPinhead, FALSE, (ArgIniType) ZIPPY_PINHEAD },
698 { "zippyPassword", ArgString, (void *) &appData.zippyPassword, FALSE, (ArgIniType) ZIPPY_PASSWORD },
699 { "zippyPassword2", ArgString, (void *) &appData.zippyPassword2, FALSE, (ArgIniType) ZIPPY_PASSWORD2 },
700 { "zippyWrongPassword", ArgString, (void *) &appData.zippyWrongPassword,
701 FALSE, (ArgIniType) ZIPPY_WRONG_PASSWORD },
702 { "zippyAcceptOnly", ArgString, (void *) &appData.zippyAcceptOnly, FALSE, (ArgIniType) ZIPPY_ACCEPT_ONLY },
703 { "zippyUseI", ArgBoolean, (void *) &appData.zippyUseI, FALSE, (ArgIniType) ZIPPY_USE_I },
704 { "zui", ArgTrue, (void *) &appData.zippyUseI, FALSE, INVALID },
705 { "xzui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
706 { "-zui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
707 { "zippyBughouse", ArgInt, (void *) &appData.zippyBughouse, FALSE, (ArgIniType) ZIPPY_BUGHOUSE },
708 { "zippyNoplayCrafty", ArgBoolean, (void *) &appData.zippyNoplayCrafty,
709 FALSE, (ArgIniType) ZIPPY_NOPLAY_CRAFTY },
710 { "znc", ArgTrue, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
711 { "xznc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
712 { "-znc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
713 { "zippyGameEnd", ArgString, (void *) &appData.zippyGameEnd, FALSE, (ArgIniType) ZIPPY_GAME_END },
714 { "zippyGameStart", ArgString, (void *) &appData.zippyGameStart, FALSE, (ArgIniType) ZIPPY_GAME_START },
715 { "zippyAdjourn", ArgBoolean, (void *) &appData.zippyAdjourn, FALSE, (ArgIniType) ZIPPY_ADJOURN },
716 { "zadj", ArgTrue, (void *) &appData.zippyAdjourn, FALSE, INVALID },
717 { "xzadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
718 { "-zadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
719 { "zippyAbort", ArgBoolean, (void *) &appData.zippyAbort, FALSE, (ArgIniType) ZIPPY_ABORT },
720 { "zab", ArgTrue, (void *) &appData.zippyAbort, FALSE, INVALID },
721 { "xzab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
722 { "-zab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
723 { "zippyVariants", ArgString, (void *) &appData.zippyVariants, FALSE, (ArgIniType) ZIPPY_VARIANTS },
724 { "zippyMaxGames", ArgInt, (void *)&appData.zippyMaxGames, FALSE, (ArgIniType) ZIPPY_MAX_GAMES},
725 { "zippyReplayTimeout", ArgInt, (void *)&appData.zippyReplayTimeout, FALSE, (ArgIniType) ZIPPY_REPLAY_TIMEOUT },
726 { "zippyShortGame", ArgInt, (void *)&appData.zippyShortGame, FALSE, INVALID },
727 /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */
728 { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
730 /* [HGM] options for broadcasting and time odds */
731 { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
732 { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
733 { "serverFile", ArgString, (void *) &appData.serverFileName, FALSE, (ArgIniType) NULL },
734 { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
735 { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
736 { "firstTimeOdds", ArgInt, (void *) &appData.firstTimeOdds, FALSE, (ArgIniType) 1 },
737 { "secondTimeOdds", ArgInt, (void *) &appData.secondTimeOdds, FALSE, (ArgIniType) 1 },
738 { "timeOddsMode", ArgInt, (void *) &appData.timeOddsMode, TRUE, INVALID },
739 { "firstAccumulateTC", ArgInt, (void *) &appData.firstAccumulateTC, FALSE, (ArgIniType) 1 },
740 { "secondAccumulateTC", ArgInt, (void *) &appData.secondAccumulateTC, FALSE, (ArgIniType) 1 },
741 { "firstNPS", ArgInt, (void *) &appData.firstNPS, FALSE, (ArgIniType) -1 },
742 { "secondNPS", ArgInt, (void *) &appData.secondNPS, FALSE, (ArgIniType) -1 },
743 { "noGUI", ArgTrue, (void *) &appData.noGUI, FALSE, INVALID },
744 { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID },
745 { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID },
746 { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */
747 { "openCommand", ArgString, (void *) &appData.sysOpen, FALSE, "xdg-open" },
749 // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others
750 { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed
751 { "minY", ArgZ, (void *) &minY, FALSE, INVALID },
752 { "winWidth", ArgInt, (void *) &wpMain.width, TRUE, INVALID }, // [HGM] placement: dummies to remember right & bottom
753 { "winHeight", ArgInt, (void *) &wpMain.height, TRUE, INVALID }, // for attaching auxiliary windows to them
754 { "x", ArgInt, (void *) &wpMain.x, TRUE, (ArgIniType) CW_USEDEFAULT },
755 { "y", ArgInt, (void *) &wpMain.y, TRUE, (ArgIniType) CW_USEDEFAULT },
756 { "icsX", ArgX, (void *) &wpConsole.x, TRUE, (ArgIniType) CW_USEDEFAULT },
757 { "icsY", ArgY, (void *) &wpConsole.y, TRUE, (ArgIniType) CW_USEDEFAULT },
758 { "icsW", ArgInt, (void *) &wpConsole.width, TRUE, (ArgIniType) CW_USEDEFAULT },
759 { "icsH", ArgInt, (void *) &wpConsole.height, TRUE, (ArgIniType) CW_USEDEFAULT },
760 { "commentX", ArgX, (void *) &wpComment.x, TRUE, (ArgIniType) CW_USEDEFAULT },
761 { "commentY", ArgY, (void *) &wpComment.y, TRUE, (ArgIniType) CW_USEDEFAULT },
762 { "commentW", ArgInt, (void *) &wpComment.width, TRUE, (ArgIniType) CW_USEDEFAULT },
763 { "commentH", ArgInt, (void *) &wpComment.height, TRUE, (ArgIniType) CW_USEDEFAULT },
764 { "tagsX", ArgX, (void *) &wpTags.x, TRUE, (ArgIniType) CW_USEDEFAULT },
765 { "tagsY", ArgY, (void *) &wpTags.y, TRUE, (ArgIniType) CW_USEDEFAULT },
766 { "tagsW", ArgInt, (void *) &wpTags.width, TRUE, (ArgIniType) CW_USEDEFAULT },
767 { "tagsH", ArgInt, (void *) &wpTags.height, TRUE, (ArgIniType) CW_USEDEFAULT },
768 { "gameListX", ArgX, (void *) &wpGameList.x, TRUE, (ArgIniType) CW_USEDEFAULT },
769 { "gameListY", ArgY, (void *) &wpGameList.y, TRUE, (ArgIniType) CW_USEDEFAULT },
770 { "gameListW", ArgInt, (void *) &wpGameList.width, TRUE, (ArgIniType) CW_USEDEFAULT },
771 { "gameListH", ArgInt, (void *) &wpGameList.height, TRUE, (ArgIniType) CW_USEDEFAULT },
772 /* [AS] Layout stuff */
773 { "moveHistoryUp", ArgBoolean, (void *) &wpMoveHistory.visible, TRUE, (ArgIniType) TRUE },
774 { "moveHistoryX", ArgX, (void *) &wpMoveHistory.x, TRUE, (ArgIniType) CW_USEDEFAULT },
775 { "moveHistoryY", ArgY, (void *) &wpMoveHistory.y, TRUE, (ArgIniType) CW_USEDEFAULT },
776 { "moveHistoryW", ArgInt, (void *) &wpMoveHistory.width, TRUE, (ArgIniType) CW_USEDEFAULT },
777 { "moveHistoryH", ArgInt, (void *) &wpMoveHistory.height, TRUE, (ArgIniType) CW_USEDEFAULT },
779 { "evalGraphUp", ArgBoolean, (void *) &wpEvalGraph.visible, TRUE, (ArgIniType) TRUE },
780 { "evalGraphX", ArgX, (void *) &wpEvalGraph.x, TRUE, (ArgIniType) CW_USEDEFAULT },
781 { "evalGraphY", ArgY, (void *) &wpEvalGraph.y, TRUE, (ArgIniType) CW_USEDEFAULT },
782 { "evalGraphW", ArgInt, (void *) &wpEvalGraph.width, TRUE, (ArgIniType) CW_USEDEFAULT },
783 { "evalGraphH", ArgInt, (void *) &wpEvalGraph.height, TRUE, (ArgIniType) CW_USEDEFAULT },
785 { "engineOutputUp", ArgBoolean, (void *) &wpEngineOutput.visible, TRUE, (ArgIniType) TRUE },
786 { "engineOutputX", ArgX, (void *) &wpEngineOutput.x, TRUE, (ArgIniType) CW_USEDEFAULT },
787 { "engineOutputY", ArgY, (void *) &wpEngineOutput.y, TRUE, (ArgIniType) CW_USEDEFAULT },
788 { "engineOutputW", ArgInt, (void *) &wpEngineOutput.width, TRUE, (ArgIniType) CW_USEDEFAULT },
789 { "engineOutputH", ArgInt, (void *) &wpEngineOutput.height, TRUE, (ArgIniType) CW_USEDEFAULT },
791 { NULL, ArgNone, NULL, FALSE, INVALID }
795 /* Kludge for indirection files on command line */
796 char* lastIndirectionFilename;
797 ArgDescriptor argDescriptorIndirection =
798 { "", ArgSettingsFilename, (void *) NULL, FALSE };
801 ExitArgError(char *msg, char *badArg, Boolean quit)
806 len = snprintf(buf, MSG_SIZ, msg, badArg);
807 if( (len >= MSG_SIZ) && appData.debugMode )
808 fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
810 if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
811 DisplayFatalError(buf, 0, 2);
819 if(*p == '-' || *p == '+') p++;
820 while(*p) if(!isdigit(*p++)) ExitArgError(_("Bad integer value %s"), s, TRUE);
825 StringGet(void *getClosure)
827 char **p = (char **) getClosure;
832 FileGet(void *getClosure)
835 FILE* f = (FILE*) getClosure;
838 if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely
845 /* Parse settings file named "name". If file found, return the
846 full name in fullname and return TRUE; else return FALSE */
848 ParseSettingsFile(char *name, char **addr)
852 char buf[MSG_SIZ], fullname[MSG_SIZ];
855 ok = MySearchPath(installDir, name, fullname);
856 if(!ok && strchr(name, '.') == NULL)
857 { // append default file-name extension '.ini' when needed
858 len = snprintf(buf,MSG_SIZ, "%s.ini", name);
859 if( (len >= MSG_SIZ) && appData.debugMode )
860 fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
862 ok = MySearchPath(installDir, buf, fullname);
865 f = fopen(fullname, "r");
868 ASSIGN(*addr, fullname);
870 ParseArgs(FileGet, f);
879 ParseArgs(GetFunc get, void *cl)
881 char argName[MAX_ARG_LEN];
882 char argValue[MAX_ARG_LEN];
888 int posarg = 4; // default is game file
893 while (ch == ' ' || ch == '\n' || ch == '\t') ch = get(cl);
894 if (ch == NULLCHAR) break;
896 /* Comment to end of line */
898 while (ch != '\n' && ch != NULLCHAR) ch = get(cl);
900 } else if (ch == '/' || ch == '-') {
903 while (ch != ' ' && ch != '=' && ch != ':' && ch != NULLCHAR &&
904 ch != '\n' && ch != '\t') {
909 for (ad = argDescriptors; ad->argName != NULL; ad++)
910 if (strcmp(ad->argName, argName + 1) == 0) break;
911 if (ad->argName == NULL) {
912 ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
913 while (ch != '\n' && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on
914 continue; // so that when it is in a settings file, it is the only setting that will be purged from it
916 } else if (ch == '@') {
917 /* Indirection file */
918 ad = &argDescriptorIndirection;
921 /* Positional argument */
922 ad = &argDescriptors[posarg++];
924 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
927 if (ad->argType == ArgTwo) { // [HGM] kludgey arg type, not suitable for saving
928 *(Boolean *) ad->argLoc = 2;
931 if (ad->argType == ArgTrue) {
932 *(Boolean *) ad->argLoc = TRUE;
935 if (ad->argType == ArgFalse) {
936 *(Boolean *) ad->argLoc = FALSE;
940 while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
941 if (ch == NULLCHAR || ch == '\n') {
942 ExitArgError(_("No value provided for argument %s"), argName, TRUE);
946 // Quoting with { }. No characters have to (or can) be escaped.
947 // Thus the string cannot contain a '}' character.
967 } else if (ch == '\'' || ch == '"') {
968 // Quoting with ' ' or " ", with \ as escape character.
969 // Inconvenient for long strings that may contain Windows filenames.
995 if (ad->argType == ArgFilename
996 || ad->argType == ArgSettingsFilename) {
1002 ExitArgError(_("Incomplete \\ escape in value for %s"), argName, TRUE);
1026 for (i = 0; i < 3; i++) {
1027 if (ch >= '0' && ch <= '7') {
1028 octval = octval*8 + (ch - '0');
1035 *q++ = (char) octval;
1046 while ((ch != ' ' || posflag) && ch != NULLCHAR && ch != '\t' && ch != '\n') { // space allowed in positional arg
1053 if(posflag) { // positional argument: the argName was implied, and per default set as -lgf
1054 int len = strlen(argValue) - 4; // start of filename extension
1055 if(len < 0) len = 0;
1056 if(!strcasecmp(argValue + len, ".trn")) {
1057 ad = &argDescriptors[2]; // correct implied type to -tf
1058 appData.tourney = TRUE; // let it parse -tourneyOptions later
1059 } else if(!strcasecmp(argValue + len, ".fen") || !strcasecmp(argValue + len, ".epd")) {
1060 ad = &argDescriptors[1]; // correct implied type to -lpf
1061 appData.viewer = TRUE;
1062 } else if(!strcasecmp(argValue + len, ".ini") || !strcasecmp(argValue + len, ".xop")) {
1063 ad = &argDescriptors[0]; // correct implied type to -opt
1064 } else if(GetEngineLine(argValue, 11)) {
1065 ad = &argDescriptors[3]; // correct implied type to -is
1066 } else { // keep default -lgf, but let it imply viewer mode as well
1067 appData.viewer = TRUE;
1069 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1072 switch (ad->argType) {
1074 *(int *) ad->argLoc = ValidateInt(argValue);
1078 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute
1082 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...)
1086 *(int *) ad->argLoc = ValidateInt(argValue);
1087 EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);
1091 *(float *) ad->argLoc = (float) atof(argValue);
1096 ASSIGN(*(char **) ad->argLoc, argValue);
1099 case ArgSettingsFilename:
1101 if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
1103 if (ad->argLoc != NULL) {
1105 ExitArgError(_("Failed to open indirection file %s"), argValue, TRUE);
1112 switch (argValue[0]) {
1115 *(Boolean *) ad->argLoc = TRUE;
1119 *(Boolean *) ad->argLoc = FALSE;
1122 ExitArgError(_("Unrecognized boolean argument value %s"), argValue, TRUE);
1128 ParseColor((int)(intptr_t)ad->argLoc, argValue);
1132 ColorClass cc = (ColorClass)ad->argLoc;
1133 ParseTextAttribs(cc, argValue); // [HGM] wrapper for platform independency
1138 ParseBoardSize(ad->argLoc, argValue);
1142 ParseFont(argValue, (int)(intptr_t)ad->argLoc);
1145 case ArgCommSettings:
1146 ParseCommPortSettings(argValue);
1150 ExitArgError(_("Unrecognized argument %s"), argValue, TRUE);
1160 ParseArgsFromString(char *p)
1162 ParseArgs(StringGet, &p);
1166 ParseArgsFromFile(FILE *f)
1168 ParseArgs(FileGet, f);
1172 ParseIcsTextMenu(char *icsTextMenuString)
1175 IcsTextMenuEntry *e = icsTextMenuEntry;
1176 char *p = icsTextMenuString;
1177 while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1180 if (e->command != NULL) {
1186 e = icsTextMenuEntry;
1187 while (*p && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1188 if (*p == ';' || *p == '\n') {
1189 e->item = strdup("-");
1192 } else if (*p == '-') {
1193 e->item = strdup("-");
1198 char *q, *r, *s, *t;
1201 if (q == NULL) break;
1203 r = strchr(q + 1, ',');
1204 if (r == NULL) break;
1206 s = strchr(r + 1, ',');
1207 if (s == NULL) break;
1210 t = strchr(s + 1, c);
1213 t = strchr(s + 1, c);
1215 if (t != NULL) *t = NULLCHAR;
1216 e->item = strdup(p);
1217 e->command = strdup(q + 1);
1218 e->getname = *(r + 1) != '0';
1219 e->immediate = *(s + 1) != '0';
1223 if (t == NULL) break;
1232 SetDefaultTextAttribs()
1235 for (cc = (ColorClass)0; cc < ColorNone; cc++) {
1236 ParseTextAttribs(cc, defaultTextAttribs[cc]);
1241 SetDefaultsFromList()
1242 { // [HGM] ini: take defaults from argDescriptor list
1245 for(i=0; argDescriptors[i].argName != NULL; i++) {
1246 if(argDescriptors[i].defaultValue != INVALID)
1247 switch(argDescriptors[i].argType) {
1252 *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1258 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1262 case ArgSettingsFilename:
1263 if((char *)argDescriptors[i].defaultValue)
1264 *(char **) argDescriptors[i].argLoc = strdup((char *)argDescriptors[i].defaultValue);
1267 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1270 ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue);
1272 case ArgFloat: // floats cannot be casted to int without precision loss
1273 default: ; // some arg types cannot be initialized through table
1279 InitAppData(char *lpCmdLine)
1282 char buf[MAX_ARG_LEN], currDir[MSG_SIZ];
1285 /* Initialize to defaults */
1286 SetDefaultsFromList(); // this sets most defaults
1288 // some parameters for which there are no options!
1289 appData.Iconic = FALSE; /*unused*/
1290 appData.icsEngineAnalyze = FALSE;
1292 // float: casting to int is not harmless, so default cannot be contained in table
1293 appData.timeDelay = TIME_DELAY;
1294 appData.timeIncrement = -314159;
1296 // some complex, platform-dependent stuff that could not be handled from table
1297 SetDefaultTextAttribs();
1299 SetCommPortDefaults();
1301 /* Parse default settings file if any */
1302 ParseSettingsFile(settingsFileName, &settingsFileName);
1304 /* Parse command line */
1305 ParseArgs(StringGet, &lpCmdLine);
1307 if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
1308 if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
1309 chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);
1310 appData.icsActive |= GetEngineLine(icsNick, 10);
1312 /* [HGM] make sure board size is acceptable */
1313 if(appData.NrFiles > BOARD_FILES ||
1314 appData.NrRanks > BOARD_RANKS )
1315 DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);
1317 /* [HGM] After parsing the options from the .ini file, and overruling them
1318 * with options from the command line, we now make an even higher priority
1319 * overrule by WB options attached to the engine command line. This so that
1320 * tournament managers can use WB options (such as /timeOdds) that follow
1323 if(appData.firstChessProgram != NULL) {
1324 char *p = StrStr(appData.firstChessProgram, "WBopt");
1325 static char *f = "first";
1326 char buf[MSG_SIZ], *q = buf;
1330 { // engine command line contains WinBoard options
1331 len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
1332 if( (len >= MSG_SIZ) && appData.debugMode )
1333 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1335 ParseArgs(StringGet, &q);
1336 p[-1] = 0; // cut them offengine command line
1339 // now do same for second chess program
1340 if(appData.secondChessProgram != NULL) {
1341 char *p = StrStr(appData.secondChessProgram, "WBopt");
1342 static char *s = "second";
1343 char buf[MSG_SIZ], *q = buf;
1347 { // engine command line contains WinBoard options
1348 len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
1349 if( (len >= MSG_SIZ) && appData.debugMode )
1350 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1352 ParseArgs(StringGet, &q);
1353 p[-1] = 0; // cut them offengine command line
1357 /* Propagate options that affect others */
1358 if (appData.matchMode || appData.matchGames) chessProgram = TRUE;
1359 if (appData.icsActive || appData.noChessProgram) {
1360 chessProgram = FALSE; /* not local chess program mode */
1362 if(appData.timeIncrement == -314159) { // new storage mechanism of (mps,inc) in use and no -inc on command line
1363 if(appData.movesPerSession <= 0) { // new encoding of incremental mode
1364 appData.timeIncrement = -appData.movesPerSession/1000.;
1365 } else appData.timeIncrement = -1;
1367 if(appData.movesPerSession <= 0) appData.movesPerSession = MOVES_PER_SESSION; // mps <= 0 is invalid in any case
1369 /* Open startup dialog if needed */
1370 if ((!appData.noChessProgram && !chessProgram && !appData.icsActive) ||
1371 (appData.icsActive && *appData.icsHost == NULLCHAR) ||
1372 (chessProgram && (*appData.firstChessProgram == NULLCHAR ||
1373 *appData.secondChessProgram == NULLCHAR)))
1374 PopUpStartupDialog();
1376 /* Make sure save files land in the right (?) directory */
1377 if (MyGetFullPathName(appData.saveGameFile, buf)) {
1378 appData.saveGameFile = strdup(buf);
1380 if (MyGetFullPathName(appData.savePositionFile, buf)) {
1381 appData.savePositionFile = strdup(buf);
1384 /* Finish initialization for fonts and sounds */
1387 GetCurrentDirectory(MSG_SIZ, currDir);
1388 SetCurrentDirectory(installDir);
1390 SetCurrentDirectory(currDir);
1392 p = icsTextMenuString;
1394 FILE* f = fopen(p + 1, "r");
1396 DisplayFatalError(p + 1, errno, 2);
1399 i = fread(buf, 1, sizeof(buf)-1, f);
1404 ParseIcsTextMenu(strdup(p));
1408 SaveSettings(char* name)
1412 char dir[MSG_SIZ], buf[MSG_SIZ];
1413 int mps = appData.movesPerSession;
1415 if (!MainWindowUp()) return;
1417 GetCurrentDirectory(MSG_SIZ, dir);
1418 if(MySearchPath(installDir, name, buf)) {
1419 f = fopen(buf, "w");
1421 SetCurrentDirectory(installDir);
1422 f = fopen(name, "w");
1423 SetCurrentDirectory(dir);
1426 DisplayError(name, errno);
1431 fprintf(f, "; %s Save Settings file\n", PACKAGE_STRING);
1433 fprintf(f, "; You can edit the values of options that are already set in this file,\n");
1434 fprintf(f, "; but if you add other options, the next Save Settings will not save them.\n");
1435 fprintf(f, "; Use a shortcut, an @indirection file, or a .bat file instead.\n");
1440 /* [AS] Move history */
1441 wpMoveHistory.visible = MoveHistoryIsUp();
1443 /* [AS] Eval graph */
1444 wpEvalGraph.visible = EvalGraphIsUp();
1446 /* [AS] Engine output */
1447 wpEngineOutput.visible = EngineOutputIsUp();
1449 // [HGM] in WB we have to copy sound names to appData first
1452 if(appData.timeIncrement >= 0) appData.movesPerSession = -1000*appData.timeIncrement; // kludge to store mps & inc as one
1454 for (ad = argDescriptors; ad->argName != NULL; ad++) {
1455 if (!ad->save) continue;
1456 switch (ad->argType) {
1459 char *p = *(char **)ad->argLoc;
1460 if(p == NULL) break; // just in case
1461 if ((strchr(p, '\\') || strchr(p, '\n')) && !strchr(p, '}')) {
1462 /* Quote multiline values or \-containing values
1463 with { } if possible */
1464 fprintf(f, OPTCHAR "%s" SEPCHAR "{%s}\n", ad->argName, p);
1466 /* Else quote with " " */
1467 fprintf(f, OPTCHAR "%s" SEPCHAR "\"", ad->argName);
1469 if (*p == '\n') fprintf(f, "\n");
1470 else if (*p == '\r') fprintf(f, "\\r");
1471 else if (*p == '\t') fprintf(f, "\\t");
1472 else if (*p == '\b') fprintf(f, "\\b");
1473 else if (*p == '\f') fprintf(f, "\\f");
1474 else if (*p < ' ') fprintf(f, "\\%03o", *p);
1475 else if (*p == '\"') fprintf(f, "\\\"");
1476 else if (*p == '\\') fprintf(f, "\\\\");
1486 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc);
1489 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.x); // [HGM] placement: store relative value
1492 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.y);
1495 fprintf(f, OPTCHAR "%s" SEPCHAR "%g\n", ad->argName, *(float *)ad->argLoc);
1498 fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName,
1499 (*(Boolean *)ad->argLoc) ? "true" : "false");
1502 if (*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1505 if (!*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1511 SaveAttribsArg(f, ad);
1514 if(*(char**)ad->argLoc == NULL) break; // just in case
1515 if (strchr(*(char **)ad->argLoc, '\"')) {
1516 fprintf(f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, *(char **)ad->argLoc);
1518 fprintf(f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, *(char **)ad->argLoc);
1522 SaveBoardSize(f, ad->argName, ad->argLoc);
1527 case ArgCommSettings:
1528 PrintCommPortSettings(f, ad->argName);
1531 case ArgSettingsFilename: ;
1535 appData.movesPerSession = mps;
1539 GetArgValue(char *name)
1540 { // retrieve (as text) current value of string or int argument given by name
1541 // (this is used for maing the values available in the adapter command)
1545 for (ad = argDescriptors; ad->argName != NULL; ad++)
1546 if (strcmp(ad->argName, name) == 0) break;
1548 if (ad->argName == NULL) return FALSE;
1550 switch(ad->argType) {
1553 strncpy(name, *(char**) ad->argLoc, MSG_SIZ);
1557 len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
1558 if( (len >= MSG_SIZ) && appData.debugMode )
1559 fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1563 len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
1564 if( (len >= MSG_SIZ) && appData.debugMode )
1565 fprintf(debugFP, "GetArgValue: buffer truncated.\n");