Te strtok_r function seems unknown in Cygwin, so we provided our own.
Some Windows-specific stuff was under #ifdef _MSC_VER, like that would
be the same as #ifdef WIN32. Checking for input in console mode is taken
care of. The Makefile was adapted to make MINGW compiles.
# -DDFPN build the DFPN worker of mate-problems server.
# -DDFPN_CLIENT enables the client-mode of mate-problem server.
-OPT =-DNDEBUG -DMINIMUM -DHAVE_SSE4 -msse4.1 -DDFPN -DTLP -DDFPN_CLIENT -DINANIWA_SHIFT -DMNJ_LAN -DCSA_LAN -DXBOARD -DMPV
+OPT =-DNDEBUG -DMINIMUM -DTLP -DINANIWA_SHIFT -DXBOARD -DMPV -DNO_LOGGING
help:
@echo "try targets as:"
@echo " icc-ampl"
gcc:
- $(MAKE) CC=gcc CFLAGS='-std=gnu99 -O2 -Wall $(OPT)' LDFLAG1='-lm -lpthread' bonanza
+ $(MAKE) CC=gcc CFLAGS='-std=gnu99 -O2 -Wall $(OPT) -mno-cygwin' LDFLAG1='-lm -lpthread -lwsock32 -mno-cygwin' bonanza
gcc-pgo:
$(MAKE) clean
$(MAKE) CC=icc CFLAGS='-w2 $(OPT) -std=gnu99 -O2 -ipo -prof_use -prof_dir ./profdir' LDFLAG1='-static -ipo -pthread' bonanza
bonanza : $(OBJS)
- $(CC) $(LDFLAG1) -o bonanza $(OBJS) $(LDFLAG2)
+ $(CC) $(LDFLAG1) -o bonanza $(OBJS) bres.o $(LDFLAG2)
$(OBJS) : shogi.h param.h bitop.h
dfpn.o dfpnhash.o: dfpn.h
int
stdout_normal( void )
{
-# if defined(_WIN32)
+# if defined(_MSC_VER)
HANDLE hStdout;
WORD wAttributes;
int
stdout_stress( int is_promote, int ifrom )
{
-# if defined(_WIN32)
+# if defined(_MSC_VER)
HANDLE hStdout;
WORD wAttributes;
&dwTotalBytesAvail, &dwBytesLeftThisMessage );
if ( ! bSuccess )
{
+ if( GetLastError() == 6)
+ {
+ return _kbhit();
+ }
+ Out("peek error %d\n", GetLastError());
str_error = "PeekNamedPipe() faild.";
return -1;
}
}
+#if defined(_WIN32)
+char *
+strtok_r( char *s, const char *t, char **next)
+{
+ char *p, *r;
+ if( ! s ) s = *next;
+ if( ! s ) return NULL;
+ while( *s && strchr(t, *s) ) s++;
+ if( ! *s ) return NULL;
+ r = s;
+ while( *s && ! (p = strchr(t, *s)) ) s++;
+ *next = s + 1;
+ if( ! *s ) *next = NULL;
+ *s = '\0';
+ return r;
+}
+#endif
+
int CONV
procedure( tree_t * restrict ptree )
{
#if defined(_WIN32)
# include <Winsock2.h>
-# define CONV __fastcall
+# ifdef _MSC_VER
+# define CONV __fastcall
+# else
+# define CONV
+# endif
# define SCKT_NULL INVALID_SOCKET
+# define WIN32_PIPE
typedef SOCKET sckt_t;
+char *strtok_r( char *s, const char *t, char **next);
#else