-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathTTYINFO.H
142 lines (127 loc) · 4.44 KB
/
TTYINFO.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*-----------------------------------------------------------------------------
This is a part of the Microsoft Source Code Samples.
Copyright (C) 1995 Microsoft Corporation.
All rights reserved.
This source code is only intended as a supplement to
Microsoft Development Tools and/or WinHelp documentation.
See these sources for detailed information regarding the
Microsoft samples programs.
MODULE: TTYINFO.h
PURPOSE: Contains global definitions for the TTYINFO structure
-----------------------------------------------------------------------------*/
//
// constant definitions
//
//
// hard coded maximum number of ports
//
#define MAXPORTS 4
//
// terminal size
//
#define MAXROWS 50
#define MAXCOLS 80
//
// cursor states
//
#define CS_HIDE 0x00
#define CS_SHOW 0x01
//
// ascii definitions
//
#define ASCII_BEL 0x07
#define ASCII_BS 0x08
#define ASCII_LF 0x0A
#define ASCII_CR 0x0D
#define ASCII_XON 0x11
#define ASCII_XOFF 0x13
//
// data structures
//
struct TTYInfoStruct
{
HANDLE hCommPort, hReaderStatus, hWriter ;
DWORD dwEventFlags;
TCHAR Screen[MAXCOLS * MAXROWS];
CHAR chFlag, chXON, chXOFF;
WORD wXONLimit, wXOFFLimit;
DWORD fRtsControl;
DWORD fDtrControl;
BOOL fConnected, fTransferring, fRepeating,
fLocalEcho, fNewLine, fCR2CRLF,
fDisplayErrors, fAutowrap,
fCTSOutFlow, fDSROutFlow, fDSRInFlow,
fXonXoffOutFlow, fXonXoffInFlow,
fTXafterXoffSent,
fNoReading, fNoWriting, fNoEvents, fNoStatus,
fDisplayTimeouts;
BYTE bPort, bByteSize, bParity, bStopBits ;
DWORD dwBaudRate ;
WORD wCursorState ;
HFONT hTTYFont ;
LOGFONT lfTTYFont ;
DWORD rgbFGColor ;
COMMTIMEOUTS timeoutsorig;
COMMTIMEOUTS timeoutsnew;
int xSize, ySize, xScroll, yScroll, xOffset, yOffset,
nColumn, nRow, xChar, yChar , nCharPos;
} TTYInfo;
//
// macros ( for easier readability )
//
#define COMDEV( x ) (x.hCommPort)
#define CURSORSTATE( x ) (x.wCursorState)
#define PORT( x ) (x.bPort)
#define SCREEN( x ) (x.Screen)
#define CONNECTED( x ) (x.fConnected)
#define TRANSFERRING( x ) (x.fTransferring)
#define REPEATING( x ) (x.fRepeating)
#define LOCALECHO( x ) (x.fLocalEcho)
#define NEWLINE( x ) (x.fNewLine)
#define CR2CRLF( x ) (x.fCR2CRLF)
#define AUTOWRAP( x ) (x.fAutowrap)
#define BYTESIZE( x ) (x.bByteSize)
#define PARITY( x ) (x.bParity)
#define STOPBITS( x ) (x.bStopBits)
#define BAUDRATE( x ) (x.dwBaudRate)
#define HTTYFONT( x ) (x.hTTYFont)
#define LFTTYFONT( x ) (x.lfTTYFont)
#define FGCOLOR( x ) (x.rgbFGColor)
#define XSIZE( x ) (x.xSize)
#define YSIZE( x ) (x.ySize)
#define XSCROLL( x ) (x.xScroll)
#define YSCROLL( x ) (x.yScroll)
#define XOFFSET( x ) (x.xOffset)
#define YOFFSET( x ) (x.yOffset)
#define COLUMN( x ) (x.nColumn)
#define ROW( x ) (x.nRow)
#define XCHAR( x ) (x.xChar)
#define YCHAR( x ) (x.yChar)
#define DISPLAYERRORS( x ) (x.fDisplayErrors)
#define TIMEOUTSORIG( x ) (x.timeoutsorig)
#define TIMEOUTSNEW( x ) (x.timeoutsnew)
#define WRITERTHREAD( x ) (x.hWriter)
#define READSTATTHREAD( x ) (x.hReaderStatus)
#define EVENTFLAGS( x ) (x.dwEventFlags)
#define FLAGCHAR( x ) (x.chFlag)
#define SCREENCHAR( x, col, row ) (x.Screen[row * MAXCOLS + col])
#define DTRCONTROL( x ) (x.fDtrControl)
#define RTSCONTROL( x ) (x.fRtsControl)
#define XONCHAR( x ) (x.chXON)
#define XOFFCHAR( x ) (x.chXOFF)
#define XONLIMIT( x ) (x.wXONLimit)
#define XOFFLIMIT( x ) (x.wXOFFLimit)
#define CTSOUTFLOW( x ) (x.fCTSOutFlow)
#define DSROUTFLOW( x ) (x.fDSROutFlow)
#define DSRINFLOW( x ) (x.fDSRInFlow)
#define XONXOFFOUTFLOW( x ) (x.fXonXoffOutFlow)
#define XONXOFFINFLOW( x ) (x.fXonXoffInFlow)
#define TXAFTERXOFFSENT(x) (x.fTXafterXoffSent)
#define NOREADING( x ) (x.fNoReading)
#define NOWRITING( x ) (x.fNoWriting)
#define NOEVENTS( x ) (x.fNoEvents)
#define NOSTATUS( x ) (x.fNoStatus)
#define SHOWTIMEOUTS( x ) (x.fDisplayTimeouts)
//---------------------------------------------------------------------------
// End of File: ttyinfo.h
//---------------------------------------------------------------------------