1
0
Fork 0
This commit is contained in:
Frank Celler 2015-08-12 17:20:35 +02:00
parent 9de6bd39db
commit 4a9d775061
14 changed files with 361 additions and 242 deletions

View File

@ -5,8 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -23,14 +22,14 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Jan Steemann /// @author Jan Steemann
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2009-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2009-2013, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include "ConsoleThread.h" #include "ConsoleThread.h"
#include <iostream>
#include "ApplicationServer/ApplicationServer.h" #include "ApplicationServer/ApplicationServer.h"
#include "Basics/logging.h" #include "Basics/logging.h"
#include "Basics/tri-strings.h" #include "Basics/tri-strings.h"
@ -48,13 +47,26 @@ using namespace triagens::arango;
using namespace arangodb; using namespace arangodb;
using namespace std; using namespace std;
std::atomic<V8LineEditor*> triagens::arango::serverConsole(nullptr);
triagens::basics::Mutex triagens::arango::serverConsoleMutex;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class ConsoleThread // --SECTION-- class ConsoleThread
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- static public variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief the line editor object for use in debugging
////////////////////////////////////////////////////////////////////////////////
V8LineEditor* ConsoleThread::serverConsole = nullptr;
////////////////////////////////////////////////////////////////////////////////
/// @brief mutex for console access
////////////////////////////////////////////////////////////////////////////////
Mutex ConsoleThread::serverConsoleMutex;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -64,7 +76,7 @@ triagens::basics::Mutex triagens::arango::serverConsoleMutex;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ConsoleThread::ConsoleThread (ApplicationServer* applicationServer, ConsoleThread::ConsoleThread (ApplicationServer* applicationServer,
ApplicationV8* applicationV8, ApplicationV8* applicationV8,
TRI_vocbase_t* vocbase) TRI_vocbase_t* vocbase)
: Thread("console"), : Thread("console"),
_applicationServer(applicationServer), _applicationServer(applicationServer),
@ -85,7 +97,7 @@ ConsoleThread::~ConsoleThread () {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- Thread methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -93,11 +105,12 @@ ConsoleThread::~ConsoleThread () {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void ConsoleThread::run () { void ConsoleThread::run () {
usleep(100000); usleep(100 * 1000);
// enter V8 context // enter V8 context
_context = _applicationV8->enterContext(_vocbase, true); _context = _applicationV8->enterContext(_vocbase, true);
// work
try { try {
inner(); inner();
} }
@ -105,14 +118,15 @@ void ConsoleThread::run () {
} }
catch (...) { catch (...) {
_applicationV8->exitContext(_context); _applicationV8->exitContext(_context);
_done = 1; _done = true;
_applicationServer->beginShutdown(); _applicationServer->beginShutdown();
throw; throw;
} }
// exit context
_applicationV8->exitContext(_context); _applicationV8->exitContext(_context);
_done = 1; _done = true;
_applicationServer->beginShutdown(); _applicationServer->beginShutdown();
} }
@ -150,16 +164,16 @@ void ConsoleThread::inner () {
start_pretty_print(); start_pretty_print();
(function () { (function () {
var __fs__ = require("fs"); var __fs__ = require("fs");
var __rcf__ = __fs__.join(__fs__.home(), ".arangod.rc"); var __rcf__ = __fs__.join(__fs__.home(), ".arangod.rc");
if (__fs__.exists(__rcf__)) { if (__fs__.exists(__rcf__)) {
try { try {
var __content__ = __fs__.read(__rcf__); var __content__ = __fs__.read(__rcf__);
eval(__content__); eval(__content__);
} }
catch (err) { catch (err) {
require("console").log("error in rc file '%s': %s", __rcf__, String(err.stack || err)); require("console").log("error in rc file '%s': %s", __rcf__, String(err.stack || err));
} }
} }
})(); })();
)SCRIPT"; )SCRIPT";
@ -174,7 +188,10 @@ start_pretty_print();
console.open(true); console.open(true);
serverConsole = &console; {
MUTEX_LOCKER(serverConsoleMutex);
serverConsole = &console;
}
while (! _userAborted) { while (! _userAborted) {
if (nrCommands >= gcInterval) { if (nrCommands >= gcInterval) {
@ -184,6 +201,7 @@ start_pretty_print();
string input; string input;
bool eof; bool eof;
{ {
MUTEX_LOCKER(serverConsoleMutex); MUTEX_LOCKER(serverConsoleMutex);
input = console.prompt("arangod> ", "arangod", eof); input = console.prompt("arangod> ", "arangod", eof);
@ -222,6 +240,7 @@ start_pretty_print();
} }
} }
localContext->Exit(); localContext->Exit();
throw "user aborted"; throw "user aborted";
} }
@ -229,8 +248,3 @@ start_pretty_print();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -5,8 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -23,46 +22,64 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Jan Steemann /// @author Jan Steemann
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_REST_SERVER_CONSOLE_THREAD_H #ifndef ARANGODB_REST_SERVER_CONSOLE_THREAD_H
#define ARANGODB_REST_SERVER_CONSOLE_THREAD_H 1 #define ARANGODB_REST_SERVER_CONSOLE_THREAD_H 1
#include "Basics/Common.h"
#include "Basics/Thread.h" #include "Basics/Thread.h"
#include "V8/V8LineEditor.h"
#include "V8Server/ApplicationV8.h" #include "V8Server/ApplicationV8.h"
struct TRI_vocbase_t; struct TRI_vocbase_t;
// -----------------------------------------------------------------------------
// --SECTION-- forward declarations
// -----------------------------------------------------------------------------
namespace arangodb {
class V8LineEditor;
}
namespace triagens { namespace triagens {
namespace rest { namespace rest {
class ApplicationServer; class ApplicationServer;
} }
namespace arango { namespace arango {
class ApplicationV8;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class ConsoleThread // --SECTION-- class ConsoleThread
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief the line editor object for use in debugging /// @brief ConsoleThread
////////////////////////////////////////////////////////////////////////////////
extern std::atomic<arangodb::V8LineEditor*> serverConsole;
extern triagens::basics::Mutex serverConsoleMutex;
////////////////////////////////////////////////////////////////////////////////
/// @brief ArangoDB server
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class ConsoleThread : public basics::Thread { class ConsoleThread : public basics::Thread {
private: ConsoleThread (const ConsoleThread&) = delete;
ConsoleThread (const ConsoleThread&); ConsoleThread& operator= (const ConsoleThread&) = delete;
ConsoleThread& operator= (const ConsoleThread&);
// -----------------------------------------------------------------------------
// --SECTION-- static public variables
// -----------------------------------------------------------------------------
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief the line editor object for use in debugging
////////////////////////////////////////////////////////////////////////////////
static arangodb::V8LineEditor* serverConsole;
////////////////////////////////////////////////////////////////////////////////
/// @brief mutex for console access
////////////////////////////////////////////////////////////////////////////////
static triagens::basics::Mutex serverConsoleMutex;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
@ -75,8 +92,8 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
ConsoleThread (triagens::rest::ApplicationServer*, ConsoleThread (triagens::rest::ApplicationServer*,
ApplicationV8*, ApplicationV8*,
TRI_vocbase_t*); TRI_vocbase_t*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief destructor /// @brief destructor
@ -84,6 +101,16 @@ namespace triagens {
~ConsoleThread (); ~ConsoleThread ();
// -----------------------------------------------------------------------------
// --SECTION-- Thread methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief runs the thread
////////////////////////////////////////////////////////////////////////////////
void run () override;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -95,7 +122,7 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool done () const { bool done () const {
return (_done == 1); return _done;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -114,14 +141,8 @@ namespace triagens {
return true; return true;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief runs the thread
////////////////////////////////////////////////////////////////////////////////
void run ();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private variables // --SECTION-- private methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
private: private:
@ -138,18 +159,41 @@ namespace triagens {
private: private:
////////////////////////////////////////////////////////////////////////////////
/// @brief application server
////////////////////////////////////////////////////////////////////////////////
rest::ApplicationServer* _applicationServer; rest::ApplicationServer* _applicationServer;
////////////////////////////////////////////////////////////////////////////////
/// @brief V8 dealer
////////////////////////////////////////////////////////////////////////////////
ApplicationV8* _applicationV8; ApplicationV8* _applicationV8;
////////////////////////////////////////////////////////////////////////////////
/// @brief currently used V8 context
////////////////////////////////////////////////////////////////////////////////
ApplicationV8::V8Context* _context; ApplicationV8::V8Context* _context;
////////////////////////////////////////////////////////////////////////////////
/// @brief vocbase
////////////////////////////////////////////////////////////////////////////////
TRI_vocbase_t* _vocbase; TRI_vocbase_t* _vocbase;
sig_atomic_t _done; ////////////////////////////////////////////////////////////////////////////////
/// @brief done flag
////////////////////////////////////////////////////////////////////////////////
std::atomic<bool> _done;
////////////////////////////////////////////////////////////////////////////////
/// @brief user aborted flag
////////////////////////////////////////////////////////////////////////////////
bool _userAborted; bool _userAborted;
}; };
} }
} }
@ -159,8 +203,3 @@ namespace triagens {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -30,8 +30,6 @@
#ifndef ARANGODB_V8SERVER_APPLICATION_V8_H #ifndef ARANGODB_V8SERVER_APPLICATION_V8_H
#define ARANGODB_V8SERVER_APPLICATION_V8_H 1 #define ARANGODB_V8SERVER_APPLICATION_V8_H 1
#include "Basics/Common.h"
#include "ApplicationServer/ApplicationFeature.h" #include "ApplicationServer/ApplicationFeature.h"
#include <v8.h> #include <v8.h>
@ -163,9 +161,8 @@ namespace triagens {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class ApplicationV8 : public rest::ApplicationFeature { class ApplicationV8 : public rest::ApplicationFeature {
private: ApplicationV8 (ApplicationV8 const&) = delete;
ApplicationV8 (ApplicationV8 const&) = delete; ApplicationV8& operator= (ApplicationV8 const&) = delete;
ApplicationV8& operator= (ApplicationV8 const&) = delete;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public types // --SECTION-- public types
@ -678,8 +675,3 @@ namespace triagens {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -639,36 +639,35 @@ static void JS_Debug (const v8::FunctionCallbackInfo<v8::Value>& args) {
debug, args[0]); debug, args[0]);
} }
V8LineEditor* console = triagens::arango::serverConsole.load();
MUTEX_LOCKER(ConsoleThread::serverConsoleMutex);
V8LineEditor* console = ConsoleThread::serverConsole;
if (console != nullptr) { if (console != nullptr) {
MUTEX_LOCKER(triagens::arango::serverConsoleMutex); while (true) {
if (serverConsole.load() != nullptr) { bool eof;
while (true) { string input = console->prompt("debug> ", "debug", eof);
bool eof;
string input = console->prompt("debug> ", "debug", eof);
if (eof) { if (eof) {
break; break;
} }
if (input.empty()) { if (input.empty()) {
continue; continue;
} }
console->addHistory(input); console->addHistory(input);
{ {
v8::TryCatch tryCatch; v8::TryCatch tryCatch;
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
TRI_ExecuteJavaScriptString(isolate, isolate->GetCurrentContext(), TRI_ExecuteJavaScriptString(isolate, isolate->GetCurrentContext(),
TRI_V8_STRING(input.c_str()), name, true); TRI_V8_STRING(input.c_str()), name, true);
if (tryCatch.HasCaught()) { if (tryCatch.HasCaught()) {
std::cout << TRI_StringifyV8Exception(isolate, &tryCatch); std::cout << TRI_StringifyV8Exception(isolate, &tryCatch);
} }
}
} }
} }
} }

View File

@ -1,12 +1,11 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief a basis class which defines the methods for determining /// @brief a basis class to define when an input is "complete"
/// when an input is "complete"
/// ///
/// @file /// @file
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -24,7 +23,7 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Esteban Lombeyda /// @author Esteban Lombeyda
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -35,6 +34,14 @@
namespace arangodb { namespace arangodb {
// -----------------------------------------------------------------------------
// --SECTION-- class Completer
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief Completer
////////////////////////////////////////////////////////////////////////////////
class Completer { class Completer {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -43,9 +50,17 @@ namespace arangodb {
public: public:
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
Completer () { Completer () {
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief destructor
////////////////////////////////////////////////////////////////////////////////
virtual ~Completer () { virtual ~Completer () {
} }
@ -59,16 +74,13 @@ namespace arangodb {
/// @brief check if line is complete /// @brief check if line is complete
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual bool isComplete (std::string const&, virtual bool isComplete (std::string const&, size_t lineno) = 0;
size_t lineno) = 0;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief computes all strings which begins with the given text /// @brief computes all strings which begins with the given text
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
virtual void getAlternatives (char const*, virtual std::vector<std::string> alternatives (char const*) = 0;
std::vector<std::string>&) = 0;
}; };
} }
@ -77,8 +89,3 @@ namespace arangodb {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -23,6 +23,7 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Jan Steemann
/// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -61,7 +62,7 @@ static char* CompletionGenerator (char const* text, int state) {
// compute the possible completion // compute the possible completion
if (state == 0) { if (state == 0) {
COMPLETER->getAlternatives(text, result); result = COMPLETER->alternatives(text);
LineEditor::sortAlternatives(result); LineEditor::sortAlternatives(result);
} }
@ -205,6 +206,15 @@ ReadlineShell::~ReadlineShell () {
// --SECTION-- ShellImplementation methods // --SECTION-- ShellImplementation methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief handle a signal
////////////////////////////////////////////////////////////////////////////////
void ReadlineShell::signal () {
// set the global state, so the readline input loop can react on it
setLoopState(2);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief line editor open /// @brief line editor open
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -261,12 +271,12 @@ bool ReadlineShell::close () {
bool res = writeHistory(); bool res = writeHistory();
clear_history(); clear_history();
#ifndef __APPLE__
HIST_ENTRY** hist = history_list(); HIST_ENTRY** hist = history_list();
if (hist != nullptr) { if (hist != nullptr) {
TRI_SystemFree(hist); TRI_SystemFree(hist);
} }
#endif
return res; return res;
} }
@ -369,15 +379,6 @@ string ReadlineShell::getLine (const string& prompt, bool& eof) {
return _lastInput; return _lastInput;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief handle a signal
////////////////////////////////////////////////////////////////////////////////
void ReadlineShell::signal () {
// set the global state, so the readline input loop can react on it
setLoopState(2);
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -42,6 +42,20 @@ namespace arangodb {
class ReadlineShell : public ShellImplementation { class ReadlineShell : public ShellImplementation {
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief return the currently active shell instance
////////////////////////////////////////////////////////////////////////////////
static ReadlineShell* instance () {
return _instance.load();
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors // --SECTION-- constructors and destructors
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -111,20 +125,6 @@ namespace arangodb {
void signal () override final; void signal () override final;
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
public:
////////////////////////////////////////////////////////////////////////////////
/// @brief return the currently active shell instance
////////////////////////////////////////////////////////////////////////////////
static ReadlineShell* instance () {
return _instance.load();
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -185,7 +185,6 @@ namespace arangodb {
static std::atomic<ReadlineShell*> _instance; static std::atomic<ReadlineShell*> _instance;
}; };
} }
#endif #endif

View File

@ -1,12 +1,11 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief a basis class which defines the methods for determining /// @brief shell factory
/// when an input is "complete"
/// ///
/// @file /// @file
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -24,7 +23,7 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Esteban Lombeyda /// @author Esteban Lombeyda
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -43,6 +42,18 @@
using namespace triagens; using namespace triagens;
using namespace arangodb; using namespace arangodb;
// -----------------------------------------------------------------------------
// --SECTION-- class ShellImplFactory
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a shell
////////////////////////////////////////////////////////////////////////////////
ShellImplementation* ShellImplFactory::buildShell (std::string const& history, ShellImplementation* ShellImplFactory::buildShell (std::string const& history,
Completer* completer) { Completer* completer) {
#ifdef _WIN32 #ifdef _WIN32
@ -58,6 +69,10 @@ ShellImplementation* ShellImplFactory::buildShell (std::string const& history,
#endif #endif
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not the shell will have a CTRL-C handler
////////////////////////////////////////////////////////////////////////////////
bool ShellImplFactory::hasCtrlCHandler () { bool ShellImplFactory::hasCtrlCHandler () {
#ifdef _WIN32 #ifdef _WIN32
// under Windows the readline is not compilable // under Windows the readline is not compilable
@ -74,8 +89,3 @@ bool ShellImplFactory::hasCtrlCHandler () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -1,12 +1,11 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief a basis class which defines the methods for determining /// @brief shell factory
/// when an input is "complete"
/// ///
/// @file /// @file
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -24,7 +23,7 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Esteban Lombeyda /// @author Esteban Lombeyda
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2014, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -33,13 +32,30 @@
#include "Basics/Common.h" #include "Basics/Common.h"
// -----------------------------------------------------------------------------
// --SECTION-- forward declarations
// -----------------------------------------------------------------------------
namespace arangodb { namespace arangodb {
class ShellImplementation; class ShellImplementation;
class Completer; class Completer;
}
namespace triagens { // -----------------------------------------------------------------------------
// --SECTION-- class ShellImplFactory
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief ShellImplFactory
////////////////////////////////////////////////////////////////////////////////
class ShellImplFactory { class ShellImplFactory {
ShellImplFactory () = delete;
ShellImplFactory (const ShellImplFactory&) = delete;
ShellImplFactory& operator= (const ShellImplFactory&) = delete;
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
public: public:
@ -47,22 +63,19 @@ namespace triagens {
/// @brief creates a shell /// @brief creates a shell
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static arangodb::ShellImplementation* buildShell (std::string const& history, arangodb::Completer*); static ShellImplementation* buildShell (std::string const& history,
Completer*);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not the shell will have a CTRL-C handler /// @brief whether or not the shell will have a CTRL-C handler
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static bool hasCtrlCHandler (); static bool hasCtrlCHandler ();
}; };
} }
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -66,6 +66,18 @@ ShellImplementation::ShellImplementation (string const& history,
ShellImplementation::~ShellImplementation () { ShellImplementation::~ShellImplementation () {
} }
// -----------------------------------------------------------------------------
// --SECTION-- virtual public methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief handle a signal
////////////////////////////////////////////////////////////////////////////////
void ShellImplementation::signal () {
// do nothing special
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- public methods // --SECTION-- public methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -147,14 +159,6 @@ string ShellImplementation::prompt (const string& prompt,
return line; return line;
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief handle a signal
////////////////////////////////////////////////////////////////////////////////
void ShellImplementation::signal () {
// do nothing special
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -33,6 +33,10 @@
#include "Basics/Common.h" #include "Basics/Common.h"
// -----------------------------------------------------------------------------
// --SECTION-- forward declarations
// -----------------------------------------------------------------------------
namespace arangodb { namespace arangodb {
class Completer; class Completer;
@ -96,6 +100,12 @@ namespace arangodb {
public: public:
////////////////////////////////////////////////////////////////////////////////
/// @brief handle a signal
////////////////////////////////////////////////////////////////////////////////
virtual void signal ();
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief line editor open /// @brief line editor open
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -135,12 +145,6 @@ namespace arangodb {
virtual std::string getLine (const std::string& prompt, bool& eof) = 0; virtual std::string getLine (const std::string& prompt, bool& eof) = 0;
////////////////////////////////////////////////////////////////////////////////
/// @brief handle a signal
////////////////////////////////////////////////////////////////////////////////
virtual void signal ();
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- protected variables // --SECTION-- protected variables
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -6,7 +6,6 @@
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -47,6 +46,7 @@ using namespace arangodb;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef _WIN32 #ifndef _WIN32
static void SignalHandler (int signal) { static void SignalHandler (int signal) {
// get the instance of the console // get the instance of the console
auto instance = V8LineEditor::instance(); auto instance = V8LineEditor::instance();
@ -55,12 +55,21 @@ static void SignalHandler (int signal) {
instance->signal(); instance->signal();
} }
} }
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class V8Completer // --SECTION-- class V8Completer
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- Completer methods
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
bool V8Completer::isComplete (std::string const& source, size_t lineno) { bool V8Completer::isComplete (std::string const& source, size_t lineno) {
int openParen = 0; int openParen = 0;
int openBrackets = 0; int openBrackets = 0;
@ -68,9 +77,23 @@ bool V8Completer::isComplete (std::string const& source, size_t lineno) {
int openStrings = 0; // only used for template strings, which can be multi-line int openStrings = 0; // only used for template strings, which can be multi-line
int openComments = 0; int openComments = 0;
enum line_parse_state_e {
NORMAL, // start
NORMAL_1, // from NORMAL: seen a single /
DOUBLE_QUOTE, // from NORMAL: seen a single "
DOUBLE_QUOTE_ESC, // from DOUBLE_QUOTE: seen a backslash
SINGLE_QUOTE, // from NORMAL: seen a single '
SINGLE_QUOTE_ESC, // from SINGLE_QUOTE: seen a backslash
BACKTICK, // from NORMAL: seen a single `
BACKTICK_ESC, // from BACKTICK: seen a backslash
MULTI_COMMENT, // from NORMAL_1: seen a *
MULTI_COMMENT_1, // from MULTI_COMMENT, seen a *
SINGLE_COMMENT // from NORMAL_1; seen a /
};
char const* ptr = source.c_str(); char const* ptr = source.c_str();
char const* end = ptr + source.length(); char const* end = ptr + source.length();
LineParseState state = NORMAL; line_parse_state_e state = NORMAL;
while (ptr < end) { while (ptr < end) {
if (state == DOUBLE_QUOTE) { if (state == DOUBLE_QUOTE) {
@ -214,11 +237,12 @@ bool V8Completer::isComplete (std::string const& source, size_t lineno) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief computes all strings which begins with the given text /// {@inheritDoc}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void V8Completer::getAlternatives (char const * text, vector<string> V8Completer::alternatives (char const * text) {
std::vector<std::string>& result) { vector<string> result;
// locate global object or sub-object // locate global object or sub-object
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
@ -236,14 +260,14 @@ void V8Completer::getAlternatives (char const * text,
if (! current->Has(name)) { if (! current->Has(name)) {
TRI_DestroyVectorString(&splitted); TRI_DestroyVectorString(&splitted);
return; return result;
} }
v8::Handle<v8::Value> val = current->Get(name); v8::Handle<v8::Value> val = current->Get(name);
if (! val->IsObject()) { if (! val->IsObject()) {
TRI_DestroyVectorString(&splitted); TRI_DestroyVectorString(&splitted);
return; return result;
} }
current = val->ToObject(); current = val->ToObject();
@ -319,12 +343,21 @@ void V8Completer::getAlternatives (char const * text,
} }
TRI_FreeString(TRI_CORE_MEM_ZONE, prefix); TRI_FreeString(TRI_CORE_MEM_ZONE, prefix);
return result;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class V8LineEditor // --SECTION-- class V8LineEditor
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// --SECTION-- static private variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief the active instance of the editor
////////////////////////////////////////////////////////////////////////////////
std::atomic<V8LineEditor*> V8LineEditor::_instance(nullptr); std::atomic<V8LineEditor*> V8LineEditor::_instance(nullptr);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -342,7 +375,6 @@ V8LineEditor::V8LineEditor (v8::Handle<v8::Context> context,
_completer(V8Completer()) { _completer(V8Completer()) {
// register global instance // register global instance
TRI_ASSERT(_instance.load() == nullptr); TRI_ASSERT(_instance.load() == nullptr);
_instance.store(this); _instance.store(this);
@ -359,6 +391,10 @@ V8LineEditor::~V8LineEditor () {
_instance.store(nullptr); _instance.store(nullptr);
} }
// -----------------------------------------------------------------------------
// --SECTION-- static protected methods
// -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief setup a signal handler for CTRL-C /// @brief setup a signal handler for CTRL-C
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -391,8 +427,3 @@ void V8LineEditor::initializeShell () {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -5,8 +5,7 @@
/// ///
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2015 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License. /// you may not use this file except in compliance with the License.
@ -23,60 +22,67 @@
/// Copyright holder is ArangoDB GmbH, Cologne, Germany /// Copyright holder is ArangoDB GmbH, Cologne, Germany
/// ///
/// @author Dr. Frank Celler /// @author Dr. Frank Celler
/// @author Copyright 2014, ArangoDB GmbH, Cologne, Germany /// @author Copyright 2014-2015, ArangoDB GmbH, Cologne, Germany
/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_V8_V8LINE_EDITOR_H #ifndef ARANGODB_V8_V8LINE_EDITOR_H
#define ARANGODB_V8_V8LINE_EDITOR_H 1 #define ARANGODB_V8_V8LINE_EDITOR_H 1
#include "Basics/Common.h"
#include "Utilities/LineEditor.h" #include "Utilities/LineEditor.h"
#include "Utilities/Completer.h" #include "Utilities/Completer.h"
#include <v8.h> #include <v8.h>
namespace arangodb {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- class V8Completer // --SECTION-- class V8Completer
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
namespace arangodb { ////////////////////////////////////////////////////////////////////////////////
/// @brief V8Completer
////////////////////////////////////////////////////////////////////////////////
class V8Completer : public Completer { class V8Completer : public Completer {
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
public: public:
////////////////////////////////////////////////////////////////////////////////
/// @brief constructor
////////////////////////////////////////////////////////////////////////////////
V8Completer () { V8Completer () {
} }
////////////////////////////////////////////////////////////////////////////////
/// @brief destructor
////////////////////////////////////////////////////////////////////////////////
~V8Completer () { ~V8Completer () {
} }
// -----------------------------------------------------------------------------
// --SECTION-- Completer methods
// -----------------------------------------------------------------------------
public: public:
bool isComplete (std::string const&, ////////////////////////////////////////////////////////////////////////////////
size_t lineno) override final; /// {@inheritDoc}
////////////////////////////////////////////////////////////////////////////////
void getAlternatives (char const*, bool isComplete (std::string const&, size_t lineno) override final;
std::vector<std::string>&) override final;
private: ////////////////////////////////////////////////////////////////////////////////
/// {@inheritDoc}
enum LineParseState { ////////////////////////////////////////////////////////////////////////////////
NORMAL, // start
NORMAL_1, // from NORMAL: seen a single /
DOUBLE_QUOTE, // from NORMAL: seen a single "
DOUBLE_QUOTE_ESC, // from DOUBLE_QUOTE: seen a backslash
SINGLE_QUOTE, // from NORMAL: seen a single '
SINGLE_QUOTE_ESC, // from SINGLE_QUOTE: seen a backslash
BACKTICK, // from NORMAL: seen a single `
BACKTICK_ESC, // from BACKTICK: seen a backslash
MULTI_COMMENT, // from NORMAL_1: seen a *
MULTI_COMMENT_1, // from MULTI_COMMENT, seen a *
SINGLE_COMMENT // from NORMAL_1; seen a /
};
std::vector<std::string> alternatives (char const*) override final;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -84,11 +90,10 @@ namespace arangodb {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief line editor /// @brief V8LineEditor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class V8LineEditor : public LineEditor { class V8LineEditor : public LineEditor {
V8LineEditor (LineEditor const&) = delete; V8LineEditor (LineEditor const&) = delete;
V8LineEditor& operator= (LineEditor const&) = delete; V8LineEditor& operator= (LineEditor const&) = delete;
@ -111,6 +116,12 @@ namespace arangodb {
~V8LineEditor (); ~V8LineEditor ();
// -----------------------------------------------------------------------------
// --SECTION-- static public methods
// -----------------------------------------------------------------------------
public:
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief the global instance of the editor /// @brief the global instance of the editor
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -120,23 +131,41 @@ namespace arangodb {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- protected methods // --SECTION-- static protected methods
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a concrete Shell with the correct parameter (Completer!!)
////////////////////////////////////////////////////////////////////////////////
protected: protected:
void initializeShell () override;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief setup a signal handler for CTRL-C /// @brief setup a signal handler for CTRL-C
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static void setupCtrlCHandler (); static void setupCtrlCHandler ();
// -----------------------------------------------------------------------------
// --SECTION-- protected methods
// -----------------------------------------------------------------------------
protected:
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a concrete Shell with the correct completer
////////////////////////////////////////////////////////////////////////////////
void initializeShell () override;
// -----------------------------------------------------------------------------
// --SECTION-- static private variables
// -----------------------------------------------------------------------------
private:
////////////////////////////////////////////////////////////////////////////////
/// @brief the active instance of the editor
////////////////////////////////////////////////////////////////////////////////
static std::atomic<V8LineEditor*> _instance;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- private variables // --SECTION-- private variables
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -154,14 +183,7 @@ namespace arangodb {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
V8Completer _completer; V8Completer _completer;
////////////////////////////////////////////////////////////////////////////////
/// @brief the active instance of the editor
////////////////////////////////////////////////////////////////////////////////
static std::atomic<V8LineEditor*> _instance;
}; };
} }
#endif #endif
@ -169,8 +191,3 @@ namespace arangodb {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE // --SECTION-- END-OF-FILE
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -236,12 +236,6 @@ sub formatFile ($$$) {
$line = '/// @author Dr. Oreste Costa-Panaia'; $line = '/// @author Dr. Oreste Costa-Panaia';
} }
if ($line =~ /^\/\/ outline-regexp:/) {
if ($isJavaScript == 1) {
$line = '// outline-regexp: "/// @brief\\\\|/// @addtogroup\\\\|/// @page\\\\|/// @startDocuBlock\\\\|// --SECTION--\\\\|/// @\\\\}\\\\|/\\\\*jslint"';
}
}
if ($line =~ /^[ \t]*(\/\/\/.*)$/) { if ($line =~ /^[ \t]*(\/\/\/.*)$/) {
$line = "$1"; $line = "$1";
} }
@ -387,11 +381,6 @@ sub formatFile ($$$) {
print $out "// -----------------------------------------------------------------------------\n"; print $out "// -----------------------------------------------------------------------------\n";
print $out "// --SECTION-- END-OF-FILE\n"; print $out "// --SECTION-- END-OF-FILE\n";
print $out "// -----------------------------------------------------------------------------\n"; print $out "// -----------------------------------------------------------------------------\n";
print $out "\n";
print $out "// Local Variables:\n";
print $out "// mode: outline-minor\n";
print $out "// outline-regexp: \"/// \@brief\\\\|/// {\@inheritDoc}\\\\|/// \@page\\\\|/// \@startDocuBlock\\\\|// --SECTION--\\\\|/// \@\\\\}\"\n";
print $out "// End:\n";
if (! $dryRun) { if (! $dryRun) {
close($out) close($out)