X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=args.h;h=2471d131d26cb660f99873488b93f247516c39b6;hb=e7b4c63691a7608892a85a85f4fb424f2c2637b5;hp=00126f9974be629f4db546fa1c9eeb5cfbbf8565;hpb=e80c98c04e951e5026a24531cd6316be962636b9;p=xboard.git diff --git a/args.h b/args.h index 00126f9..2471d13 100644 --- a/args.h +++ b/args.h @@ -5,7 +5,7 @@ * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + * 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -102,6 +102,7 @@ typedef struct { IcsTextMenuEntry icsTextMenuEntry[ICS_TEXT_MENU_SIZE]; int junk; +Boolean singleList; void EnsureOnScreen(int *x, int *y, int minX, int minY); char StringGet(void *getClosure); @@ -156,8 +157,8 @@ ArgDescriptor argDescriptors[] = { { "phc", ArgColor, (void *) 5, FALSE, INVALID }, { "movesPerSession", ArgInt, (void *) &appData.movesPerSession, TRUE, (ArgIniType) MOVES_PER_SESSION }, { "mps", ArgInt, (void *) &appData.movesPerSession, FALSE, INVALID }, - { "initString", ArgString, (void *) &appData.initString, FALSE, INVALID }, - { "firstInitString", ArgString, (void *) &appData.initString, FALSE, (ArgIniType) INIT_STRING }, + { "initString", ArgString, (void *) &appData.firstInitString, FALSE, INVALID }, + { "firstInitString", ArgString, (void *) &appData.firstInitString, FALSE, (ArgIniType) INIT_STRING }, { "secondInitString", ArgString, (void *) &appData.secondInitString, FALSE, (ArgIniType) INIT_STRING }, { "firstComputerString", ArgString, (void *) &appData.firstComputerString, FALSE, (ArgIniType) COMPUTER_STRING }, @@ -185,6 +186,7 @@ ArgDescriptor argDescriptors[] = { { "fd", ArgFilename, (void *) &appData.firstDirectory, FALSE, INVALID }, { "secondDirectory", ArgFilename, (void *) &appData.secondDirectory, FALSE, (ArgIniType) SECOND_DIRECTORY }, { "sd", ArgFilename, (void *) &appData.secondDirectory, FALSE, INVALID }, + { "variations", ArgBoolean, (void *) &appData.variations, TRUE, (ArgIniType) FALSE }, /* some options only used by the XBoard front end, and ignored in WinBoard */ /* Their saving is controlled by XBOARD, which in WinBoard is defined as FALSE */ @@ -205,10 +207,13 @@ ArgDescriptor argDescriptors[] = { { "pixmap", ArgFilename, (void *) &appData.pixmapDirectory, FALSE, INVALID }, { "bitmapDirectory", ArgFilename, (void *) &appData.bitmapDirectory, XBOARD, (ArgIniType) "" }, { "bm", ArgFilename, (void *) &appData.bitmapDirectory, FALSE, INVALID }, + { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" }, { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY }, { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE }, { "dropMenu", ArgBoolean, (void *) &appData.dropMenu, TRUE, (ArgIniType) FALSE }, + { "pieceMenu", ArgBoolean, (void *) &appData.pieceMenu, TRUE, (ArgIniType) TRUE }, + { "sweepPromotions", ArgBoolean, (void *) &appData.sweepSelect, TRUE, (ArgIniType) FALSE }, { "remoteShell", ArgFilename, (void *) &appData.remoteShell, FALSE, (ArgIniType) REMOTE_SHELL }, { "rsh", ArgFilename, (void *) &appData.remoteShell, FALSE, INVALID }, { "remoteUser", ArgString, (void *) &appData.remoteUser, FALSE, INVALID }, @@ -217,8 +222,8 @@ ArgDescriptor argDescriptors[] = { { "td", ArgFloat, (void *) &appData.timeDelay, FALSE, INVALID }, { "timeControl", ArgString, (void *) &appData.timeControl, TRUE, (ArgIniType) TIME_CONTROL }, { "tc", ArgString, (void *) &appData.timeControl, FALSE, INVALID }, - { "timeIncrement", ArgInt, (void *) &appData.timeIncrement, TRUE, (ArgIniType) TIME_INCREMENT }, - { "inc", ArgInt, (void *) &appData.timeIncrement, FALSE, INVALID }, + { "timeIncrement", ArgFloat, (void *) &appData.timeIncrement, TRUE, INVALID }, + { "inc", ArgFloat, (void *) &appData.timeIncrement, FALSE, INVALID }, { "internetChessServerMode", ArgBoolean, (void *) &appData.icsActive, FALSE, INVALID }, { "ics", ArgTrue, (void *) &appData.icsActive, FALSE, (ArgIniType) FALSE }, { "xics", ArgFalse, (void *) &appData.icsActive, FALSE, INVALID }, @@ -453,6 +458,7 @@ ArgDescriptor argDescriptors[] = { { "soundIcsDraw", ArgFilename, (void *) &appData.soundIcsDraw, TRUE, (ArgIniType) "" }, { "soundIcsUnfinished", ArgFilename, (void *) &appData.soundIcsUnfinished, TRUE, (ArgIniType) "" }, { "soundIcsAlarm", ArgFilename, (void *) &appData.soundIcsAlarm, TRUE, (ArgIniType) "" }, + { "disguisePromotedPieces", ArgBoolean, (void *) &appData.disguise, TRUE, (ArgIniType) TRUE }, { "reuseFirst", ArgBoolean, (void *) &appData.reuseFirst, FALSE, (ArgIniType) TRUE }, { "reuse", ArgTrue, (void *) &appData.reuseFirst, FALSE, INVALID }, { "xreuse", ArgFalse, (void *) &appData.reuseFirst, FALSE, INVALID }, @@ -474,10 +480,11 @@ ArgDescriptor argDescriptors[] = { { "-cp", ArgFalse, (void *) &chessProgram, FALSE, INVALID }, { "icsMenu", ArgString, (void *) &icsTextMenuString, TRUE, (ArgIniType) ICS_TEXT_MENU_DEFAULT }, { "icsNames", ArgString, (void *) &icsNames, TRUE, (ArgIniType) ICS_NAMES }, + { "singleEngineList", ArgBoolean, (void *) &singleList, !XBOARD, (ArgIniType) FALSE }, { "firstChessProgramNames", ArgString, (void *) &firstChessProgramNames, TRUE, (ArgIniType) FCP_NAMES }, { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames, - TRUE, (ArgIniType) SCP_NAMES }, + !XBOARD, (ArgIniType) SCP_NAMES }, { "initialMode", ArgString, (void *) &appData.initialMode, FALSE, (ArgIniType) "" }, { "mode", ArgString, (void *) &appData.initialMode, FALSE, INVALID }, { "variant", ArgString, (void *) &appData.variant, FALSE, (ArgIniType) "normal" }, @@ -547,6 +554,19 @@ ArgDescriptor argDescriptors[] = { { "defaultPathEGTB", ArgFilename, (void *) &appData.defaultPathEGTB, TRUE, (ArgIniType) "c:\\egtb" }, { "language", ArgFilename, (void *) &appData.language, TRUE, (ArgIniType) "" }, + // [HGM] tournament options + { "tourney", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" }, + { "tf", ArgFilename, (void *) &appData.tourneyFile, FALSE, INVALID }, + { "processes", ArgString, (void *) &appData.processes, FALSE, (ArgIniType) " " }, + { "participants", ArgString, (void *) &appData.participants, FALSE, (ArgIniType) "" }, + { "tourneyType", ArgInt, (void *) &appData.tourneyType, FALSE, (ArgIniType) 0 }, + { "tt", ArgInt, (void *) &appData.tourneyType, FALSE, INVALID }, + { "tourneyCycles", ArgInt, (void *) &appData.tourneyCycles, FALSE, (ArgIniType) 1 }, + { "cy", ArgInt, (void *) &appData.tourneyCycles, FALSE, INVALID }, + { "results", ArgString, (void *) &appData.results, FALSE, (ArgIniType) "" }, + { "syncAfterRound", ArgBoolean, (void *) &appData.roundSync, FALSE, (ArgIniType) FALSE }, + { "syncAfterCycle", ArgBoolean, (void *) &appData.cycleSync, FALSE, (ArgIniType) TRUE }, + /* [HGM] board-size, adjudication and misc. options */ { "oneClickMove", ArgBoolean, (void *) &appData.oneClick, TRUE, (ArgIniType) FALSE }, { "boardWidth", ArgInt, (void *) &appData.NrFiles, FALSE, (ArgIniType) -1 }, @@ -557,8 +577,8 @@ ArgDescriptor argDescriptors[] = { { "pieceToCharTable", ArgString, (void *) &appData.pieceToCharTable, FALSE, INVALID }, { "pieceNickNames", ArgString, (void *) &appData.pieceNickNames, FALSE, INVALID }, { "colorNickNames", ArgString, (void *) &appData.colorNickNames, FALSE, INVALID }, - { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, TRUE, (ArgIniType) FALSE }, - { "allWhite", ArgBoolean, (void *) &appData.allWhite, TRUE, (ArgIniType) FALSE }, + { "flipBlack", ArgBoolean, (void *) &appData.upsideDown, FALSE, (ArgIniType) FALSE }, + { "allWhite", ArgBoolean, (void *) &appData.allWhite, FALSE, (ArgIniType) FALSE }, { "alphaRank", ArgBoolean, (void *) &appData.alphaRank, FALSE, (ArgIniType) FALSE }, { "firstAlphaRank", ArgBoolean, (void *) &first.alphaRank, FALSE, (ArgIniType) FALSE }, { "secondAlphaRank", ArgBoolean, (void *) &second.alphaRank, FALSE, (ArgIniType) FALSE }, @@ -812,10 +832,8 @@ ParseArgs(GetFunc get, void *cl) ch = get(cl); } *q = NULLCHAR; - for (ad = argDescriptors; ad->argName != NULL; ad++) if (strcmp(ad->argName, argName + 1) == 0) break; - if (ad->argName == NULL) ExitArgError("Unrecognized argument", argName); @@ -1007,7 +1025,7 @@ ParseArgs(GetFunc get, void *cl) break; case ArgColor: - ParseColor((int)ad->argLoc, argValue); + ParseColor((int)(intptr_t)ad->argLoc, argValue); break; case ArgAttribs: { @@ -1021,7 +1039,7 @@ ParseArgs(GetFunc get, void *cl) break; case ArgFont: - ParseFont(argValue, (int)ad->argLoc); + ParseFont(argValue, (int)(intptr_t)ad->argLoc); break; case ArgCommSettings: @@ -1038,6 +1056,18 @@ ParseArgs(GetFunc get, void *cl) } void +ParseArgsFromString(char *p) +{ + ParseArgs(StringGet, &p); +} + +void +ParseArgsFromFile(FILE *f) +{ + ParseArgs(FileGet, f); +} + +void ParseIcsTextMenu(char *icsTextMenuString) { // int flags = 0; @@ -1117,13 +1147,13 @@ SetDefaultsFromList() case ArgBoolean: case ArgTrue: case ArgFalse: - *(Boolean *) argDescriptors[i].argLoc = (int)argDescriptors[i].defaultValue; + *(Boolean *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue; break; case ArgInt: case ArgX: case ArgY: case ArgZ: - *(int *) argDescriptors[i].argLoc = (int)argDescriptors[i].defaultValue; + *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue; break; case ArgString: case ArgFilename: @@ -1131,10 +1161,10 @@ SetDefaultsFromList() *(char **) argDescriptors[i].argLoc = (char *)argDescriptors[i].defaultValue; break; case ArgBoardSize: - *(int *) argDescriptors[i].argLoc = (int)argDescriptors[i].defaultValue; + *(int *) argDescriptors[i].argLoc = (int)(intptr_t)argDescriptors[i].defaultValue; break; case ArgColor: - ParseColor((int)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue); + ParseColor((int)(intptr_t)argDescriptors[i].argLoc, (char*)argDescriptors[i].defaultValue); break; case ArgFloat: // floats cannot be casted to int without precision loss default: ; // some arg types cannot be initialized through table @@ -1158,6 +1188,7 @@ InitAppData(char *lpCmdLine) // float: casting to int is not harmless, so default cannot be contained in table appData.timeDelay = TIME_DELAY; + appData.timeIncrement = TIME_INCREMENT; // some complex, platform-dependent stuff that could not be handled from table SetDefaultTextAttribs();