X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=args.h;h=cdf51aac7713c93f3f7dda84c4caa94853b421e5;hb=4176af9f411840bc9806909dcd04f359a72d8629;hp=866a6a99258b7b83058c2590ab9c04e28f85dbb6;hpb=894916fe72347000731f92313b9c2230fd837247;p=xboard.git diff --git a/args.h b/args.h index 866a6a9..cdf51aa 100644 --- a/args.h +++ b/args.h @@ -112,6 +112,8 @@ char *firstEngineLine; char *secondEngineLine; char *icsNick; char *theme; +char *replace; +char *engineListFile; void EnsureOnScreen(int *x, int *y, int minX, int minY); char StringGet(void *getClosure); @@ -223,7 +225,8 @@ ArgDescriptor argDescriptors[] = { { "flashRate", ArgInt, (void *) &appData.flashRate, XBOARD, (ArgIniType) FLASH_RATE }, { "pieceImageDirectory", ArgFilename, (void *) &appData.pieceDirectory, TRUE, (ArgIniType) "" }, { "pid", ArgFilename, (void *) &appData.pieceDirectory, FALSE, INVALID }, - { "trueColors", ArgBoolean, (void *) &appData.trueColors, TRUE, (ArgIniType) FALSE }, + { "trueColors", ArgBoolean, (void *) &appData.trueColors, XBOARD, (ArgIniType) (2*!XBOARD) }, + { "jewelled", ArgInt, (void *) &appData.jewelled, FALSE, (ArgIniType) -1 }, { "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 }, @@ -516,6 +519,7 @@ ArgDescriptor argDescriptors[] = { { "secondChessProgramNames", ArgString, (void *) &secondChessProgramNames, !XBOARD, (ArgIniType) SCP_NAMES }, { "themeNames", ArgString, (void *) &appData.themeNames, TRUE, (ArgIniType) "native -upf false -ub false -ubt false -pid \"\"\n" }, + { "engineList", ArgFilename, (void *) &engineListFile, TRUE, (ArgIniType) "" }, { "addMasterOption", ArgMaster, NULL, FALSE, INVALID }, { "installEngine", ArgInstall, (void *) &firstChessProgramNames, FALSE, (ArgIniType) "" }, { "installTheme", ArgInstall, (void *) &appData.themeNames, FALSE, (ArgIniType) "" }, @@ -534,6 +538,7 @@ ArgDescriptor argDescriptors[] = { { "secondScoreAbs", ArgBoolean, (void *) &appData.secondScoreIsAbsolute, FALSE, (ArgIniType) FALSE }, { "pgnExtendedInfo", ArgBoolean, (void *) &appData.saveExtendedInfoInPGN, TRUE, (ArgIniType) FALSE }, { "hideThinkingFromHuman", ArgBoolean, (void *) &appData.hideThinkingFromHuman, TRUE, (ArgIniType) FALSE }, + { "pgnTimeLeft", ArgBoolean, (void *) &appData.cumulativeTimePGN, TRUE, (ArgIniType) FALSE }, { "liteBackTextureFile", ArgFilename, (void *) &appData.liteBackTextureFile, TRUE, (ArgIniType) "" }, { "lbtf", ArgFilename, (void *) &appData.liteBackTextureFile, FALSE, INVALID }, { "darkBackTextureFile", ArgFilename, (void *) &appData.darkBackTextureFile, TRUE, (ArgIniType) "" }, @@ -615,7 +620,10 @@ ArgDescriptor argDescriptors[] = { { "epd", ArgTrue, (void *) &appData.epd, FALSE, INVALID }, { "inscriptions", ArgString, (void *) &appData.inscriptions, FALSE, (ArgIniType) "" }, { "autoInstall", ArgString, (void *) &appData.autoInstall, XBOARD, (ArgIniType) "" }, + { "replace", ArgString, (void *) &replace, FALSE, (ArgIniType) NULL }, { "fixedSize", ArgBoolean, (void *) &appData.fixedSize, TRUE, (ArgIniType) FALSE }, + { "showMoveTime", ArgBoolean, (void *) &appData.moveTime, TRUE, (ArgIniType) FALSE }, + { "bmpSave", ArgInt, (void *) &appData.bmpSave, FALSE, 0 }, // [HGM] tournament options { "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" }, @@ -714,6 +722,9 @@ ArgDescriptor argDescriptors[] = { { "memoHeaders", ArgBoolean, (void *) &appData.headers, TRUE, (ArgIniType) FALSE }, { "startupMessage", ArgString, (void *) &appData.message, FALSE, (ArgIniType) "" }, { "messageSuppress", ArgString, (void *) &appData.suppress, XBOARD, (ArgIniType) "" }, + { "fen", ArgString, (void *) &appData.fen, FALSE, (ArgIniType) "" }, + { "men", ArgString, (void *) &appData.men, FALSE, (ArgIniType) "" }, + { "analysisBell", ArgInt, (void *) &appData.analysisBell, TRUE, (ArgIniType) 0 }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, @@ -957,7 +968,7 @@ ParseArgs(GetFunc get, void *cl) char argValue[MAX_ARG_LEN]; ArgDescriptor *ad; char start; - char *q; + char *q, *r, *s; int i, octval; char ch; int posarg = 4; // default is game file @@ -1176,6 +1187,11 @@ ParseArgs(GetFunc get, void *cl) ASSIGN(*(char **) ad->argLoc, buf); break; } + if(replace) { // previous -replace option makes this string option conditional + int differs = strcmp(*(char**) ad->argLoc, (char*) replace); + free(replace); replace = NULL; // but expires in the process + if(differs) break; // only use to replace the given string + } ASSIGN(*(char **) ad->argLoc, argValue); break; @@ -1237,10 +1253,29 @@ ParseArgs(GetFunc get, void *cl) case ArgInstall: q = *(char **) ad->argLoc; - if((saveDate == 0 || saveDate - dateStamp < 0) && !strstr(q, argValue) ) { - int l = strlen(q) + strlen(argValue); - *(char **) ad->argLoc = malloc(l+2); - snprintf(*(char **) ad->argLoc, l+2, "%s%s\n", q, argValue); + r = NULL; s = argValue; + if(argValue[0] == '#') { // group specification + r = strstr(argValue, "\\n"); + if(r) *r++ = '\n', *r++ = NULLCHAR, s = r, r = argValue; // split s into line-to-add (s) and group (r) + } + if((saveDate == 0 || saveDate - dateStamp < 0) && !strstr(q, s) ) { // not seen before, and line does not occur yet + int l = strlen(q) + strlen(s); + if(r) { // must be put in group r + char *p = strstr(q, r); + if(p) { // group already exists + p += strlen(r) - 1; // determine insertion point (immediately after group header line) + *(char **) ad->argLoc = malloc(l+2); + *p++ = NULLCHAR; // spit old value (q) at insertion point into q and p + snprintf(*(char **) ad->argLoc, l+2, "%s\n%s\n%s", q, s, p); // insert (with newline) + } else { // group did not exist, create at end + l += strlen(r) + 8; + *(char **) ad->argLoc = malloc(l); + snprintf(*(char **) ad->argLoc, l, "%s%s%s\n# end\n", q, r, s); + } + } else { // no group, just add line at end + *(char **) ad->argLoc = malloc(l+2); + snprintf(*(char **) ad->argLoc, l+2, "%s%s\n", q, s); + } free(q); } break; @@ -1403,6 +1438,9 @@ InitAppData(char *lpCmdLine) /* Parse command line */ ParseArgs(StringGet, &lpCmdLine); + /* if separate engine list is used, parse that too */ + if(*engineListFile) ParseSettingsFile(engineListFile, &engineListFile); + if(appData.viewer && appData.viewerOptions[0]) ParseArgsFromString(appData.viewerOptions); if(appData.tourney && appData.tourneyOptions[0]) ParseArgsFromString(appData.tourneyOptions); chessProgram |= GetEngineLine(firstEngineLine, 0) || GetEngineLine(secondEngineLine, 1); @@ -1413,7 +1451,11 @@ InitAppData(char *lpCmdLine) appData.NrRanks > BOARD_RANKS ) DisplayFatalError("Recompile with BOARD_RANKS or BOARD_FILES, to support this size", 0, 2); - if(!*appData.secondChessProgram) { ASSIGN(appData.secondChessProgram, appData.firstChessProgram); } // [HGM] scp defaults to fcp + if(!*appData.secondChessProgram) { // [HGM] scp defaults to fcp + ASSIGN(appData.secondChessProgram, appData.firstChessProgram); + ASSIGN(appData.secondDirectory, appData.firstDirectory); + appData.secondIsUCI = appData.firstIsUCI; // copy type too! + } /* [HGM] After parsing the options from the .ini file, and overruling them * with options from the command line, we now make an even higher priority @@ -1522,11 +1564,10 @@ SaveSettings(char* name) ArgDescriptor *ad; char dir[MSG_SIZ], buf[MSG_SIZ]; int mps = appData.movesPerSession; - TimeMark now; if (!MainWindowUp() && !autoClose) return; - GetTimeMark(&now); saveDate = now.sec; + saveDate = programStartTime.sec; GetCurrentDirectory(MSG_SIZ, dir); if(MySearchPath(installDir, name, buf)) {