X-Git-Url: http://winboard.nl/cgi-bin?p=polyglot.git;a=blobdiff_plain;f=pipe.h;h=d24ed8ca7386b0e55ec6c14a03dd2a6a010df457;hp=a8b086bd55783bc2142efc292adeff20a869c6b0;hb=HEAD;hpb=8c255c15cc55a2e5254152c8e07a8ab45b22b7af diff --git a/pipe.h b/pipe.h index a8b086b..d24ed8c 100644 --- a/pipe.h +++ b/pipe.h @@ -10,7 +10,9 @@ // constants -const int LINE_INPUT_MAX_CHAR = 10*4096; +// This should be bigger than the maximum length of an engine output or GUI +// input line. +const int LINE_INPUT_MAX_CHAR = 40960; // defines @@ -19,13 +21,23 @@ const int LINE_INPUT_MAX_CHAR = 10*4096; // types -struct PipeStruct { - +class PipeStruct { + friend DWORD WINAPI ThreadProc(LPVOID lpParam); + public: + HANDLE hProcess; + HANDLE hEvent; + bool GetBuffer(char *szLineStr); + void LineInput(char *szLineStr); + void LineOutput(const char *szLineStr) const; + void Open(const char *szExecFile = NULL); + void Close(void) const; + void Kill(void) const; + bool Active(void); + bool EOF_(void); + private: HANDLE hInput, hOutput; FILE *fpInput; - HANDLE hProcess; HANDLE hThread; - HANDLE hEvent; BOOL bConsole; BOOL bPipe; @@ -37,18 +49,11 @@ struct PipeStruct { char lpBuffer[LINE_INPUT_MAX_CHAR]; char lpReadBuffer[LINE_INPUT_MAX_CHAR]; - void Open(const char *szExecFile = NULL); - void Close(void) const; - void Kill(void) const; - bool EOF_(void); - void set_EOF_(void); - bool Active(void); + bool EOF_input(void); + void set_EOF_input(void); void set_Active(void); void ReadInput(void); int ReadData(void); - bool GetBuffer(char *szLineStr); - void LineInput(char *szLineStr); - void LineOutput(const char *szLineStr) const; };