version 1.4w10UCIb17
[polyglot.git] / pipe.h
1 #ifndef PIPE_H
2 #define PIPE_H
3 #ifdef _WIN32
4 // includes
5
6 #include <windows.h>
7
8 // constants
9
10 const int LINE_INPUT_MAX_CHAR = 4096;
11
12 // defines
13
14 #define PIPE_EOF 1
15 #define PIPE_ACTIVE 2
16
17 // types
18
19 struct PipeStruct {
20
21     HANDLE hInput, hOutput;
22     HANDLE hProcess;
23     DWORD state;
24     BOOL bConsole;
25     int nBytesLeft;
26     int nReadEnd;
27     char szBuffer[LINE_INPUT_MAX_CHAR];
28
29     void Open(const char *szExecFile = NULL);
30     void Close(void) const;
31     void Kill(void) const;
32     bool EOF_(void);
33     bool Active(void);
34     void ReadInput(void);
35     bool CheckInput(void);
36     bool GetBuffer(char *szLineStr);
37     bool LineInput(char *szLineStr);
38     void LineOutput(const char *szLineStr) const;
39 }; // pipe
40
41 #endif
42 #endif