summaryrefslogtreecommitdiff
path: root/includes/BReadline.h
diff options
context:
space:
mode:
Diffstat (limited to 'includes/BReadline.h')
-rw-r--r--includes/BReadline.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/includes/BReadline.h b/includes/BReadline.h
index 6f70f09..73756c4 100644
--- a/includes/BReadline.h
+++ b/includes/BReadline.h
@@ -1 +1,24 @@
#pragma once
+
+#include <histedit.h>
+#include <BString.h>
+#include <Handle.h>
+
+class Readline {
+ public:
+ Readline(const Balau::String & program, Balau::IO<Balau::Handle>);
+ ~Readline();
+ Balau::String gets();
+ bool gotEOF() { return m_eof; }
+ void setPrompt(const Balau::String & prompt);
+ private:
+ EditLine * m_el = 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);
+};