diff options
-rw-r--r-- | .gitmodules | 3 | ||||
m--------- | editline | 0 | ||||
-rw-r--r-- | includes/BReadline.h | 20 | ||||
-rw-r--r-- | src/Readline.cc | 29 |
4 files changed, 49 insertions, 3 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8aeb724 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "editline"] + path = editline + url = https://github.com/pixelxeno/editline.git diff --git a/editline b/editline new file mode 160000 +Subproject 73bd3bf3f962d74ca1295a3fc90353bf795242e diff --git a/includes/BReadline.h b/includes/BReadline.h index 0d39f8b..31babd3 100644 --- a/includes/BReadline.h +++ b/includes/BReadline.h @@ -1,12 +1,28 @@ #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, Balau::IO<Balau::Handle>); + Readline(const Balau::String & program); ~Readline(); Balau::String gets(); bool gotEOF() { return m_eof; } @@ -23,3 +39,5 @@ class Readline { static int elGetCFN(EditLine *, char * c); int elGetCFN(char * c); }; + +#endif diff --git a/src/Readline.cc b/src/Readline.cc index 9a2c791..917bb7b 100644 --- a/src/Readline.cc +++ b/src/Readline.cc @@ -3,8 +3,32 @@ using namespace Balau; -Readline::Readline(const String & program, IO<Handle> in) - : m_in(in) +#ifdef USE_EDITLINE + +Readline::Readline(const Balau::String & program) { +} + +Readline::~Readline() { +} + +Balau::String Readline::gets() { + return ""; +} + +bool Readline::gotEOF() { + return true; +} + +void Readline::setPrompt(const Balau::String & prompt) { +} + +#endif + +#ifdef USE_HISTEDIT +#include <BStdIO.h> + +Readline::Readline(const String & program) + : m_in(new StdIn()) { HistEvent ev; m_hist = history_init(); @@ -58,3 +82,4 @@ int Readline::elGetCFN(EditLine * el, char * c) { int Readline::elGetCFN(char * c) { return m_in->read(c, 1); } +#endif |