blob: 31babd3a12555923f97f4056877445ccab25029d (
plain)
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
|
#pragma once
#ifdef USE_EDITLINE
#include <BString.h>
#include <Handle.h>
class Readline {
public:
Readline(const Balau::String & program);
~Readline();
Balau::String gets();
bool gotEOF();
void setPrompt(const Balau::String & prompt);
};
#endif
#ifdef USE_HISTEDIT
#include <histedit.h>
#include <BString.h>
#include <Handle.h>
class Readline {
public:
Readline(const Balau::String & program);
~Readline();
Balau::String gets();
bool gotEOF() { return m_eof; }
void setPrompt(const Balau::String & prompt);
private:
EditLine * m_el = NULL;
History * m_hist = NULL;
Balau::IO<Balau::Handle> m_in;
bool m_eof = false;
Balau::String m_prompt = "> ";
static const char * elPrompt(EditLine *);
const char * elPrompt() { return m_prompt.to_charp(); }
static int elGetCFN(EditLine *, char * c);
int elGetCFN(char * c);
};
#endif
|