btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / terminal / TermParse.h
blob26e57ecc787c3cfbd7567e02d2806b553a120821
1 /*
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.
8 * Authors:
9 * Kian Duffy, myob@users.sourceforge.net
10 * Siarzhuk Zharski, zharik@gmx.li
12 #ifndef TERMPARSE_H
13 #define TERMPARSE_H
16 #include "TermConst.h"
18 #include <Handler.h>
19 #include <OS.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
30 class TerminalBuffer;
32 class TermParse : public BHandler {
33 public:
34 TermParse(int fd);
35 ~TermParse();
37 status_t StartThreads(TerminalBuffer *view);
38 status_t StopThreads();
40 private:
41 inline uchar _NextParseChar();
43 // Initialize TermParse and PtyReader thread.
44 status_t _InitTermParse();
45 status_t _InitPtyReader();
47 void _StopTermParse();
48 void _StopPtyReader();
50 int32 EscParse();
51 int32 PtyReader();
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);
67 int fFd;
69 thread_id fParseThread;
70 thread_id fReaderThread;
71 sem_id fReaderSem;
72 sem_id fReaderLocker;
74 uint fBufferPosition;
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;
84 bool fQuitting;
87 #endif // TERMPARSE_H