2 * Copyright 2013, Haiku, Inc. All rights reserved.
3 * Copyright (c) 2003-4 Kian Duffy <myob@users.sourceforge.net>
4 * Parts Copyright (C) 1998,99 Kazuho Okui and Takashi Murai.
6 * Distributed under the terms of the MIT License.
9 * Kian Duffy, myob@users.sourceforge.net
10 * Siarzhuk Zharski, zharik@gmx.li
16 #include "TermConst.h"
22 #define READ_BUF_SIZE 2048
23 // pty read buffer size
24 #define MIN_PTY_BUFFER_SPACE 16
25 // minimal space left before the reader tries to read more
26 #define ESC_PARSER_BUFFER_SIZE 64
27 // size of the parser buffer
32 class TermParse
: public BHandler
{
37 status_t
StartThreads(TerminalBuffer
*view
);
38 status_t
StopThreads();
41 inline uchar
_NextParseChar();
43 // Initialize TermParse and PtyReader thread.
44 status_t
_InitTermParse();
45 status_t
_InitPtyReader();
47 void _StopTermParse();
48 void _StopPtyReader();
53 void DumpState(int *groundtable
, int *parsestate
, uchar c
);
55 static int32
_ptyreader_thread(void *);
56 static int32
_escparse_thread(void *);
58 status_t
_ReadParserBuffer();
60 void _DeviceStatusReport(int n
);
61 void _DecReqTermParms(int value
);
62 void _DecPrivateModeSet(int value
);
63 void _DecPrivateModeReset(int value
);
64 int* _GuessGroundTable(int encoding
);
65 void _ProcessOperatingSystemControls(uchar
* params
);
69 thread_id fParseThread
;
70 thread_id fReaderThread
;
75 uchar fReadBuffer
[READ_BUF_SIZE
];
76 int32 fReadBufferSize
;
78 uchar fParserBuffer
[ESC_PARSER_BUFFER_SIZE
];
79 int32 fParserBufferSize
;
80 int32 fParserBufferOffset
;
82 TerminalBuffer
*fBuffer
;