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 { "pngDirectory", ArgFilename, (void *) &appData.pngDirectory, XBOARD, (ArgIniType) "" },
215 { "png", ArgFilename, (void *) &appData.pngDirectory, FALSE, INVALID },
216 { "svgDirectory", ArgFilename, (void *) &appData.svgDirectory, XBOARD, (ArgIniType) "" },
217 { "svg", ArgFilename, (void *) &appData.svgDirectory, 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 { "autoObserve", ArgBoolean, (void *) &appData.autoObserve, TRUE, (ArgIniType) FALSE },
358 { "autobs", ArgTrue, (void *) &appData.autoObserve, FALSE, INVALID },
359 { "xautobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
360 { "-autobs", ArgFalse, (void *) &appData.autoObserve, FALSE, INVALID },
361 { "flipView", ArgBoolean, (void *) &appData.flipView, FALSE, (ArgIniType) FALSE },
362 { "flip", ArgTrue, (void *) &appData.flipView, FALSE, INVALID },
363 { "xflip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
364 { "-flip", ArgFalse, (void *) &appData.flipView, FALSE, INVALID },
365 { "autoFlipView", ArgBoolean, (void *) &appData.autoFlipView, TRUE, (ArgIniType) TRUE },
366 { "autoflip", ArgTrue, (void *) &appData.autoFlipView, FALSE, INVALID },
367 { "xautoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
368 { "-autoflip", ArgFalse, (void *) &appData.autoFlipView, FALSE, INVALID },
369 { "autoRaiseBoard", ArgBoolean, (void *) &appData.autoRaiseBoard, TRUE, (ArgIniType) TRUE },
370 { "autoraise", ArgTrue, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
371 { "xautoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
372 { "-autoraise", ArgFalse, (void *) &appData.autoRaiseBoard, FALSE, INVALID },
373 { "alwaysPromoteToQueen", ArgBoolean, (void *) &appData.alwaysPromoteToQueen, TRUE, (ArgIniType) FALSE },
374 { "queen", ArgTrue, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
375 { "xqueen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
376 { "-queen", ArgFalse, (void *) &appData.alwaysPromoteToQueen, FALSE, INVALID },
377 { "oldSaveStyle", ArgBoolean, (void *) &appData.oldSaveStyle, TRUE, (ArgIniType) FALSE },
378 { "oldsave", ArgTrue, (void *) &appData.oldSaveStyle, FALSE, INVALID },
379 { "xoldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
380 { "-oldsave", ArgFalse, (void *) &appData.oldSaveStyle, FALSE, INVALID },
381 { "quietPlay", ArgBoolean, (void *) &appData.quietPlay, TRUE, (ArgIniType) FALSE },
382 { "quiet", ArgTrue, (void *) &appData.quietPlay, FALSE, INVALID },
383 { "xquiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
384 { "-quiet", ArgFalse, (void *) &appData.quietPlay, FALSE, INVALID },
385 { "getMoveList", ArgBoolean, (void *) &appData.getMoveList, TRUE, (ArgIniType) TRUE },
386 { "moves", ArgTrue, (void *) &appData.getMoveList, FALSE, INVALID },
387 { "xmoves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
388 { "-moves", ArgFalse, (void *) &appData.getMoveList, FALSE, INVALID },
389 { "testLegality", ArgBoolean, (void *) &appData.testLegality, TRUE, (ArgIniType) TRUE },
390 { "legal", ArgTrue, (void *) &appData.testLegality, FALSE, INVALID },
391 { "xlegal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
392 { "-legal", ArgFalse, (void *) &appData.testLegality, FALSE, INVALID },
393 { "premove", ArgBoolean, (void *) &appData.premove, TRUE, (ArgIniType) TRUE },
394 { "pre", ArgTrue, (void *) &appData.premove, FALSE, INVALID },
395 { "xpre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
396 { "-pre", ArgFalse, (void *) &appData.premove, FALSE, INVALID },
397 { "premoveWhite", ArgBoolean, (void *) &appData.premoveWhite, TRUE, (ArgIniType) FALSE },
398 { "prewhite", ArgTrue, (void *) &appData.premoveWhite, FALSE, INVALID },
399 { "xprewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
400 { "-prewhite", ArgFalse, (void *) &appData.premoveWhite, FALSE, INVALID },
401 { "premoveWhiteText", ArgString, (void *) &appData.premoveWhiteText, TRUE, (ArgIniType) "" },
402 { "premoveBlack", ArgBoolean, (void *) &appData.premoveBlack, TRUE, (ArgIniType) FALSE },
403 { "preblack", ArgTrue, (void *) &appData.premoveBlack, FALSE, INVALID },
404 { "xpreblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
405 { "-preblack", ArgFalse, (void *) &appData.premoveBlack, FALSE, INVALID },
406 { "premoveBlackText", ArgString, (void *) &appData.premoveBlackText, TRUE, (ArgIniType) "" },
407 { "icsAlarm", ArgBoolean, (void *) &appData.icsAlarm, TRUE, (ArgIniType) TRUE},
408 { "alarm", ArgTrue, (void *) &appData.icsAlarm, FALSE},
409 { "xalarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
410 { "-alarm", ArgFalse, (void *) &appData.icsAlarm, FALSE},
411 { "icsAlarmTime", ArgInt, (void *) &appData.icsAlarmTime, TRUE, (ArgIniType) 5000},
412 { "localLineEditing", ArgBoolean, (void *) &appData.localLineEditing, FALSE, (ArgIniType) TRUE},
413 { "edit", ArgTrue, (void *) &appData.localLineEditing, FALSE, INVALID },
414 { "xedit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
415 { "-edit", ArgFalse, (void *) &appData.localLineEditing, FALSE, INVALID },
416 { "animateMoving", ArgBoolean, (void *) &appData.animate, TRUE, (ArgIniType) TRUE },
417 { "animate", ArgTrue, (void *) &appData.animate, FALSE, INVALID },
418 { "xanimate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
419 { "-animate", ArgFalse, (void *) &appData.animate, FALSE, INVALID },
420 { "animateSpeed", ArgInt, (void *) &appData.animSpeed, TRUE, (ArgIniType) 10 },
421 { "animateDragging", ArgBoolean, (void *) &appData.animateDragging, TRUE, (ArgIniType) TRUE },
422 { "drag", ArgTrue, (void *) &appData.animateDragging, FALSE, INVALID },
423 { "xdrag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
424 { "-drag", ArgFalse, (void *) &appData.animateDragging, FALSE, INVALID },
425 { "blindfold", ArgBoolean, (void *) &appData.blindfold, TRUE, (ArgIniType) FALSE },
426 { "blind", ArgTrue, (void *) &appData.blindfold, FALSE, INVALID },
427 { "xblind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
428 { "-blind", ArgFalse, (void *) &appData.blindfold, FALSE, INVALID },
429 { "highlightLastMove", ArgBoolean,
430 (void *) &appData.highlightLastMove, TRUE, (ArgIniType) TRUE },
431 { "highlight", ArgTrue, (void *) &appData.highlightLastMove, FALSE, INVALID },
432 { "xhighlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
433 { "-highlight", ArgFalse, (void *) &appData.highlightLastMove, FALSE, INVALID },
434 { "highlightDragging", ArgBoolean,
435 (void *) &appData.highlightDragging, !XBOARD, (ArgIniType) TRUE },
436 { "highdrag", ArgTrue, (void *) &appData.highlightDragging, FALSE, INVALID },
437 { "xhighdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
438 { "-highdrag", ArgFalse, (void *) &appData.highlightDragging, FALSE, INVALID },
439 { "colorizeMessages", ArgBoolean, (void *) &appData.colorize, TRUE, (ArgIniType) TRUE },
440 { "colorize", ArgTrue, (void *) &appData.colorize, FALSE, INVALID },
441 { "xcolorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
442 { "-colorize", ArgFalse, (void *) &appData.colorize, FALSE, INVALID },
443 { "colorShout", ArgAttribs, (void *) ColorShout, TRUE, INVALID },
444 { "colorSShout", ArgAttribs, (void *) ColorSShout, TRUE, INVALID },
445 { "colorCShout", ArgAttribs, (void *) ColorSShout, FALSE, INVALID }, // for XB
446 { "colorChannel1", ArgAttribs, (void *) ColorChannel1, TRUE, INVALID },
447 { "colorChannel", ArgAttribs, (void *) ColorChannel, TRUE, INVALID },
448 { "colorKibitz", ArgAttribs, (void *) ColorKibitz, TRUE, INVALID },
449 { "colorTell", ArgAttribs, (void *) ColorTell, TRUE, INVALID },
450 { "colorChallenge", ArgAttribs, (void *) ColorChallenge, TRUE, INVALID },
451 { "colorRequest", ArgAttribs, (void *) ColorRequest, TRUE, INVALID },
452 { "colorSeek", ArgAttribs, (void *) ColorSeek, TRUE, INVALID },
453 { "colorNormal", ArgAttribs, (void *) ColorNormal, TRUE, INVALID },
454 { "colorBackground", ArgColor, (void *) 7, TRUE, COLOR_BKGD },
455 { "soundShout", ArgFilename, (void *) &appData.soundShout, TRUE, (ArgIniType) "" },
456 { "soundSShout", ArgFilename, (void *) &appData.soundSShout, TRUE, (ArgIniType) "" },
457 { "soundCShout", ArgFilename, (void *) &appData.soundSShout, FALSE, (ArgIniType) "" }, // for XB
458 { "soundChannel1", ArgFilename, (void *) &appData.soundChannel1, TRUE, (ArgIniType) "" },
459 { "soundChannel", ArgFilename, (void *) &appData.soundChannel, TRUE, (ArgIniType) "" },
460 { "soundKibitz", ArgFilename, (void *) &appData.soundKibitz, TRUE, (ArgIniType) "" },
461 { "soundTell", ArgFilename, (void *) &appData.soundTell, TRUE, (ArgIniType) "" },
462 { "soundChallenge", ArgFilename, (void *) &appData.soundChallenge, TRUE, (ArgIniType) "" },
463 { "soundRequest", ArgFilename, (void *) &appData.soundRequest, TRUE, (ArgIniType) "" },
464 { "soundSeek", ArgFilename, (void *) &appData.soundSeek, TRUE, (ArgIniType) "" },
465 { "soundMove", ArgFilename, (void *) &appData.soundMove, TRUE, (ArgIniType) "" },
466 { "soundBell", ArgFilename, (void *) &appData.soundBell, TRUE, (ArgIniType) SOUND_BELL },
467 { "soundIcsWin", ArgFilename, (void *) &appData.soundIcsWin, TRUE, (ArgIniType) "" },
468 { "soundIcsLoss", ArgFilename, (void *) &appData.soundIcsLoss, TRUE, (ArgIniType) "" },
469 { "soundIcsDraw", ArgFilename, (void *) &appData.soundIcsDraw, TRUE, (ArgIniType) "" },
470 { "soundIcsUnfinished", ArgFilename, (void *) &appData.soundIcsUnfinished, TRUE, (ArgIniType) "" },
471 { "soundIcsAlarm", ArgFilename, (void *) &appData.soundIcsAlarm, TRUE, (ArgIniType) "" },
472 { "disguisePromotedPieces", ArgBoolean, (void *) &appData.disguise, TRUE, (ArgIniType) TRUE },
473 { "reuseFirst", ArgBoolean, (void *) &appData.reuseFirst, FALSE, (ArgIniType) TRUE },
474 { "reuse", ArgTrue, (void *) &appData.reuseFirst, FALSE, INVALID },
475 { "xreuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
476 { "-reuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID },
477 { "reuseChessPrograms", ArgBoolean,
478 (void *) &appData.reuseFirst, FALSE, INVALID }, /* backward compat only */
479 { "reuseSecond", ArgBoolean, (void *) &appData.reuseSecond, FALSE, (ArgIniType) TRUE },
480 { "reuse2", ArgTrue, (void *) &appData.reuseSecond, FALSE, INVALID },
481 { "xreuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
482 { "-reuse2", ArgFalse, (void *) &appData.reuseSecond, FALSE, INVALID },
483 { "comPortSettings", ArgCommSettings, (void *) /*&dcb*/ 0, TRUE, INVALID },
484 { "settingsFile", ArgSettingsFilename, (void *) &settingsFileName, FALSE, (ArgIniType) SETTINGS_FILE },
485 { "ini", ArgSettingsFilename, (void *) &settingsFileName, FALSE, INVALID },
486 { "at", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
487 { "opt", ArgSettingsFilename, (void *) NULL, FALSE, INVALID },
488 { "saveSettingsFile", ArgFilename, (void *) &settingsFileName, FALSE, INVALID },
489 { "saveSettingsOnExit", ArgBoolean, (void *) &saveSettingsOnExit, TRUE, (ArgIniType) TRUE },
490 { "chessProgram", ArgBoolean, (void *) &chessProgram, FALSE, (ArgIniType) FALSE },
491 { "cp", ArgTrue, (void *) &chessProgram, FALSE, INVALID },
492 { "xcp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
493 { "-cp", ArgFalse, (void *) &chessProgram, FALSE, INVALID },
494 { "icsMenu", ArgString, (void *) &icsTextMenuString, TRUE, (ArgIniType) ICS_TEXT_MENU_DEFAULT },
495 { "icsNames", ArgString, (void *) &icsNames, TRUE, (ArgIniType) ICS_NAMES },
496 { "singleEngineList", ArgBoolean, (void *) &singleList, !XBOARD, (ArgIniType) FALSE },
497 { "recentEngines", ArgInt, (void *) &appData.recentEngines, TRUE, (ArgIniType) 6 },
498 { "recentEngineList", ArgString, (void *) &appData.recentEngineList, TRUE, (ArgIniType) "" },
499 { "firstChessProgramNames", ArgString, (void *) &firstChessProgramNames,
500 TRUE, (ArgIniType) FCP_NAMES },
501 { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames,
502 !XBOARD, (ArgIniType) SCP_NAMES },
503 { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" },
504 { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID },
505 { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" },
506 { "firstProtocolVersion", ArgInt, (void *) &appData.firstProtocolVersion, FALSE, (ArgIniType) PROTOVER },
507 { "secondProtocolVersion", ArgInt, (void *) &appData.secondProtocolVersion,FALSE, (ArgIniType) PROTOVER },
508 { "showButtonBar", ArgBoolean, (void *) &appData.showButtonBar, TRUE, (ArgIniType) TRUE },
509 { "buttons", ArgTrue, (void *) &appData.showButtonBar, FALSE, INVALID },
510 { "xbuttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
511 { "-buttons", ArgFalse, (void *) &appData.showButtonBar, FALSE, INVALID },
513 /* [AS] New features */
514 { "firstScoreAbs", ArgBoolean, (void *) &appData.firstScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
515 { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE },
516 { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE },
517 { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE },
518 { "liteBackTextureFile", ArgString, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" },
519 { "darkBackTextureFile", ArgString, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" },
520 { "liteBackTextureMode", ArgInt, (void *) &appData.liteBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
521 { "darkBackTextureMode", ArgInt, (void *) &appData.darkBackTextureMode, TRUE, (ArgIniType) BACK_TEXTURE_MODE_PLAIN },
522 { "renderPiecesWithFont", ArgString, (void *) &appData.renderPiecesWithFont, TRUE, (ArgIniType) "" },
523 { "fontPieceToCharTable", ArgString, (void *) &appData.fontToPieceTable, TRUE, (ArgIniType) "" },
524 { "fontPieceBackColorWhite", ArgColor, (void *) 8, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
525 { "fontPieceForeColorWhite", ArgColor, (void *) 9, TRUE, (ArgIniType) WHITE_PIECE_COLOR },
526 { "fontPieceBackColorBlack", ArgColor, (void *) 10, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
527 { "fontPieceForeColorBlack", ArgColor, (void *) 11, TRUE, (ArgIniType) BLACK_PIECE_COLOR },
528 { "fontPieceSize", ArgInt, (void *) &appData.fontPieceSize, TRUE, (ArgIniType) 80 },
529 { "overrideLineGap", ArgInt, (void *) &appData.overrideLineGap, TRUE, (ArgIniType) 1 },
530 { "adjudicateLossThreshold", ArgInt, (void *) &appData.adjudicateLossThreshold, TRUE, (ArgIniType) 0 },
531 { "delayBeforeQuit", ArgInt, (void *) &appData.delayBeforeQuit, TRUE, (ArgIniType) 0 },
532 { "delayAfterQuit", ArgInt, (void *) &appData.delayAfterQuit, TRUE, (ArgIniType) 0 },
533 { "nameOfDebugFile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, (ArgIniType) DEBUG_FILE },
534 { "debugfile", ArgFilename, (void *) &appData.nameOfDebugFile, FALSE, INVALID },
535 { "pgnEventHeader", ArgString, (void *) &appData.pgnEventHeader, TRUE, (ArgIniType) "Computer Chess Game" },
536 { "defaultFrcPosition", ArgInt, (void *) &appData.defaultFrcPosition, TRUE, (ArgIniType) -1 },
537 { "shuffleOpenings", ArgTrue, (void *) &shuffleOpenings, FALSE, INVALID },
538 { "gameListTags", ArgString, (void *) &appData.gameListTags, TRUE, (ArgIniType) GLT_DEFAULT_TAGS },
539 { "saveOutOfBookInfo", ArgBoolean, (void *) &appData.saveOutOfBookInfo, TRUE, (ArgIniType) TRUE },
540 { "showEvalInMoveHistory", ArgBoolean, (void *) &appData.showEvalInMoveHistory, TRUE, (ArgIniType) TRUE },
541 { "evalHistColorWhite", ArgColor, (void *) 12, TRUE, (ArgIniType) "#FFFFB0" },
542 { "evalHistColorBlack", ArgColor, (void *) 13, TRUE, (ArgIniType) "#AD5D3D" },
543 { "highlightMoveWithArrow", ArgBoolean, (void *) &appData.highlightMoveWithArrow, TRUE, (ArgIniType) FALSE },
544 { "highlightArrowColor", ArgColor, (void *) 14, TRUE, (ArgIniType) "#FFFF80" },
545 { "stickyWindows", ArgBoolean, (void *) &appData.useStickyWindows, TRUE, (ArgIniType) TRUE },
546 { "adjudicateDrawMoves", ArgInt, (void *) &appData.adjudicateDrawMoves, TRUE, (ArgIniType) 0 },
547 { "autoDisplayComment", ArgBoolean, (void *) &appData.autoDisplayComment, TRUE, (ArgIniType) TRUE },
548 { "autoDisplayTags", ArgBoolean, (void *) &appData.autoDisplayTags, TRUE, (ArgIniType) TRUE },
549 { "firstIsUCI", ArgBoolean, (void *) &appData.firstIsUCI, FALSE, (ArgIniType) FALSE },
550 { "fUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
551 { "firstUCI", ArgTrue, (void *) &appData.firstIsUCI, FALSE, INVALID },
552 { "secondIsUCI", ArgBoolean, (void *) &appData.secondIsUCI, FALSE, (ArgIniType) FALSE },
553 { "secondUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
554 { "sUCI", ArgTrue, (void *) &appData.secondIsUCI, FALSE, INVALID },
555 { "fUCCI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
556 { "sUCCI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
557 { "fUSI", ArgTwo, (void *) &appData.firstIsUCI, FALSE, INVALID },
558 { "sUSI", ArgTwo, (void *) &appData.secondIsUCI, FALSE, INVALID },
559 { "firstHasOwnBookUCI", ArgBoolean, (void *) &appData.firstHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
560 { "fNoOwnBookUCI", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
561 { "firstXBook", ArgFalse, (void *) &appData.firstHasOwnBookUCI, FALSE, INVALID },
562 { "secondHasOwnBookUCI", ArgBoolean, (void *) &appData.secondHasOwnBookUCI, FALSE, (ArgIniType) TRUE },
563 { "sNoOwnBookUCI", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
564 { "secondXBook", ArgFalse, (void *) &appData.secondHasOwnBookUCI, FALSE, INVALID },
565 { "adapterCommand", ArgFilename, (void *) &appData.adapterCommand, TRUE, (ArgIniType) "polyglot -noini -ec \"%fcp\" -ed \"%fd\"" },
566 { "uxiAdapter", ArgFilename, (void *) &appData.ucciAdapter, TRUE, (ArgIniType) "" },
567 { "polyglotDir", ArgFilename, (void *) &appData.polyglotDir, TRUE, (ArgIniType) "" },
568 { "usePolyglotBook", ArgBoolean, (void *) &appData.usePolyglotBook, TRUE, (ArgIniType) FALSE },
569 { "polyglotBook", ArgFilename, (void *) &appData.polyglotBook, TRUE, (ArgIniType) "" },
570 { "bookDepth", ArgInt, (void *) &appData.bookDepth, TRUE, (ArgIniType) 12 },
571 { "bookVariation", ArgInt, (void *) &appData.bookStrength, TRUE, (ArgIniType) 50 },
572 { "discourageOwnBooks", ArgBoolean, (void *) &appData.defNoBook, TRUE, (ArgIniType) FALSE },
573 { "defaultHashSize", ArgInt, (void *) &appData.defaultHashSize, TRUE, (ArgIniType) 64 },
574 { "defaultCacheSizeEGTB", ArgInt, (void *) &appData.defaultCacheSizeEGTB, TRUE, (ArgIniType) 4 },
575 { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" },
576 { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" },
577 { "userFileDirectory", ArgFilename, (void *) &homeDir, FALSE, (ArgIniType) installDir },
578 { "usePieceFont", ArgBoolean, (void *) &appData.useFont, TRUE, (ArgIniType) FALSE },
579 { "useBoardTexture", ArgBoolean, (void *) &appData.useBitmaps, TRUE, (ArgIniType) FALSE },
581 // [HGM] tournament options
582 { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
583 { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID },
584 { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" },
585 { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 },
586 { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID },
587 { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 },
588 { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID },
589 { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" },
590 { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE },
591 { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE },
592 { "seedBase", ArgInt, (void *) &appData.seedBase, FALSE, (ArgIniType) 1 },
593 { "pgnNumberTag", ArgBoolean, (void *) &appData.numberTag, TRUE, (ArgIniType) FALSE },
594 { "afterGame", ArgString, (void *) &appData.afterGame, FALSE, INVALID },
595 { "afterTourney", ArgString, (void *) &appData.afterTourney, FALSE, INVALID },
597 /* [HGM] board-size, adjudication and misc. options */
598 { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE },
599 { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 },
600 { "boardHeight", ArgInt, (void *) &appData.NrRanks, FALSE, (ArgIniType) -1 },
601 { "holdingsSize", ArgInt, (void *) &appData.holdingsSize, FALSE, (ArgIniType) -1 },
602 { "defaultMatchGames", ArgInt, (void *) &appData.defaultMatchGames, TRUE, (ArgIniType) 10 },
603 { "matchPause", ArgInt, (void *) &appData.matchPause, TRUE, (ArgIniType) 10000 },
604 { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID },
605 { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID },
606 { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID },
607 { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE },
608 { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE },
609 { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE },
610 { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE },
611 { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE },
612 { "testClaims", ArgBoolean, (void *) &appData.testClaims, TRUE, (ArgIniType) FALSE },
613 { "checkMates", ArgBoolean, (void *) &appData.checkMates, TRUE, (ArgIniType) FALSE },
614 { "materialDraws", ArgBoolean, (void *) &appData.materialDraws, TRUE, (ArgIniType) FALSE },
615 { "trivialDraws", ArgBoolean, (void *) &appData.trivialDraws, TRUE, (ArgIniType) FALSE },
616 { "ruleMoves", ArgInt, (void *) &appData.ruleMoves, TRUE, (ArgIniType) 51 },
617 { "repeatsToDraw", ArgInt, (void *) &appData.drawRepeats, TRUE, (ArgIniType) 6 },
618 { "backgroundObserve", ArgBoolean, (void *) &appData.bgObserve, TRUE, (ArgIniType) FALSE },
619 { "dualBoard", ArgBoolean, (void *) &appData.dualBoard, TRUE, (ArgIniType) FALSE },
620 { "autoKibitz", ArgTrue, (void *) &appData.autoKibitz, FALSE, INVALID },
621 { "engineDebugOutput", ArgInt, (void *) &appData.engineComments, FALSE, (ArgIniType) 1 },
622 { "userName", ArgString, (void *) &appData.userName, FALSE, INVALID },
623 { "rewindIndex", ArgInt, (void *) &appData.rewindIndex, FALSE, INVALID },
624 { "sameColorGames", ArgInt, (void *) &appData.sameColorGames, FALSE, INVALID },
625 { "smpCores", ArgInt, (void *) &appData.smpCores, TRUE, (ArgIniType) 1 },
626 { "egtFormats", ArgString, (void *) &appData.egtFormats, TRUE, (ArgIniType) "" },
627 { "niceEngines", ArgInt, (void *) &appData.niceEngines, TRUE, INVALID },
628 { "logoSize", ArgInt, (void *) &appData.logoSize, XBOARD, INVALID },
629 { "logoDir", ArgFilename, (void *) &appData.logoDir, XBOARD, (ArgIniType) "." },
630 { "firstLogo", ArgFilename, (void *) &appData.firstLogo, FALSE, (ArgIniType) "" },
631 { "secondLogo", ArgFilename, (void *) &appData.secondLogo, FALSE, (ArgIniType) "" },
632 { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID },
633 { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" },
634 { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" },
635 { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" },
636 { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" },
637 { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" },
638 { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL },
639 { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL },
640 { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
641 { "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
642 { "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
643 { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, (ArgIniType) FALSE },
644 { "firstPgnName", ArgString, (void *) &appData.pgnName[0], FALSE, (ArgIniType) "" },
645 { "fn", ArgString, (void *) &appData.pgnName[0], FALSE, INVALID },
646 { "secondPgnName", ArgString, (void *) &appData.pgnName[1], FALSE, (ArgIniType) "" },
647 { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID },
648 { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE },
649 { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE },
650 { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 },
651 { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 },
652 { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE },
653 { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE },
654 { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" },
655 { "defaultTourneyName", ArgFilename, (void *) &appData.defName, TRUE, "" },
656 { "eloThresholdAny", ArgInt, (void *) &appData.eloThreshold1, FALSE, (ArgIniType) 0 },
657 { "eloThresholdBoth", ArgInt, (void *) &appData.eloThreshold2, FALSE, (ArgIniType) 0 },
658 { "dateThreshold", ArgInt, (void *) &appData.dateThreshold, FALSE, (ArgIniType) 0 },
659 { "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
660 { "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
661 { "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
662 { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
663 { "viewer", ArgTrue, (void *) &appData.viewer, FALSE, FALSE },
664 { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" },
665 { "tourneyOptions", ArgString, (void *) &appData.tourneyOptions, TRUE, (ArgIniType) "-ncp -mm -saveSettingsOnExit false" },
666 { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE },
667 { "topLevel", ArgBoolean, (void *) &appData.topLevel, XBOARD, (ArgIniType) TOPLEVEL },
668 { "dialogColor", ArgString, (void *) &appData.dialogColor, XBOARD, (ArgIniType) "" },
669 { "buttonColor", ArgString, (void *) &appData.buttonColor, XBOARD, (ArgIniType) "" },
672 { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
673 { "zt", ArgTrue, (void *) &appData.zippyTalk, FALSE, INVALID },
674 { "xzt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
675 { "-zt", ArgFalse, (void *) &appData.zippyTalk, FALSE, INVALID },
676 { "zippyPlay", ArgBoolean, (void *) &appData.zippyPlay, FALSE, (ArgIniType) ZIPPY_PLAY },
677 { "zp", ArgTrue, (void *) &appData.zippyPlay, FALSE, INVALID },
678 { "xzp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
679 { "-zp", ArgFalse, (void *) &appData.zippyPlay, FALSE, INVALID },
680 { "zippyLines", ArgFilename, (void *) &appData.zippyLines, FALSE, (ArgIniType) ZIPPY_LINES },
681 { "zippyPinhead", ArgString, (void *) &appData.zippyPinhead, FALSE, (ArgIniType) ZIPPY_PINHEAD },
682 { "zippyPassword", ArgString, (void *) &appData.zippyPassword, FALSE, (ArgIniType) ZIPPY_PASSWORD },
683 { "zippyPassword2", ArgString, (void *) &appData.zippyPassword2, FALSE, (ArgIniType) ZIPPY_PASSWORD2 },
684 { "zippyWrongPassword", ArgString, (void *) &appData.zippyWrongPassword,
685 FALSE, (ArgIniType) ZIPPY_WRONG_PASSWORD },
686 { "zippyAcceptOnly", ArgString, (void *) &appData.zippyAcceptOnly, FALSE, (ArgIniType) ZIPPY_ACCEPT_ONLY },
687 { "zippyUseI", ArgBoolean, (void *) &appData.zippyUseI, FALSE, (ArgIniType) ZIPPY_USE_I },
688 { "zui", ArgTrue, (void *) &appData.zippyUseI, FALSE, INVALID },
689 { "xzui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
690 { "-zui", ArgFalse, (void *) &appData.zippyUseI, FALSE, INVALID },
691 { "zippyBughouse", ArgInt, (void *) &appData.zippyBughouse, FALSE, (ArgIniType) ZIPPY_BUGHOUSE },
692 { "zippyNoplayCrafty", ArgBoolean, (void *) &appData.zippyNoplayCrafty,
693 FALSE, (ArgIniType) ZIPPY_NOPLAY_CRAFTY },
694 { "znc", ArgTrue, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
695 { "xznc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
696 { "-znc", ArgFalse, (void *) &appData.zippyNoplayCrafty, FALSE, INVALID },
697 { "zippyGameEnd", ArgString, (void *) &appData.zippyGameEnd, FALSE, (ArgIniType) ZIPPY_GAME_END },
698 { "zippyGameStart", ArgString, (void *) &appData.zippyGameStart, FALSE, (ArgIniType) ZIPPY_GAME_START },
699 { "zippyAdjourn", ArgBoolean, (void *) &appData.zippyAdjourn, FALSE, (ArgIniType) ZIPPY_ADJOURN },
700 { "zadj", ArgTrue, (void *) &appData.zippyAdjourn, FALSE, INVALID },
701 { "xzadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
702 { "-zadj", ArgFalse, (void *) &appData.zippyAdjourn, FALSE, INVALID },
703 { "zippyAbort", ArgBoolean, (void *) &appData.zippyAbort, FALSE, (ArgIniType) ZIPPY_ABORT },
704 { "zab", ArgTrue, (void *) &appData.zippyAbort, FALSE, INVALID },
705 { "xzab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
706 { "-zab", ArgFalse, (void *) &appData.zippyAbort, FALSE, INVALID },
707 { "zippyVariants", ArgString, (void *) &appData.zippyVariants, FALSE, (ArgIniType) ZIPPY_VARIANTS },
708 { "zippyMaxGames", ArgInt, (void *)&appData.zippyMaxGames, FALSE, (ArgIniType) ZIPPY_MAX_GAMES},
709 { "zippyReplayTimeout", ArgInt, (void *)&appData.zippyReplayTimeout, FALSE, (ArgIniType) ZIPPY_REPLAY_TIMEOUT },
710 { "zippyShortGame", ArgInt, (void *)&appData.zippyShortGame, FALSE, INVALID },
711 /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */
712 { "zippyReplyTimeout", ArgInt, (void *)&junk, FALSE, INVALID },
714 /* [HGM] options for broadcasting and time odds */
715 { "chatBoxes", ArgString, (void *) &appData.chatBoxes, !XBOARD, (ArgIniType) NULL },
716 { "serverMoves", ArgString, (void *) &appData.serverMovesName, FALSE, (ArgIniType) NULL },
717 { "serverFile", ArgString, (void *) &appData.serverFileName, FALSE, (ArgIniType) NULL },
718 { "suppressLoadMoves", ArgBoolean, (void *) &appData.suppressLoadMoves, FALSE, (ArgIniType) FALSE },
719 { "serverPause", ArgInt, (void *) &appData.serverPause, FALSE, (ArgIniType) 15 },
720 { "firstTimeOdds", ArgInt, (void *) &appData.firstTimeOdds, FALSE, (ArgIniType) 1 },
721 { "secondTimeOdds", ArgInt, (void *) &appData.secondTimeOdds, FALSE, (ArgIniType) 1 },
722 { "timeOddsMode", ArgInt, (void *) &appData.timeOddsMode, TRUE, INVALID },
723 { "firstAccumulateTC", ArgInt, (void *) &appData.firstAccumulateTC, FALSE, (ArgIniType) 1 },
724 { "secondAccumulateTC", ArgInt, (void *) &appData.secondAccumulateTC, FALSE, (ArgIniType) 1 },
725 { "firstNPS", ArgInt, (void *) &appData.firstNPS, FALSE, (ArgIniType) -1 },
726 { "secondNPS", ArgInt, (void *) &appData.secondNPS, FALSE, (ArgIniType) -1 },
727 { "noGUI", ArgTrue, (void *) &appData.noGUI, FALSE, INVALID },
728 { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID },
729 { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID },
730 { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */
731 { "openCommand", ArgString, (void *) &appData.sysOpen, FALSE, "xdg-open" },
733 // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others
734 { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed
735 { "minY", ArgZ, (void *) &minY, FALSE, INVALID },
736 { "winWidth", ArgInt, (void *) &wpMain.width, TRUE, INVALID }, // [HGM] placement: dummies to remember right & bottom
737 { "winHeight", ArgInt, (void *) &wpMain.height, TRUE, INVALID }, // for attaching auxiliary windows to them
738 { "x", ArgInt, (void *) &wpMain.x, TRUE, (ArgIniType) CW_USEDEFAULT },
739 { "y", ArgInt, (void *) &wpMain.y, TRUE, (ArgIniType) CW_USEDEFAULT },
740 { "icsX", ArgX, (void *) &wpConsole.x, TRUE, (ArgIniType) CW_USEDEFAULT },
741 { "icsY", ArgY, (void *) &wpConsole.y, TRUE, (ArgIniType) CW_USEDEFAULT },
742 { "icsW", ArgInt, (void *) &wpConsole.width, TRUE, (ArgIniType) CW_USEDEFAULT },
743 { "icsH", ArgInt, (void *) &wpConsole.height, TRUE, (ArgIniType) CW_USEDEFAULT },
744 { "commentX", ArgX, (void *) &wpComment.x, TRUE, (ArgIniType) CW_USEDEFAULT },
745 { "commentY", ArgY, (void *) &wpComment.y, TRUE, (ArgIniType) CW_USEDEFAULT },
746 { "commentW", ArgInt, (void *) &wpComment.width, TRUE, (ArgIniType) CW_USEDEFAULT },
747 { "commentH", ArgInt, (void *) &wpComment.height, TRUE, (ArgIniType) CW_USEDEFAULT },
748 { "tagsX", ArgX, (void *) &wpTags.x, TRUE, (ArgIniType) CW_USEDEFAULT },
749 { "tagsY", ArgY, (void *) &wpTags.y, TRUE, (ArgIniType) CW_USEDEFAULT },
750 { "tagsW", ArgInt, (void *) &wpTags.width, TRUE, (ArgIniType) CW_USEDEFAULT },
751 { "tagsH", ArgInt, (void *) &wpTags.height, TRUE, (ArgIniType) CW_USEDEFAULT },
752 { "gameListX", ArgX, (void *) &wpGameList.x, TRUE, (ArgIniType) CW_USEDEFAULT },
753 { "gameListY", ArgY, (void *) &wpGameList.y, TRUE, (ArgIniType) CW_USEDEFAULT },
754 { "gameListW", ArgInt, (void *) &wpGameList.width, TRUE, (ArgIniType) CW_USEDEFAULT },
755 { "gameListH", ArgInt, (void *) &wpGameList.height, TRUE, (ArgIniType) CW_USEDEFAULT },
756 /* [AS] Layout stuff */
757 { "moveHistoryUp", ArgBoolean, (void *) &wpMoveHistory.visible, TRUE, (ArgIniType) TRUE },
758 { "moveHistoryX", ArgX, (void *) &wpMoveHistory.x, TRUE, (ArgIniType) CW_USEDEFAULT },
759 { "moveHistoryY", ArgY, (void *) &wpMoveHistory.y, TRUE, (ArgIniType) CW_USEDEFAULT },
760 { "moveHistoryW", ArgInt, (void *) &wpMoveHistory.width, TRUE, (ArgIniType) CW_USEDEFAULT },
761 { "moveHistoryH", ArgInt, (void *) &wpMoveHistory.height, TRUE, (ArgIniType) CW_USEDEFAULT },
763 { "evalGraphUp", ArgBoolean, (void *) &wpEvalGraph.visible, TRUE, (ArgIniType) TRUE },
764 { "evalGraphX", ArgX, (void *) &wpEvalGraph.x, TRUE, (ArgIniType) CW_USEDEFAULT },
765 { "evalGraphY", ArgY, (void *) &wpEvalGraph.y, TRUE, (ArgIniType) CW_USEDEFAULT },
766 { "evalGraphW", ArgInt, (void *) &wpEvalGraph.width, TRUE, (ArgIniType) CW_USEDEFAULT },
767 { "evalGraphH", ArgInt, (void *) &wpEvalGraph.height, TRUE, (ArgIniType) CW_USEDEFAULT },
769 { "engineOutputUp", ArgBoolean, (void *) &wpEngineOutput.visible, TRUE, (ArgIniType) TRUE },
770 { "engineOutputX", ArgX, (void *) &wpEngineOutput.x, TRUE, (ArgIniType) CW_USEDEFAULT },
771 { "engineOutputY", ArgY, (void *) &wpEngineOutput.y, TRUE, (ArgIniType) CW_USEDEFAULT },
772 { "engineOutputW", ArgInt, (void *) &wpEngineOutput.width, TRUE, (ArgIniType) CW_USEDEFAULT },
773 { "engineOutputH", ArgInt, (void *) &wpEngineOutput.height, TRUE, (ArgIniType) CW_USEDEFAULT },
775 { NULL, ArgNone, NULL, FALSE, INVALID }
779 /* Kludge for indirection files on command line */
780 char* lastIndirectionFilename;
781 ArgDescriptor argDescriptorIndirection =
782 { "", ArgSettingsFilename, (void *) NULL, FALSE };
785 ExitArgError(char *msg, char *badArg, Boolean quit)
790 len = snprintf(buf, MSG_SIZ, msg, badArg);
791 if( (len >= MSG_SIZ) && appData.debugMode )
792 fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
794 if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
795 DisplayFatalError(buf, 0, 2);
803 if(*p == '-' || *p == '+') p++;
804 while(*p) if(!isdigit(*p++)) ExitArgError(_("Bad integer value %s"), s, TRUE);
809 StringGet(void *getClosure)
811 char **p = (char **) getClosure;
816 FileGet(void *getClosure)
819 FILE* f = (FILE*) getClosure;
822 if (c == '\r') c = getc(f); // work around DOS format files by bypassing the '\r' completely
829 /* Parse settings file named "name". If file found, return the
830 full name in fullname and return TRUE; else return FALSE */
832 ParseSettingsFile(char *name, char **addr)
836 char buf[MSG_SIZ], fullname[MSG_SIZ];
839 ok = MySearchPath(installDir, name, fullname);
840 if(!ok && strchr(name, '.') == NULL)
841 { // append default file-name extension '.ini' when needed
842 len = snprintf(buf,MSG_SIZ, "%s.ini", name);
843 if( (len >= MSG_SIZ) && appData.debugMode )
844 fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
846 ok = MySearchPath(installDir, buf, fullname);
849 f = fopen(fullname, "r");
852 ASSIGN(*addr, fullname);
854 ParseArgs(FileGet, f);
863 ParseArgs(GetFunc get, void *cl)
865 char argName[MAX_ARG_LEN];
866 char argValue[MAX_ARG_LEN];
872 int posarg = 4; // default is game file
877 while (ch == ' ' || ch == '\n' || ch == '\t') ch = get(cl);
878 if (ch == NULLCHAR) break;
880 /* Comment to end of line */
882 while (ch != '\n' && ch != NULLCHAR) ch = get(cl);
884 } else if (ch == '/' || ch == '-') {
887 while (ch != ' ' && ch != '=' && ch != ':' && ch != NULLCHAR &&
888 ch != '\n' && ch != '\t') {
893 for (ad = argDescriptors; ad->argName != NULL; ad++)
894 if (strcmp(ad->argName, argName + 1) == 0) break;
895 if (ad->argName == NULL) {
896 ExitArgError(_("Unrecognized argument %s"), argName, get != &FileGet); // [HGM] make unknown argument non-fatal
897 while (ch != '\n' && ch != NULLCHAR) ch = get(cl); // but skip rest of line it is on
898 continue; // so that when it is in a settings file, it is the only setting that will be purged from it
900 } else if (ch == '@') {
901 /* Indirection file */
902 ad = &argDescriptorIndirection;
905 /* Positional argument */
906 ad = &argDescriptors[posarg++];
908 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
911 if (ad->argType == ArgTwo) { // [HGM] kludgey arg type, not suitable for saving
912 *(Boolean *) ad->argLoc = 2;
915 if (ad->argType == ArgTrue) {
916 *(Boolean *) ad->argLoc = TRUE;
919 if (ad->argType == ArgFalse) {
920 *(Boolean *) ad->argLoc = FALSE;
924 while (ch == ' ' || ch == '=' || ch == ':' || ch == '\t') ch = get(cl);
925 if (ch == NULLCHAR || ch == '\n') {
926 ExitArgError(_("No value provided for argument %s"), argName, TRUE);
930 // Quoting with { }. No characters have to (or can) be escaped.
931 // Thus the string cannot contain a '}' character.
951 } else if (ch == '\'' || ch == '"') {
952 // Quoting with ' ' or " ", with \ as escape character.
953 // Inconvenient for long strings that may contain Windows filenames.
979 if (ad->argType == ArgFilename
980 || ad->argType == ArgSettingsFilename) {
986 ExitArgError(_("Incomplete \\ escape in value for %s"), argName, TRUE);
1010 for (i = 0; i < 3; i++) {
1011 if (ch >= '0' && ch <= '7') {
1012 octval = octval*8 + (ch - '0');
1019 *q++ = (char) octval;
1030 while ((ch != ' ' || posflag) && ch != NULLCHAR && ch != '\t' && ch != '\n') { // space allowed in positional arg
1037 if(posflag) { // positional argument: the argName was implied, and per default set as -lgf
1038 int len = strlen(argValue) - 4; // start of filename extension
1039 if(len < 0) len = 0;
1040 if(!strcasecmp(argValue + len, ".trn")) {
1041 ad = &argDescriptors[2]; // correct implied type to -tf
1042 appData.tourney = TRUE; // let it parse -tourneyOptions later
1043 } else if(!strcasecmp(argValue + len, ".fen") || !strcasecmp(argValue + len, ".epd")) {
1044 ad = &argDescriptors[1]; // correct implied type to -lpf
1045 appData.viewer = TRUE;
1046 } else if(!strcasecmp(argValue + len, ".ini") || !strcasecmp(argValue + len, ".xop")) {
1047 ad = &argDescriptors[0]; // correct implied type to -opt
1048 } else if(GetEngineLine(argValue, 11)) {
1049 ad = &argDescriptors[3]; // correct implied type to -is
1050 } else { // keep default -lgf, but let it imply viewer mode as well
1051 appData.viewer = TRUE;
1053 strncpy(argName, ad->argName,sizeof(argName)/sizeof(argName[0]));
1056 switch (ad->argType) {
1058 *(int *) ad->argLoc = ValidateInt(argValue);
1062 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.x; // [HGM] placement: translate stored relative to absolute
1066 *(int *) ad->argLoc = ValidateInt(argValue) + wpMain.y; // (this is really kludgey, it should be done where used...)
1070 *(int *) ad->argLoc = ValidateInt(argValue);
1071 EnsureOnScreen(&wpMain.x, &wpMain.y, minX, minY);
1075 *(float *) ad->argLoc = (float) atof(argValue);
1080 ASSIGN(*(char **) ad->argLoc, argValue);
1083 case ArgSettingsFilename:
1085 if (ParseSettingsFile(argValue, (char**)ad->argLoc)) {
1087 if (ad->argLoc != NULL) {
1089 ExitArgError(_("Failed to open indirection file %s"), argValue, TRUE);
1096 switch (argValue[0]) {
1099 *(Boolean *) ad->argLoc = TRUE;
1103 *(Boolean *) ad->argLoc = FALSE;
1106 ExitArgError(_("Unrecognized boolean argument value %s"), argValue, TRUE);
1112 ParseColor((int)(intptr_t)ad->argLoc, argValue);
1116 ColorClass cc = (ColorClass)ad->argLoc;
1117 ParseTextAttribs(cc, argValue); // [HGM] wrapper for platform independency
1122 ParseBoardSize(ad->argLoc, argValue);
1126 ParseFont(argValue, (int)(intptr_t)ad->argLoc);
1129 case ArgCommSettings:
1130 ParseCommPortSettings(argValue);
1134 ExitArgError(_("Unrecognized argument %s"), argValue, TRUE);
1144 ParseArgsFromString(char *p)
1146 ParseArgs(StringGet, &p);
1150 ParseArgsFromFile(FILE *f)
1152 ParseArgs(FileGet, f);
1156 ParseIcsTextMenu(char *icsTextMenuString)
1159 IcsTextMenuEntry *e = icsTextMenuEntry;
1160 char *p = icsTextMenuString;
1161 while (e->item != NULL && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1164 if (e->command != NULL) {
1170 e = icsTextMenuEntry;
1171 while (*p && e < icsTextMenuEntry + ICS_TEXT_MENU_SIZE) {
1172 if (*p == ';' || *p == '\n') {
1173 e->item = strdup("-");
1176 } else if (*p == '-') {
1177 e->item = strdup("-");
1182 char *q, *r, *s, *t;
1185 if (q == NULL) break;
1187 r = strchr(q + 1, ',');
1188 if (r == NULL) break;
1190 s = strchr(r + 1, ',');
1191 if (s == NULL) break;
1194 t = strchr(s + 1, c);
1197 t = strchr(s + 1, c);
1199 if (t != NULL) *t = NULLCHAR;
1200 e->item = strdup(p);
1201 e->command = strdup(q + 1);
1202 e->getname = *(r + 1) != '0';
1203 e->immediate = *(s + 1) != '0';
1207 if (t == NULL) break;
1216 SetDefaultTextAttribs()
1219 for (cc = (ColorClass)0; cc < ColorNone; cc++) {
1220 ParseTextAttribs(cc, defaultTextAttribs[cc]);
1225 SetDefaultsFromList()
1226 { // [HGM] ini: take defaults from argDescriptor list
1229 for(i=0; argDescriptors[i].argName != NULL; i++) {
1230 if(argDescriptors[i].defaultValue != INVALID)
1231 switch(argDescriptors[i].argType) {
1236 *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1242 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1246 case ArgSettingsFilename:
1247 if((char *)argDescriptors[i].defaultValue)
1248 *(char **) argDescriptors[i].argLoc = strdup((char *)argDescriptors[i].defaultValue);
1251 *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue;
1254 ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue);
1256 case ArgFloat: // floats cannot be casted to int without precision loss
1257 default: ; // some arg types cannot be initialized through table
1263 InitAppData(char *lpCmdLine)
1266 char buf[MAX_ARG_LEN], currDir[MSG_SIZ];
1269 /* Initialize to defaults */
1270 SetDefaultsFromList(); // this sets most defaults
1272 // some parameters for which there are no options!
1273 appData.Iconic = FALSE; /*unused*/
1274 appData.icsEngineAnalyze = FALSE;
1276 // float: casting to int is not harmless, so default cannot be contained in table
1277 appData.timeDelay = TIME_DELAY;
1278 appData.timeIncrement = -314159;
1280 // some complex, platform-dependent stuff that could not be handled from table
1281 SetDefaultTextAttribs();
1283 SetCommPortDefaults();
1285 /* Parse default settings file if any */
1286 ParseSettingsFile(settingsFileName, &settingsFileName);
1288 /* Parse command line */
1289 ParseArgs(StringGet, &lpCmdLine);
1291 if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions);
1292 if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions);
1293 chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1);
1294 appData.icsActive |= GetEngineLine(icsNick, 10);
1296 /* [HGM] make sure board size is acceptable */
1297 if(appData.NrFiles > BOARD_FILES ||
1298 appData.NrRanks > BOARD_RANKS )
1299 DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2);
1301 /* [HGM] After parsing the options from the .ini file, and overruling them
1302 * with options from the command line, we now make an even higher priority
1303 * overrule by WB options attached to the engine command line. This so that
1304 * tournament managers can use WB options (such as /timeOdds) that follow
1307 if(appData.firstChessProgram != NULL) {
1308 char *p = StrStr(appData.firstChessProgram, "WBopt");
1309 static char *f = "first";
1310 char buf[MSG_SIZ], *q = buf;
1314 { // engine command line contains WinBoard options
1315 len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
1316 if( (len >= MSG_SIZ) && appData.debugMode )
1317 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1319 ParseArgs(StringGet, &q);
1320 p[-1] = 0; // cut them offengine command line
1323 // now do same for second chess program
1324 if(appData.secondChessProgram != NULL) {
1325 char *p = StrStr(appData.secondChessProgram, "WBopt");
1326 static char *s = "second";
1327 char buf[MSG_SIZ], *q = buf;
1331 { // engine command line contains WinBoard options
1332 len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
1333 if( (len >= MSG_SIZ) && appData.debugMode )
1334 fprintf(debugFP, "InitAppData: buffer truncated.\n");
1336 ParseArgs(StringGet, &q);
1337 p[-1] = 0; // cut them offengine command line
1341 /* Propagate options that affect others */
1342 if (appData.matchMode || appData.matchGames) chessProgram = TRUE;
1343 if (appData.icsActive || appData.noChessProgram) {
1344 chessProgram = FALSE; /* not local chess program mode */
1346 if(appData.timeIncrement == -314159) { // new storage mechanism of (mps,inc) in use and no -inc on command line
1347 if(appData.movesPerSession <= 0) { // new encoding of incremental mode
1348 appData.timeIncrement = -appData.movesPerSession/1000.;
1349 } else appData.timeIncrement = -1;
1351 if(appData.movesPerSession <= 0) appData.movesPerSession = MOVES_PER_SESSION; // mps <= 0 is invalid in any case
1353 /* Open startup dialog if needed */
1354 if ((!appData.noChessProgram && !chessProgram && !appData.icsActive) ||
1355 (appData.icsActive && *appData.icsHost == NULLCHAR) ||
1356 (chessProgram && (*appData.firstChessProgram == NULLCHAR ||
1357 *appData.secondChessProgram == NULLCHAR)))
1358 PopUpStartupDialog();
1360 /* Make sure save files land in the right (?) directory */
1361 if (MyGetFullPathName(appData.saveGameFile, buf)) {
1362 appData.saveGameFile = strdup(buf);
1364 if (MyGetFullPathName(appData.savePositionFile, buf)) {
1365 appData.savePositionFile = strdup(buf);
1368 /* Finish initialization for fonts and sounds */
1371 GetCurrentDirectory(MSG_SIZ, currDir);
1372 SetCurrentDirectory(installDir);
1374 SetCurrentDirectory(currDir);
1376 p = icsTextMenuString;
1378 FILE* f = fopen(p + 1, "r");
1380 DisplayFatalError(p + 1, errno, 2);
1383 i = fread(buf, 1, sizeof(buf)-1, f);
1388 ParseIcsTextMenu(strdup(p));
1392 SaveSettings(char* name)
1396 char dir[MSG_SIZ], buf[MSG_SIZ];
1397 int mps = appData.movesPerSession;
1399 if (!MainWindowUp()) return;
1401 GetCurrentDirectory(MSG_SIZ, dir);
1402 if(MySearchPath(installDir, name, buf)) {
1403 f = fopen(buf, "w");
1405 SetCurrentDirectory(installDir);
1406 f = fopen(name, "w");
1407 SetCurrentDirectory(dir);
1410 DisplayError(name, errno);
1415 fprintf(f, "; %s Save Settings file\n", PACKAGE_STRING);
1417 fprintf(f, "; You can edit the values of options that are already set in this file,\n");
1418 fprintf(f, "; but if you add other options, the next Save Settings will not save them.\n");
1419 fprintf(f, "; Use a shortcut, an @indirection file, or a .bat file instead.\n");
1424 /* [AS] Move history */
1425 wpMoveHistory.visible = MoveHistoryIsUp();
1427 /* [AS] Eval graph */
1428 wpEvalGraph.visible = EvalGraphIsUp();
1430 /* [AS] Engine output */
1431 wpEngineOutput.visible = EngineOutputIsUp();
1433 // [HGM] in WB we have to copy sound names to appData first
1436 if(appData.timeIncrement >= 0) appData.movesPerSession = -1000*appData.timeIncrement; // kludge to store mps & inc as one
1438 for (ad = argDescriptors; ad->argName != NULL; ad++) {
1439 if (!ad->save) continue;
1440 switch (ad->argType) {
1443 char *p = *(char **)ad->argLoc;
1444 if(p == NULL) break; // just in case
1445 if ((strchr(p, '\\') || strchr(p, '\n')) && !strchr(p, '}')) {
1446 /* Quote multiline values or \-containing values
1447 with { } if possible */
1448 fprintf(f, OPTCHAR "%s" SEPCHAR "{%s}\n", ad->argName, p);
1450 /* Else quote with " " */
1451 fprintf(f, OPTCHAR "%s" SEPCHAR "\"", ad->argName);
1453 if (*p == '\n') fprintf(f, "\n");
1454 else if (*p == '\r') fprintf(f, "\\r");
1455 else if (*p == '\t') fprintf(f, "\\t");
1456 else if (*p == '\b') fprintf(f, "\\b");
1457 else if (*p == '\f') fprintf(f, "\\f");
1458 else if (*p < ' ') fprintf(f, "\\%03o", *p);
1459 else if (*p == '\"') fprintf(f, "\\\"");
1460 else if (*p == '\\') fprintf(f, "\\\\");
1470 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc);
1473 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.x); // [HGM] placement: store relative value
1476 fprintf(f, OPTCHAR "%s" SEPCHAR "%d\n", ad->argName, *(int *)ad->argLoc - wpMain.y);
1479 fprintf(f, OPTCHAR "%s" SEPCHAR "%g\n", ad->argName, *(float *)ad->argLoc);
1482 fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName,
1483 (*(Boolean *)ad->argLoc) ? "true" : "false");
1486 if (*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1489 if (!*(Boolean *)ad->argLoc) fprintf(f, OPTCHAR "%s\n", ad->argName);
1495 SaveAttribsArg(f, ad);
1498 if(*(char**)ad->argLoc == NULL) break; // just in case
1499 if (strchr(*(char **)ad->argLoc, '\"')) {
1500 fprintf(f, OPTCHAR "%s" SEPCHAR "'%s'\n", ad->argName, *(char **)ad->argLoc);
1502 fprintf(f, OPTCHAR "%s" SEPCHAR "\"%s\"\n", ad->argName, *(char **)ad->argLoc);
1506 SaveBoardSize(f, ad->argName, ad->argLoc);
1511 case ArgCommSettings:
1512 PrintCommPortSettings(f, ad->argName);
1515 case ArgSettingsFilename: ;
1519 appData.movesPerSession = mps;
1523 GetArgValue(char *name)
1524 { // retrieve (as text) current value of string or int argument given by name
1525 // (this is used for maing the values available in the adapter command)
1529 for (ad = argDescriptors; ad->argName != NULL; ad++)
1530 if (strcmp(ad->argName, name) == 0) break;
1532 if (ad->argName == NULL) return FALSE;
1534 switch(ad->argType) {
1537 strncpy(name, *(char**) ad->argLoc, MSG_SIZ);
1541 len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
1542 if( (len >= MSG_SIZ) && appData.debugMode )
1543 fprintf(debugFP, "GetArgValue: buffer truncated.\n");
1547 len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
1548 if( (len >= MSG_SIZ) && appData.debugMode )
1549 fprintf(debugFP, "GetArgValue: buffer truncated.\n");