if(buf_len >= 5 && buf[buf_len-5]=='\n' && buf[buf_len-4]=='\\' &&
buf[buf_len-3]==' ' && buf[buf_len-2]==' ' && buf[buf_len-1]==' ')
buf_len -= 5; // [HGM] ICS: join continuation line of Lasker 2.2.3 server with previous
+ buf[buf_len++] = ' '; // replace by space (assumes ICS does not break lines within word)
}
buf[buf_len] = NULLCHAR;
if(appData.autoKibitz && !appData.icsEngineAnalyze ) { /* [HGM] kibitz: send most-recent PV info to ICS */
char buf[3*MSG_SIZ];
- sprintf(buf, "kibitz !!! %+.2f/%d (%.2f sec, %.0f nodes, %1.0f knps) PV=%s\n",
+ sprintf(buf, "kibitz !!! %+.2f/%d (%.2f sec, %u nodes, %1.0f knps) PV=%s\n",
programStats.score / 100.,
programStats.depth,
programStats.time / 100.,
- u64ToDouble(programStats.nodes),
- u64ToDouble(programStats.nodes) / (10*abs(programStats.time) + 1.),
+ (unsigned int)programStats.nodes,
+ (unsigned int)programStats.nodes / (10*abs(programStats.time) + 1.),
programStats.movelist);
SendToICS(buf);
}
cps->useSigint = FALSE;
cps->useSigterm = FALSE;
}
+ if (strncmp(message, "feature ", 8) == 0) { // [HGM] moved forward to pre-empt non-compliant commands
+ ParseFeatures(message+8, cps);
+ return; // [HGM] This return was missing, causing option features to be recognized as non-compliant commands!
+ }
/* [HGM] Allow engine to set up a position. Don't ask me why one would
* want this, I was asked to put it in, and obliged.
return;
}
}
- if (strncmp(message, "feature ", 8) == 0) {
- ParseFeatures(message+8, cps);
- }
if (sscanf(message, "pong %d", &cps->lastPong) == 1) {
return;
}
linelen += numlen;
/* Get move */
- strcpy(move_buffer, parseList[i]); // [HGM] pgn: print move via buffer, so it can be edited
+ strcpy(move_buffer, SavePart(parseList[i])); // [HGM] pgn: print move via buffer, so it can be edited
movelen = strlen(move_buffer); /* [HGM] pgn: line-break point before move */
+#if 0
+ // SavePart already does this!
if( i >= 0 && appData.saveExtendedInfoInPGN && pvInfoList[i].depth > 0 ) {
int p = movelen - 1;
if(move_buffer[p] == ' ') p--;
if(p && move_buffer[p-1] == ' ') move_buffer[movelen=p-1] = 0;
}
}
-
+#endif
/* Print move */
blank = linelen > 0 && movelen > 0;
if (linelen + (blank ? 1 : 0) + movelen > PGN_MAX_LINE) {
opt->min = min;
opt->max = max;
opt->type = Spin;
- } else if(p = strstr(opt->name, " -string ")) {
+ } else if((p = strstr(opt->name, " -slider "))) {
+ // for now -slider is a synonym for -spin, to already provide compatibility with future polyglots
+ if((n = sscanf(p, " -slider %d %d %d", &def, &min, &max)) < 3 ) return FALSE;
+ if(max < min) max = min; // enforce consistency
+ if(def < min) def = min;
+ if(def > max) def = max;
+ opt->value = def;
+ opt->min = min;
+ opt->max = max;
+ opt->type = Spin; // Slider;
+ } else if((p = strstr(opt->name, " -string "))) {
opt->textValue = p+9;
opt->type = TextBox;
+ } else if((p = strstr(opt->name, " -file "))) {
+ // for now -file is a synonym for -string, to already provide compatibility with future polyglots
+ opt->textValue = p+7;
+ opt->type = TextBox; // FileName;
+ } else if((p = strstr(opt->name, " -path "))) {
+ // for now -file is a synonym for -string, to already provide compatibility with future polyglots
+ opt->textValue = p+7;
+ opt->type = TextBox; // PathName;
} else if(p = strstr(opt->name, " -check ")) {
if(sscanf(p, " -check %d", &def) < 1) return FALSE;
opt->value = (def != 0);
} else if(p = strstr(opt->name, " -combo ")) {
opt->textValue = (char*) (&cps->comboList[cps->comboCnt]); // cheat with pointer type
cps->comboList[cps->comboCnt++] = q = p+8; // holds possible choices
+ if(*q == '*') cps->comboList[cps->comboCnt-1]++;
opt->value = n = 0;
while(q = StrStr(q, " /// ")) {
n++; *q = 0; // count choices, and null-terminate each of them
extern char* StripHighlight P((char *)); /* returns static data */
extern char* StripHighlightAndTitle P((char *)); /* returns static data */
-typedef enum { CheckBox, ComboBox, TextBox, Button, Spin, SaveButton } Control;
+typedef enum { CheckBox, ComboBox, TextBox, Button, Spin,
+ SaveButton, FileName, PathName, Slider, Message } Control;
typedef struct _OPT { // [HGM] options: descriptor of UCI-style option
int value; // current setting, starts as default
char egtFormats[MSG_SIZ]; /* [HGM] EGT: supported tablebase formats */
int bookSuspend; /* [HGM] book: go was deferred because of book hit */
int nrOptions; /* [HGM] options: remembered option="..." features */
-#define MAX_OPTIONS 100
+#define MAX_OPTIONS 200
Option option[MAX_OPTIONS];
int comboCnt;
char *comboList[20*MAX_OPTIONS];