+=========1.4w10UCIb21===========\r
+- Crash bug in memory command fixed\r
+- Small optimizations\r
=========1.4w10UCIb20===========\r
- More refactoring.\r
- No more polling for GUI input\r
#define PACKAGE_NAME "polyglot"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "polyglot 1.4w10UCIb20"
+#define PACKAGE_STRING "polyglot 1.4w10UCIb21"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "polyglot"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.4w10UCIb20"
+#define PACKAGE_VERSION "1.4w10UCIb21"
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
-#define VERSION "1.4w10UCIb20"
+#define VERSION "1.4w10UCIb21"
/* Define like PROTOTYPES; this can be used by system headers. */
#define __PROTOTYPES 1
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for polyglot 1.4w10UCIb20.
+# Generated by GNU Autoconf 2.61 for polyglot 1.4w10UCIb21.
#
# Report bugs to <michel.vandenbergh@uhasselt.be>.
#
# Identity of this package.
PACKAGE_NAME='polyglot'
PACKAGE_TARNAME='polyglot'
-PACKAGE_VERSION='1.4w10UCIb20'
-PACKAGE_STRING='polyglot 1.4w10UCIb20'
+PACKAGE_VERSION='1.4w10UCIb21'
+PACKAGE_STRING='polyglot 1.4w10UCIb21'
PACKAGE_BUGREPORT='michel.vandenbergh@uhasselt.be'
ac_unique_file="mainloop.cpp"
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures polyglot 1.4w10UCIb20 to adapt to many kinds of systems.
+\`configure' configures polyglot 1.4w10UCIb21 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of polyglot 1.4w10UCIb20:";;
+ short | recursive ) echo "Configuration of polyglot 1.4w10UCIb21:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-polyglot configure 1.4w10UCIb20
+polyglot configure 1.4w10UCIb21
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by polyglot $as_me 1.4w10UCIb20, which was
+It was created by polyglot $as_me 1.4w10UCIb21, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='polyglot'
- VERSION='1.4w10UCIb20'
+ VERSION='1.4w10UCIb21'
cat >>confdefs.h <<_ACEOF
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by polyglot $as_me 1.4w10UCIb20, which was
+This file was extended by polyglot $as_me 1.4w10UCIb21, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-polyglot config.status 1.4w10UCIb20
+polyglot config.status 1.4w10UCIb21
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([polyglot], [1.4w10UCIb20], [michel.vandenbergh@uhasselt.be])
+AC_INIT([polyglot], [1.4w10UCIb21], [michel.vandenbergh@uhasselt.be])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([mainloop.cpp])
AC_CONFIG_HEADER([config.h])
// constants\r
\r
\r
-static const char * const Version = "1.4W10UCIb20";\r
+static const char * const Version = "1.4W10UCIb21";\r
static const char * const HelpMessage = "\\r
SYNTAX\n\\r
* polyglot [configfile]\n\\r
FlushConsoleInputBuffer(hInput);
}
nReadEnd = 0;
+ lpFeedEnd = NULL;
InitializeCriticalSection(&CriticalSection);
hEvent=CreateEvent(NULL, // default security
FALSE, // auto reset
LeaveCriticalSection(&CriticalSection);
}
-
-
-int PipeStruct::ReadLine(void){
+int PipeStruct::ReadData(void){
DWORD dwBytes;
int ret;
- int start=0;
- int start1;
if(!bPipe){
fgets(lpReadBuffer,LINE_INPUT_MAX_CHAR,stdin);
- start=strlen(lpReadBuffer);
- if(!start){
+ dwBytes=strlen(lpReadBuffer);
+ if(!dwBytes){
set_EOF_();
lpReadBuffer[0]='\0';
+ return 0;
}
- return start;
}else{
+ // Unfortunately we need to use polling here.
+ // Otherwise Windows returns single bytes if
+ // the engine runs at low priority.
+ // This kills performance.
while(TRUE){
- // Unfortunately we need to use polling here.
- // Otherwise Windows returns single bytes if
- // the engine runs at low priority.
- // This kills performance.
- while(TRUE){
- ret=PeekNamedPipe(hInput,
- NULL, // don't read anything yet
- 0, // no buffer
- NULL, // no we don't read anything!
- &dwBytes,// now we're talking
- NULL); // nono we don't read anything
- if(!ret){
- set_EOF_();
- lpReadBuffer[0]='\0';
- return 0;
- }
- if(dwBytes>0){
- break;
- }else{
- Idle();
- }
-
- }
- ret=ReadFile(hInput,
- lpReadBuffer+start,
- LINE_INPUT_MAX_CHAR-start,
- &dwBytes,
- NULL);
+ ret=PeekNamedPipe(hInput,
+ NULL, // don't read anything yet
+ 0, // no buffer
+ NULL, // no we don't read anything!
+ &dwBytes,// now we're talking
+ NULL); // nono we don't read anything
if(!ret){
set_EOF_();
lpReadBuffer[0]='\0';
return 0;
+ }
+ if(dwBytes>0){
+ break;
}else{
- start1=start;
- start+=dwBytes;
- if (memchr(lpReadBuffer+start1, '\n', dwBytes)){
- lpReadBuffer[start]='\0';
- return start;
- }
+ Idle();
}
+
+ }
+ ret=ReadFile(hInput,
+ lpReadBuffer,
+ LINE_INPUT_MAX_CHAR,
+ &dwBytes,
+ NULL);
+ if(!ret){
+ set_EOF_();
+ lpReadBuffer[0]='\0';
+ return 0;
}
}
+ lpReadBuffer[dwBytes]='\0';
+ return dwBytes;
}
void PipeStruct::ReadInput(void) {
DWORD dwBytes;
int ret;
- ret=ReadLine();
+ BOOL bSetEvent=FALSE;
+ ret=ReadData();
EnterCriticalSection(&CriticalSection);
if(!EOF_()){
if(ret+nReadEnd>=LINE_INPUT_MAX_CHAR){
}
memcpy(lpBuffer+nReadEnd,lpReadBuffer,ret);
nReadEnd += ret;
+ if(!lpFeedEnd){
+ lpFeedEnd = (char *) memchr(lpBuffer, '\n', nReadEnd);
+ }
+ if(lpFeedEnd){
+ bSetEvent=TRUE;
+ }
}
LeaveCriticalSection(&CriticalSection);
- SetEvent(hEvent);
-}
-
-void PipeStruct::LineOutput(const char *szLineStr) const {
- DWORD dwBytes;
- int nStrLen;
- char szWriteBuffer[LINE_INPUT_MAX_CHAR];
- if(bPipe){
- nStrLen = strlen(szLineStr);
- memcpy(szWriteBuffer, szLineStr, nStrLen);
- szWriteBuffer[nStrLen] = '\r';
- szWriteBuffer[nStrLen + 1] = '\n';
- WriteFile(hOutput, szWriteBuffer, nStrLen + 2, &dwBytes, NULL);
- }else{
- printf("%s\n",szLineStr);
- fflush(stdout);
+ if(EOF_() || bSetEvent){
+ SetEvent(hEvent);
}
}
bool PipeStruct::GetBuffer(char *szLineStr) {
- char *lpFeedEnd;
int nFeedEnd;
int ret;
EnterCriticalSection(&CriticalSection);
- lpFeedEnd = (char *) memchr(lpBuffer, '\n', nReadEnd);
if (lpFeedEnd == NULL) {
ret=FALSE;
} else {
nFeedEnd ++;
nReadEnd -= nFeedEnd;
memcpy(lpBuffer, lpBuffer + nFeedEnd, nReadEnd);
+ lpFeedEnd = (char *) memchr(lpBuffer, '\n', nReadEnd);
ret=TRUE;
}
LeaveCriticalSection(&CriticalSection);
}
}
}
+
+void PipeStruct::LineOutput(const char *szLineStr) const {
+ DWORD dwBytes;
+ int nStrLen;
+ char szWriteBuffer[LINE_INPUT_MAX_CHAR];
+ if(bPipe){
+ nStrLen = strlen(szLineStr);
+ memcpy(szWriteBuffer, szLineStr, nStrLen);
+ szWriteBuffer[nStrLen] = '\r';
+ szWriteBuffer[nStrLen + 1] = '\n';
+ WriteFile(hOutput, szWriteBuffer, nStrLen + 2, &dwBytes, NULL);
+ }else{
+ printf("%s\n",szLineStr);
+ fflush(stdout);
+ }
+}
#endif
CRITICAL_SECTION CriticalSection;
volatile DWORD state;
+ volatile char * lpFeedEnd;
volatile int nReadEnd;
char lpBuffer[LINE_INPUT_MAX_CHAR];
char lpReadBuffer[LINE_INPUT_MAX_CHAR];
bool Active(void);
void set_Active(void);
void ReadInput(void);
- int ReadLine(void);
- bool CheckInput(void);
+ int ReadData(void);
bool GetBuffer(char *szLineStr);
void LineInput(char *szLineStr);
void LineOutput(const char *szLineStr) const;
Summary: A Winboard protocol to UCI protocol adapter
Name: polyglot
-Version: 1.4w10UCIb20
+Version: 1.4w10UCIb21
Release: 1
License: GPL
Group: Amusement/Games
uci->option_nb++;\r
\r
opt->value=NULL;\r
+ my_string_set(&opt->value,"<empty>");\r
opt->mode=0;\r
\r
opt->name = NULL;\r
\r
if (!my_string_empty(argument)) {\r
my_string_set(&opt->default_,argument);\r
+ my_string_set(&opt->value,argument);\r
}\r
\r
} else if (my_string_equal(option,"max")) {\r