mirror of https://gitee.com/bigwinds/arangodb
issue #972: Compilation Issue
This commit is contained in:
parent
9a368325d4
commit
e05604e5b4
|
@ -33,7 +33,7 @@
|
||||||
#include "BasicsC/files.h"
|
#include "BasicsC/files.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace triagentriagens;
|
using namespace triagens;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- class DummyShell
|
// --SECTION-- class DummyShell
|
||||||
|
@ -47,10 +47,9 @@ using namespace triagentriagens;
|
||||||
/// @brief constructs a new editor
|
/// @brief constructs a new editor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DummyShell::DummyShell (std::string const& history)
|
DummyShell::DummyShell (std::string const& history,
|
||||||
: _current(),
|
Completer* completer)
|
||||||
_historyFilename(history),
|
: ShellImplementation(history, completer) {
|
||||||
_state(STATE_NONE) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -83,29 +82,6 @@ bool DummyShell::close () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief get the history file path
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
string DummyShell::historyPath () {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief add to history
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void DummyShell::addHistory (char const* str) {
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief save history
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
bool DummyShell::writeHistory () {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief line editor prompt
|
/// @brief line editor prompt
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -137,7 +113,7 @@ char* DummyShell::prompt (char const* prompt) {
|
||||||
p = dotdot.c_str();
|
p = dotdot.c_str();
|
||||||
|
|
||||||
if (cin.eof()) {
|
if (cin.eof()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
_current += sep;
|
_current += sep;
|
||||||
|
@ -164,7 +140,7 @@ char* DummyShell::prompt (char const* prompt) {
|
||||||
// extend line and check
|
// extend line and check
|
||||||
_current += result;
|
_current += result;
|
||||||
|
|
||||||
bool ok = isComplete(_current, lineno, strlen(result));
|
bool ok = _completer->isComplete(_current, lineno, strlen(result));
|
||||||
|
|
||||||
// stop if line is complete
|
// stop if line is complete
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
@ -173,11 +149,46 @@ char* DummyShell::prompt (char const* prompt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char* line = TRI_DuplicateStringZ(TRI_UNKNOWN_MEM_ZONE, _current.c_str());
|
char* line = TRI_DuplicateStringZ(TRI_UNKNOWN_MEM_ZONE, _current.c_str());
|
||||||
|
|
||||||
_current.clear();
|
_current.clear();
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief get the history file path
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
string DummyShell::historyPath () {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief add to history
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void DummyShell::addHistory (char const* str) {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief save history
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool DummyShell::writeHistory () {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief returns the characters which the user has typed
|
||||||
|
/// @arg is the prompt of the shell
|
||||||
|
/// Note: this is the interface between our shell world and some implementation
|
||||||
|
/// of key events (linenoise, readline)
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
char* DummyShell::getLine (char const* prompt) {
|
||||||
|
return this->prompt(prompt);
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- END-OF-FILE
|
// --SECTION-- END-OF-FILE
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -39,21 +39,17 @@
|
||||||
#include "V8/v8-utils.h"
|
#include "V8/v8-utils.h"
|
||||||
|
|
||||||
namespace triagens {
|
namespace triagens {
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
class DummyShell : public ShellImplementation {
|
||||||
/// @addtogroup Shell
|
|
||||||
/// @{
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class DummyShell: public ShellImplementation {
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// public constructor, destructor
|
/// public constructor, destructor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DummyShell(string const& history, Completer *);
|
DummyShell (std::string const& history,
|
||||||
|
Completer*);
|
||||||
|
|
||||||
virtual ~DummyShell();
|
virtual ~DummyShell();
|
||||||
|
|
||||||
|
@ -61,7 +57,7 @@ namespace triagens {
|
||||||
/// @brief line editor open
|
/// @brief line editor open
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual bool open(bool autoComplete);
|
virtual bool open (bool autoComplete);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief line editor shutdown
|
/// @brief line editor shutdown
|
||||||
|
@ -69,6 +65,12 @@ namespace triagens {
|
||||||
|
|
||||||
virtual bool close();
|
virtual bool close();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief line editor prompt
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
virtual char* prompt (char const* prompt);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief get the history file path
|
/// @brief get the history file path
|
||||||
///
|
///
|
||||||
|
@ -82,7 +84,7 @@ namespace triagens {
|
||||||
/// @brief add to history
|
/// @brief add to history
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual void addHistory(const char*);
|
virtual void addHistory (const char*);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief save the history
|
/// @brief save the history
|
||||||
|
@ -97,11 +99,7 @@ namespace triagens {
|
||||||
/// of key events (linenoise, readline)
|
/// of key events (linenoise, readline)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual char * getLine(char const *);
|
virtual char* getLine (char const*);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @}
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ bool LinenoiseShell::writeHistory() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * LinenoiseShell::getLine(char const * input) {
|
char* LinenoiseShell::getLine(char const* input) {
|
||||||
return linenoise(input);
|
return linenoise(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace triagens {
|
||||||
/// of key events (linenoise, readline)
|
/// of key events (linenoise, readline)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual char * getLine(char const *);
|
virtual char* getLine (char const*);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
|
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "LinenoiseShell.h"
|
#include "LinenoiseShell.h"
|
||||||
#elif TRI_HAVE_LINENOISE
|
#elif TRI_HAVE_LINENOISE
|
||||||
#include "LinenoiseShell.h"
|
#include "LinenoiseShell.h"
|
||||||
#else
|
#elif TRI_HAVE_READLINE
|
||||||
#include "ReadlineShell.h"
|
#include "ReadlineShell.h"
|
||||||
|
#else
|
||||||
|
#include "DummyShell.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ShellImplFactory.h"
|
#include "ShellImplFactory.h"
|
||||||
|
@ -43,15 +43,19 @@
|
||||||
using namespace triagens;
|
using namespace triagens;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ShellImplementation * ShellImplFactory::buildShell (string const & history, Completer * completer) {
|
ShellImplementation* ShellImplFactory::buildShell (string const & history,
|
||||||
|
Completer* completer) {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
//under windows the readline is not compilable
|
//under windows the readline is not compilable
|
||||||
return new LinenoiseShell(history, completer);
|
return new LinenoiseShell(history, completer);
|
||||||
#elif defined TRI_HAVE_LINENOISE
|
#elif defined TRI_HAVE_LINENOISE
|
||||||
return new LinenoiseShell(history, completer);
|
return new LinenoiseShell(history, completer);
|
||||||
#else
|
#elif defined TRI_HAVE_READLINE
|
||||||
return new ReadlineShell(history, completer);
|
return new ReadlineShell(history, completer);
|
||||||
|
#else
|
||||||
|
// last resort!
|
||||||
|
return new DummyShell(history, completer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,43 +32,46 @@
|
||||||
#include "BasicsC/tri-strings.h"
|
#include "BasicsC/tri-strings.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
namespace triagens {
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- class ShellImplementation
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
namespace triagens {
|
||||||
// --SECTION-- constructors and destructors
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- class ShellImplementation
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- constructors and destructors
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief constructs a new editor
|
/// @brief constructs a new editor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ShellImplementation::ShellImplementation (string const& history, Completer * completer)
|
ShellImplementation::ShellImplementation (string const& history,
|
||||||
|
Completer* completer)
|
||||||
: _current(),
|
: _current(),
|
||||||
_historyFilename(history),
|
_historyFilename(history),
|
||||||
_state(STATE_NONE),
|
_state(STATE_NONE),
|
||||||
_completer(completer) {
|
_completer(completer) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief destructor
|
/// @brief destructor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ShellImplementation::~ShellImplementation () {
|
ShellImplementation::~ShellImplementation () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- public methods
|
// --SECTION-- public methods
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief line editor prompt
|
/// @brief line editor prompt
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
char* ShellImplementation::prompt (char const* the_prompt) {
|
char* ShellImplementation::prompt (char const* the_prompt) {
|
||||||
string dotdot;
|
string dotdot;
|
||||||
char const* p = the_prompt;
|
char const* p = the_prompt;
|
||||||
size_t len1 = strlen(the_prompt);
|
size_t len1 = strlen(the_prompt);
|
||||||
|
@ -91,11 +94,11 @@ namespace triagens {
|
||||||
|
|
||||||
p = dotdot.c_str();
|
p = dotdot.c_str();
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == nullptr) {
|
||||||
|
|
||||||
// give up, if the user pressed control-D on the top-most level
|
// give up, if the user pressed control-D on the top-most level
|
||||||
if (_current.empty()) {
|
if (_current.empty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise clear current content
|
// otherwise clear current content
|
||||||
|
@ -142,8 +145,10 @@ namespace triagens {
|
||||||
_current.clear();
|
_current.clear();
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- END-OF-FILE
|
// --SECTION-- END-OF-FILE
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -37,10 +37,13 @@
|
||||||
namespace triagens {
|
namespace triagens {
|
||||||
|
|
||||||
class ShellImplementation {
|
class ShellImplementation {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief state of the console protected types
|
/// @brief state of the console protected types
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STATE_NONE = 0,
|
STATE_NONE = 0,
|
||||||
STATE_OPENED,
|
STATE_OPENED,
|
||||||
|
@ -49,11 +52,12 @@ namespace triagens {
|
||||||
console_state_e;
|
console_state_e;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// public constructor, destructor
|
/// public constructor, destructor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ShellImplementation (std::string const& history, Completer *);
|
ShellImplementation (std::string const& history, Completer*);
|
||||||
|
|
||||||
virtual ~ShellImplementation ();
|
virtual ~ShellImplementation ();
|
||||||
|
|
||||||
|
@ -100,15 +104,11 @@ namespace triagens {
|
||||||
/// @brief todo!!
|
/// @brief todo!!
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
virtual char * getLine (const char*) = 0;
|
virtual char* getLine (const char*) = 0;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
// -----------------------------------------------------------------------------
|
||||||
/// @}
|
// --SECTION-- protected variables
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// --SECTION-- protected variables
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -134,11 +134,13 @@ namespace triagens {
|
||||||
/// @brief object which defines when the input is finished
|
/// @brief object which defines when the input is finished
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Completer * _completer;
|
Completer* _completer;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- END-OF-FILE
|
// --SECTION-- END-OF-FILE
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue