Skip to content
Snippets Groups Projects
Commit 280fb18e authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Windows compatibility for clear screen.

parent dadcfced
Branches
No related merge requests found
......@@ -10,9 +10,9 @@
#include <antlr/MismatchedTokenException.hpp>
// ----------------------------------------------------------------------------
//#ifdef HAVE_LIBEDIT
#ifdef HAVE_LIBEDIT
#include <histedit.h>
//#endif
#endif
/**
* @desc A simple command line tester for testing operators
......@@ -34,6 +34,15 @@ void std_read_loop(boost::function<bool (const std::string&)>& line_cb)
}
}
int clear_screen()
{
#ifdef _WINDOWS
return std::system("cls");
#else
return std::system("clear");
#endif
}
#ifdef HAVE_LIBEDIT
const char* query_prompt(EditLine*) {
return _prompt;
......@@ -81,7 +90,7 @@ bool process_line(const std::string& line, Parser& parser)
if (line.empty() || line == "exit" || line == "quit") {
return true;
} else if (line == "clear" || line == "cls") {
if (system("clear")) {}
if (clear_screen()) {}
return false;
}
......@@ -158,7 +167,7 @@ int main(int argc, char** argv)
const Corpus2::Tagset& tagset = Corpus2::get_named_tagset(tagset_load);
Parser parser(tagset);
if (system("clear")) {
if (clear_screen()) {
//
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment