From e3c1aeec536798f7c615ba52c29296363f39a84e Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 16:20:46 +0100 Subject: [PATCH 01/26] fixed typo in documentation --- arangod/V8Server/v8-vocbase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index 5cdbe3c266..f2a490f2f6 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -4733,7 +4733,7 @@ static v8::Handle JS_CompletionsVocBase (v8::Arguments const& argv) { /// /// @FUN{db._create(@FA{collection-name}, @FA{properties})} /// -/// @FA{properties} must be an object, with the following attribues: +/// @FA{properties} must be an object with the following attributes: /// /// - @LIT{waitForSync} (optional, default @LIT{false}): If @LIT{true} creating /// a document will only return after the data was synced to disk. @@ -4794,7 +4794,7 @@ static v8::Handle JS_CreateDocumentCollectionVocBase (v8::Arguments c /// /// @FUN{db._createEdgeCollection(@FA{collection-name}, @FA{properties})} /// -/// @FA{properties} must be an object, with the following attribues: +/// @FA{properties} must be an object with the following attributes: /// /// - @LIT{waitForSync} (optional, default @LIT{false}): If @LIT{true} creating /// a document will only return after the data was synced to disk. From 9c87607f461a34e20fd1c62123e107f166b58e3a Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 16:21:03 +0100 Subject: [PATCH 02/26] added iterate --- .../Examples/shell_collection-truncate | 9 -- Documentation/Examples/shell_index-read | 4 - js/server/ArangoCollection.js | 117 ++++++++++++++++-- 3 files changed, 109 insertions(+), 21 deletions(-) delete mode 100644 Documentation/Examples/shell_collection-truncate delete mode 100644 Documentation/Examples/shell_index-read diff --git a/Documentation/Examples/shell_collection-truncate b/Documentation/Examples/shell_collection-truncate deleted file mode 100644 index e179ee9b0c..0000000000 --- a/Documentation/Examples/shell_collection-truncate +++ /dev/null @@ -1,9 +0,0 @@ -arango> col = db.examples; -[ArangoCollection 91022, "examples" (status new born)] -arango> col.save({ "Hallo" : "World" }); -{ "_id" : "91022/1532814", "_rev" : 1532814 } -arango> col.count(); -1 -arango> col.truncate(); -arango> col.count(); -0 diff --git a/Documentation/Examples/shell_index-read b/Documentation/Examples/shell_index-read deleted file mode 100644 index 80269b42b9..0000000000 --- a/Documentation/Examples/shell_index-read +++ /dev/null @@ -1,4 +0,0 @@ -arango> db.example.getIndexes().map(function(x) { return x.id; }); -["93013/0"] -arango> db.example.index("93013/0"); -{ "id" : "93013/0", "type" : "primary", "fields" : ["_id"] } diff --git a/js/server/ArangoCollection.js b/js/server/ArangoCollection.js index a52978f903..a2fd5fa6a2 100644 --- a/js/server/ArangoCollection.js +++ b/js/server/ArangoCollection.js @@ -38,7 +38,6 @@ var internal = require("internal"); var console = require("console"); - var ArangoDatabase = internal.ArangoDatabase; var ArangoCollection = internal.ArangoCollection; var ArangoError = internal.ArangoError; @@ -127,7 +126,7 @@ /// in a production environment. //////////////////////////////////////////////////////////////////////////////// - ArangoCollection.prototype.toArray = function() { + ArangoCollection.prototype.toArray = function () { return this.ALL(null, null).documents; }; @@ -143,10 +142,20 @@ /// /// Truncates a collection: /// -/// @verbinclude shell_collection-truncate +/// @code +/// arango> col = db.examples; +/// [ArangoCollection 91022, "examples" (status new born)] +/// arango> col.save({ "Hallo" : "World" }); +/// { "_id" : "91022/1532814", "_rev" : 1532814 } +/// arango> col.count(); +/// 1 +/// arango> col.truncate(); +/// arango> col.count(); +/// 0 +/// @endcode //////////////////////////////////////////////////////////////////////////////// - ArangoCollection.prototype.truncate = function() { + ArangoCollection.prototype.truncate = function () { return internal.db._truncate(this); }; @@ -159,10 +168,15 @@ /// /// @EXAMPLES /// -/// @verbinclude shell_index-read +/// @code +/// arango> db.example.getIndexes().map(function(x) { return x.id; }); +/// ["93013/0"] +/// arango> db.example.index("93013/0"); +/// { "id" : "93013/0", "type" : "primary", "fields" : ["_id"] } +/// @endcode //////////////////////////////////////////////////////////////////////////////// - ArangoCollection.prototype.index = function(id) { + ArangoCollection.prototype.index = function (id) { var indexes = this.getIndexes(); var i; @@ -189,11 +203,98 @@ return null; }; +//////////////////////////////////////////////////////////////////////////////// +/// @brief iterators over some elements of a collection +/// +/// @FUN{@FA{collection}.iterate(@FA{iterator}, @FA{options})} +/// +/// Iterates over some elements of the collection and apply the function +/// @FA{iterator} to the elements. The function will be called with the +/// document as first argument and the current number (starting with 0) +/// as second argument. +/// +/// @FA{options} must be an object with the following attributes: +/// +/// - @LIT{limit} (optional, default none): use at most @LIT{limit} documents. +/// +/// - @LIT{probability} (optional, default all): a number between @LIT{0} and +/// @LIT{1}. Documents are chosen with this probability. +/// +/// @EXAMPLES +/// +/// @code +/// arango> db.example.getIndexes().map(function(x) { return x.id; }); +/// ["93013/0"] +/// arango> db.example.index("93013/0"); +/// { "id" : "93013/0", "type" : "primary", "fields" : ["_id"] } +/// @endcode +//////////////////////////////////////////////////////////////////////////////// + + ArangoCollection.prototype.iterate = function (iterator, options) { + var probability = 1.0; + var limit = null; + var stmt; + var cursor; + var pos; + + if (options !== undefined) { + if (options.hasOwnProperty("probability")) { + probability = options.probability; + } + + if (options.hasOwnProperty("limit")) { + limit = options.limit; + } + } + + if (limit === null) { + if (probability >= 1.0) { + stmt = internal.sprintf("FOR d IN %s RETURN d", this.name()); + } + else { + stmt = internal.sprintf("FOR d IN %s FILTER rand() >= @prob RETURN d", this.name()); + } + } + else { + if (typeof limit !== "number") { + error = new ArangoError(); + error.errorNum = internal.errors.ERROR_ILLEGAL_NUMBER.code; + error.errorMessage = String(err); + + throw error; + } + + if (probability >= 1.0) { + stmt = internal.sprintf("FOR d IN %s LIMIT %d RETURN d", this.name(), limit); + } + else { + stmt = internal.sprintf("FOR d IN %s FILTER rand() >= @prob LIMIT %d RETURN d", this.name(), limit); + } + } + + stmt = internal.db._createStatement({ query: stmt }); + + if (probability < 1.0) { + stmt.bind("prob", probability); + } + + cursor = stmt.execute(); + pos = 0; + + while (cursor.hasNext()) { + var document = cursor.next(); + + iterator(document, pos); + + pos++; + } + }; + //////////////////////////////////////////////////////////////////////////////// /// @brief strng representation of a collection //////////////////////////////////////////////////////////////////////////////// - ArangoCollection.prototype.toString = function(seen, path, names, level) { + ArangoCollection.prototype.toString = function (seen, path, names, level) { return "[ArangoCollection " + this._id + "]"; }; @@ -214,7 +315,7 @@ /// @brief prints a collection //////////////////////////////////////////////////////////////////////////////// - ArangoCollection.prototype._PRINT = function() { + ArangoCollection.prototype._PRINT = function () { var status = "unknown"; var type = "unknown"; From 28dc56496f42d559188295f85f2fa05d206b5258 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 16:22:29 +0100 Subject: [PATCH 03/26] fixed jslint warnings --- js/server/ArangoCollection.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/server/ArangoCollection.js b/js/server/ArangoCollection.js index a2fd5fa6a2..10dbda5c4e 100644 --- a/js/server/ArangoCollection.js +++ b/js/server/ArangoCollection.js @@ -257,9 +257,9 @@ } else { if (typeof limit !== "number") { - error = new ArangoError(); + var error = new ArangoError(); error.errorNum = internal.errors.ERROR_ILLEGAL_NUMBER.code; - error.errorMessage = String(err); + error.errorMessage = "expecting a number, got " + String(limit); throw error; } @@ -268,7 +268,8 @@ stmt = internal.sprintf("FOR d IN %s LIMIT %d RETURN d", this.name(), limit); } else { - stmt = internal.sprintf("FOR d IN %s FILTER rand() >= @prob LIMIT %d RETURN d", this.name(), limit); + stmt = internal.sprintf("FOR d IN %s FILTER rand() >= @prob LIMIT %d RETURN d", + this.name(), limit); } } From 66e1d54fa10503d13619ad7ba508e9b0b7278c17 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 16:34:19 +0100 Subject: [PATCH 04/26] removed unnecessary files --- Makefile.files | 5 +---- Makefile.in | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Makefile.files b/Makefile.files index 0ea02ef88a..a114b4c7c1 100644 --- a/Makefile.files +++ b/Makefile.files @@ -13,10 +13,7 @@ JAVASCRIPT_HEADER = \ js/common/bootstrap/js-modules.h \ js/common/bootstrap/js-monkeypatches.h \ js/common/bootstrap/js-print.h \ - js/client/js-client.h \ - js/server/js-server.h \ - js/server/js-version-check.h \ - js/server/js-ahuacatl.h + js/client/js-client.h BUILT_SOURCES += $(JAVASCRIPT_HEADER) diff --git a/Makefile.in b/Makefile.in index 044c440aa5..ecf784abb5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1149,10 +1149,7 @@ JAVASCRIPT_HEADER = \ js/common/bootstrap/js-modules.h \ js/common/bootstrap/js-monkeypatches.h \ js/common/bootstrap/js-print.h \ - js/client/js-client.h \ - js/server/js-server.h \ - js/server/js-version-check.h \ - js/server/js-ahuacatl.h + js/client/js-client.h ################################################################################ From 51779b4a3e38310179b2981382b07f657848e9e3 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 17:13:13 +0100 Subject: [PATCH 05/26] fixed more jslint warnings --- Makefile.in | 2 + arangod/V8Server/ApplicationV8.cpp | 21 ++--- arangosh/V8Client/arangosh.cpp | 20 +++-- js/Makefile.files | 2 + js/server/modules/org/arangodb/actions.js | 105 ++++++++++++---------- 5 files changed, 87 insertions(+), 63 deletions(-) diff --git a/Makefile.in b/Makefile.in index ecf784abb5..0268b39ce2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1747,6 +1747,8 @@ WIKI = \ JAVASCRIPT_JSLINT = \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ + @srcdir@/js/server/modules/org/arangodb.js \ + @srcdir@/js/server/modules/org/arangodb/actions.js \ @srcdir@/js/server/ArangoCollection.js \ @srcdir@/js/server/ArangoStructure.js diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index 8dafdf1eb6..6a23938750 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -640,15 +640,16 @@ void ApplicationV8::stop () { //////////////////////////////////////////////////////////////////////////////// bool ApplicationV8::prepareV8Instance (const size_t i) { - static char const* files[] = { "common/bootstrap/modules.js", - "common/bootstrap/monkeypatches.js", - "common/bootstrap/print.js", - "common/bootstrap/errors.js", - "server/ahuacatl.js", - "server/server.js", - "server/ArangoCollection.js", - "server/ArangoStructure.js" - }; + vector files; + + files.push_back("common/bootstrap/modules.js"); + files.push_back("common/bootstrap/monkeypatches.js"); + files.push_back("common/bootstrap/print.js"); + files.push_back("common/bootstrap/errors.js"); + files.push_back("server/ahuacatl.js"); + files.push_back("server/server.js"); + files.push_back("server/ArangoCollection.js"); + files.push_back("server/ArangoStructure.js"); LOGGER_TRACE << "initialising V8 context #" << i; @@ -687,7 +688,7 @@ bool ApplicationV8::prepareV8Instance (const size_t i) { TRI_InitV8Shell(context->_context); // load all init files - for (size_t j = 0; j < sizeof(files) / sizeof(files[0]); ++j) { + for (size_t j = 0; j < files.size(); ++j) { bool ok = _startupLoader.loadScript(context->_context, files[j]); if (! ok) { diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index 3cf3e36392..8a6b402f30 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -1315,15 +1315,19 @@ int main (int argc, char* argv[]) { context->Global()->Set(v8::String::New("VALGRIND"), v8::Boolean::New((RUNNING_ON_VALGRIND) > 0)); // load all init files - char const* files[] = { - "common/bootstrap/modules.js", - "common/bootstrap/monkeypatches.js", - "common/bootstrap/print.js", - "common/bootstrap/errors.js", - "client/client.js" - }; + vector files; + + files.push_back("common/bootstrap/modules.js"); + + if (JsLint.empty()) { + files.push_back("common/bootstrap/monkeypatches.js"); + } + + files.push_back("common/bootstrap/print.js"); + files.push_back("common/bootstrap/errors.js"); + files.push_back("client/client.js"); - for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); ++i) { + for (size_t i = 0; i < files.size(); ++i) { bool ok = StartupLoader.loadScript(context, files[i]); if (ok) { diff --git a/js/Makefile.files b/js/Makefile.files index b54fde3d36..1f32cb88fb 100644 --- a/js/Makefile.files +++ b/js/Makefile.files @@ -11,6 +11,8 @@ JAVASCRIPT_JSLINT = \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ + @srcdir@/js/server/modules/org/arangodb.js \ + @srcdir@/js/server/modules/org/arangodb/actions.js \ @srcdir@/js/server/ArangoCollection.js \ @srcdir@/js/server/ArangoStructure.js diff --git a/js/server/modules/org/arangodb/actions.js b/js/server/modules/org/arangodb/actions.js index 7b8cf3e0ed..5de3d523e7 100644 --- a/js/server/modules/org/arangodb/actions.js +++ b/js/server/modules/org/arangodb/actions.js @@ -4,6 +4,7 @@ sloppy: true, vars: true, white: true, + regexp: true plusplus: true */ /*global require, exports, module */ @@ -245,7 +246,8 @@ function lookupCallbackAction (route, action) { func = module[name]; } else { - func = notImplementedFunction(route, "could not find action named '" + name + "' in module '" + joined + "'"); + func = notImplementedFunction(route, "could not find action named '" + + name + "' in module '" + joined + "'"); } } catch (err) { @@ -280,19 +282,19 @@ function lookupCallbackAction (route, action) { return { controller: function (req, res, options, next) { + var m; + // enum all HTTP methods - for (var m in httpMethods) { - if (! httpMethods.hasOwnProperty(m)) { - continue; - } + for (m in httpMethods) { + if (httpMethods.hasOwnProperty(m)) { + if (req.requestType === httpMethods[m] && module.hasOwnProperty(m)) { + func = module[m] + || errorFunction(route, + "invalid definition for " + m + " action in action controller module '" + + action.controller + "'"); - if (req.requestType == httpMethods[m] && module.hasOwnProperty(m)) { - func = module[m] - || errorFunction(route, - "invalid definition for " + m + " action in action controller module '" - + action.controller + "'"); - - return func(req, res, options, next); + return func(req, res, options, next); + } } } @@ -311,16 +313,16 @@ function lookupCallbackAction (route, action) { methods: action.methods || exports.ALL_METHODS }; } - catch (err) { + catch (err1) { if (! module.exists(action.controller)) { return notImplementedFunction(route, "cannot load/execute action controller module '" - + action.controller + ": " + String(err)); + + action.controller + ": " + String(err1)); } return errorFunction(route, "cannot load/execute action controller module '" - + action.controller + ": " + String(err)); + + action.controller + ": " + String(err1)); } } @@ -352,23 +354,24 @@ function lookupCallbackAction (route, action) { efunc = notImplementedFunction; } - return efunc(route, "cannot load prefix controller: " + String(err))(req, res, options, next); + return efunc(route, "cannot load prefix controller: " + String(err))( + req, res, options, next); } try { + var m; + // enum all HTTP methods - for (var m in httpMethods) { - if (! httpMethods.hasOwnProperty(m)) { - continue; - } + for (m in httpMethods) { + if (httpMethods.hasOwnProperty(m)) { + if (req.requestType === httpMethods[m] && module.hasOwnProperty(m)) { + func = module[m] + || errorFunction(route, + "Invalid definition for " + m + " action in prefix controller '" + + action.prefixController + "'"); - if (req.requestType == httpMethods[m] && module.hasOwnProperty(m)) { - func = module[m] - || errorFunction(route, - "Invalid definition for " + m + " action in prefix controller '" - + action.prefixController + "'"); - - return func(req, res, options, next); + return func(req, res, options, next); + } } } @@ -381,10 +384,11 @@ function lookupCallbackAction (route, action) { return func(req, res, options, next); } } - catch (err) { + catch (err2) { return errorFunction(route, "Cannot load/execute prefix controller '" - + action.prefixController + "': " + String(err))(req, res, options, next); + + action.prefixController + "': " + String(err2))( + req, res, options, next); } next(); @@ -454,7 +458,7 @@ function defineRoutePart (route, subwhere, parts, pos, constraint, callback) { var ok; part = parts[pos]; - if (part == undefined) { + if (part === undefined) { // otherwise we'll get an exception below part = ''; } @@ -558,15 +562,20 @@ function flattenRouting (routes, path, urlParameters, depth, prefix) { var cur; var i; var k; + var newUrlParameters; + var parameter; + var match; var result = []; if (routes.hasOwnProperty('exact')) { for (k in routes.exact) { if (routes.exact.hasOwnProperty(k)) { + newUrlParameters = urlParameters.shallowCopy; + cur = path + "/" + k.replace(/([\.\+\*\?\^\$\(\)\[\]])/g, "\\$1"); result = result.concat(flattenRouting(routes.exact[k], cur, - urlParameters.shallowCopy, + newUrlParameters, depth + 1, false)); } @@ -575,14 +584,14 @@ function flattenRouting (routes, path, urlParameters, depth, prefix) { if (routes.hasOwnProperty('parameters')) { for (i = 0; i < routes.parameters.length; ++i) { - var parameter = routes.parameters[i]; - var newUrlParameters = urlParameters.shallowCopy; - var match; + parameter = routes.parameters[i]; + newUrlParameters = urlParameters.shallowCopy; if (parameter.hasOwnProperty('constraint')) { var constraint = parameter.constraint; + var pattern = /\/.*\//; - if (/\/.*\//.test(constraint)) { + if (pattern.test(constraint)) { match = "/" + constraint.substr(1, constraint.length - 2); } else { @@ -804,12 +813,13 @@ function getErrorMessage (code) { function getJsonBody (req, res, code) { var body; + var err; try { body = JSON.parse(req.requestBody || "{}") || {}; } - catch (err) { - exports.resultBad(req, res, exports.ERROR_HTTP_CORRUPTED_JSON, err); + catch (err1) { + exports.resultBad(req, res, exports.ERROR_HTTP_CORRUPTED_JSON, err1); return undefined; } @@ -818,6 +828,10 @@ function getJsonBody (req, res, code) { code = exports.ERROR_HTTP_CORRUPTED_JSON; } + err = new internal.ArangoError(); + err.errorNum = code; + err.errorMessage = "expecting a valid JSON object as body"; + exports.resultBad(req, res, code, err); return undefined; } @@ -862,10 +876,10 @@ function resultError (req, res, httpReturnCode, errorNum, errorMessage, headers, } } - result["error"] = true; - result["code"] = httpReturnCode; - result["errorNum"] = errorNum; - result["errorMessage"] = errorMessage; + result.error = true; + result.code = httpReturnCode; + result.errorNum = errorNum; + result.errorMessage = errorMessage; res.body = JSON.stringify(result); @@ -1092,7 +1106,8 @@ function firstRouting (type, parts) { //////////////////////////////////////////////////////////////////////////////// function badParameter (req, res, name) { - resultError(req, res, exports.HTTP_BAD, exports.HTTP_BAD, "invalid value for parameter '" + name + "'"); + resultError(req, res, exports.HTTP_BAD, exports.HTTP_BAD, + "invalid value for parameter '" + name + "'"); } //////////////////////////////////////////////////////////////////////////////// @@ -1305,11 +1320,11 @@ function resultCursor (req, res, cursor, code, options) { }; if (cursorId) { - result["id"] = cursorId; + result.id = cursorId; } if (hasCount) { - result["count"] = count; + result.count = count; } if (code === undefined) { @@ -1378,7 +1393,7 @@ function indexNotFound (req, res, collection, index, headers) { //////////////////////////////////////////////////////////////////////////////// function resultException (req, res, err, headers) { - if (err instanceof ArangoError) { + if (err instanceof internal.ArangoError) { var num = err.errorNum; var msg = err.errorMessage; var code = exports.HTTP_BAD; From 89a7cac60522546229cd19b0d1b60e390000e675 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 22:45:09 +0100 Subject: [PATCH 06/26] added listTree --- Documentation/Makefile.files | 1 + Documentation/RefManual/JSModuleFs.md | 22 +++++ Documentation/RefManual/JSModuleFsTOC.md | 9 ++ Documentation/arango.template.in | 3 +- Makefile.in | 1 + arangod/Documentation/api-collection.dox | 18 ++-- arangod/Documentation/module-fs.dox | 53 ------------ js/common/bootstrap/modules.js | 2 + lib/BasicsC/files.c | 80 ++++++++++++++++++ lib/BasicsC/files.h | 12 +++ lib/V8/v8-utils.cpp | 100 ++++++++++++++++++++--- 11 files changed, 225 insertions(+), 76 deletions(-) create mode 100644 Documentation/RefManual/JSModuleFs.md create mode 100644 Documentation/RefManual/JSModuleFsTOC.md delete mode 100644 arangod/Documentation/module-fs.dox diff --git a/Documentation/Makefile.files b/Documentation/Makefile.files index b7752b1287..63998dad9f 100644 --- a/Documentation/Makefile.files +++ b/Documentation/Makefile.files @@ -35,6 +35,7 @@ DOXYGEN = \ Doxygen/js/common/modules/statement-basics.c \ Doxygen/js/server/modules/org/arangodb/actions.c \ Doxygen/js/server/modules/simple-query.c \ + Doxygen/js/server/ArangoCollection.c \ Doxygen/js/server/server.c ################################################################################ diff --git a/Documentation/RefManual/JSModuleFs.md b/Documentation/RefManual/JSModuleFs.md new file mode 100644 index 0000000000..3ba84428af --- /dev/null +++ b/Documentation/RefManual/JSModuleFs.md @@ -0,0 +1,22 @@ +Module "fs" {#JSModuleFs} +========================= + +@EMBEDTOC{JSModuleFsTOC} + +The implementation follows the CommonJS specification +@EXTREF{http://wiki.commonjs.org/wiki/Filesystem/A/0,Filesystem/A/0}. + +@anchor JSModuleFsExists +@copydetails JS_Exists + +@anchor JSModuleFsIsDirectory +@copydetails JS_IsDirectory + +@anchor JSModuleFsListTree +@copydetails JS_ListTree + +@anchor JSModuleFsMove +@copydetails JS_Move + +@anchor JSModuleFsRemove +@copydetails JS_Remove diff --git a/Documentation/RefManual/JSModuleFsTOC.md b/Documentation/RefManual/JSModuleFsTOC.md new file mode 100644 index 0000000000..ff11db990c --- /dev/null +++ b/Documentation/RefManual/JSModuleFsTOC.md @@ -0,0 +1,9 @@ +TOC {#JSModuleFsTOC} +==================== + +- @ref JSModuleFs + - @ref JSModuleFsExists "fs.exists" + - @ref JSModuleFsIsDirectory "fs.isDirectory" + - @ref JSModuleFsListTree "fs.listTree" + - @ref JSModuleFsMove "fs.move" + - @ref JSModuleFsRemove "fs.remove" diff --git a/Documentation/arango.template.in b/Documentation/arango.template.in index 21b4c13f70..143b30e247 100644 --- a/Documentation/arango.template.in +++ b/Documentation/arango.template.in @@ -723,7 +723,8 @@ WARN_LOGFILE = INPUT = @srcdir@/Documentation/DbaManual \ @srcdir@/Documentation/InstallationManual \ @srcdir@/Documentation/Manual \ - @srcdir@/Documentation/UserManual \ + @srcdir@/Documentation/RefManual \ + @srcdir@/Documentation/UserManual \ @srcdir@/Doxygen/js \ @srcdir@/arangod \ @srcdir@/lib diff --git a/Makefile.in b/Makefile.in index 0268b39ce2..955874796f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1672,6 +1672,7 @@ DOXYGEN = \ Doxygen/js/common/modules/statement-basics.c \ Doxygen/js/server/modules/org/arangodb/actions.c \ Doxygen/js/server/modules/simple-query.c \ + Doxygen/js/server/ArangoCollection.c \ Doxygen/js/server/server.c diff --git a/arangod/Documentation/api-collection.dox b/arangod/Documentation/api-collection.dox index 6cf400c3b1..f376d4a21f 100644 --- a/arangod/Documentation/api-collection.dox +++ b/arangod/Documentation/api-collection.dox @@ -113,37 +113,37 @@ /////////////////////////////////////////////////////////////////////////// /// /// @anchor HttpCollectionCreate -/// @copydetails JSF_POST_api_collection +/// @copydetails JSF_post_api_collection /// /// @anchor HttpCollectionDelete -/// @copydetails JSF_DELETE_api_collection +/// @copydetails JSF_delete_api_collection /// /// @anchor HttpCollectionTruncate -/// @copydetails JSF_PUT_api_collection_truncate +/// @copydetails JSF_put_api_collection_truncate /// /// @subsection HttpCollectionReading Getting Information about a Collection //////////////////////////////////////////////////////////////////////////// /// /// @anchor HttpCollectionRead -/// @copydetails JSF_GET_api_collection +/// @copydetails JSF_get_api_collection /// /// @anchor HttpCollectionReadAll -/// @copydetails JSF_GET_api_collections +/// @copydetails JSF_get_api_collections /// /// @subsection HttpCollectionChanging Modifying a Collection ///////////////////////////////////////////////////////////// /// /// @anchor HttpCollectionLoad -/// @copydetails JSF_PUT_api_collection_load +/// @copydetails JSF_put_api_collection_load /// /// @anchor HttpCollectionUnload -/// @copydetails JSF_PUT_api_collection_unload +/// @copydetails JSF_put_api_collection_unload /// /// @anchor HttpCollectionProperties -/// @copydetails JSF_PUT_api_collection_properties +/// @copydetails JSF_put_api_collection_properties /// /// @anchor HttpCollectionRename -/// @copydetails JSF_PUT_api_collection_rename +/// @copydetails JSF_put_api_collection_rename //////////////////////////////////////////////////////////////////////////////// // Local Variables: diff --git a/arangod/Documentation/module-fs.dox b/arangod/Documentation/module-fs.dox deleted file mode 100644 index e61a9dc2b8..0000000000 --- a/arangod/Documentation/module-fs.dox +++ /dev/null @@ -1,53 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// @brief module "fs" -/// -/// @file -/// -/// DISCLAIMER -/// -/// Copyright 2012 triAGENS GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is triAGENS GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleFsTOC -/// -///
    -///
  1. @ref JSModuleFsExists "fs.exists"
  2. -///
-//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @page JSModuleFs Module "fs" -/// -/// The implementation follows the CommonJS specification -/// Filesystem/A/0. -/// -///
-/// @copydoc JSModuleFsTOC -///
-/// -/// @anchor JSModuleFsExists -/// @copydetails JS_Exists -//////////////////////////////////////////////////////////////////////////////// - -// Local Variables: -// mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" -// End: diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index 1fe20a8c42..a71e69205a 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -273,6 +273,8 @@ Module.prototype.ModuleCache["/fs"] = new Module("/fs"); var fs = Module.prototype.ModuleCache["/fs"].exports; fs.exists = FS_EXISTS; + fs.isDirectory = FS_IS_DIRECTORY; + fs.listTree = FS_LIST_TREE; fs.move = FS_MOVE; fs.remove = FS_REMOVE; }()); diff --git a/lib/BasicsC/files.c b/lib/BasicsC/files.c index d2b1f92a3c..ee80031edb 100755 --- a/lib/BasicsC/files.c +++ b/lib/BasicsC/files.c @@ -158,6 +158,58 @@ static void InitialiseLockFiles (void) { Initialised = true; } +//////////////////////////////////////////////////////////////////////////////// +/// @brief lists the directory tree +//////////////////////////////////////////////////////////////////////////////// + +static void ListTreeRecursively (char const* full, + char const* path, + TRI_vector_string_t* result) { + size_t i; + size_t j; + TRI_vector_string_t dirs = TRI_FilesDirectory(full); + + for (j = 0; j < 2; ++j) { + for (i = 0; i < dirs._length; ++i) { + char const* filename = dirs._buffer[i]; + char* newfull = TRI_Concatenate2File(full, filename); + char* newpath; + + if (*path) { + newpath = TRI_Concatenate2File(path, filename); + } + else { + newpath = TRI_DuplicateString(filename); + } + + if (j == 0) { + if (TRI_IsDirectory(newfull)) { + TRI_PushBackVectorString(result, newpath); + + if (! TRI_IsSymbolicLink(newfull)) { + ListTreeRecursively(newfull, newpath, result); + } + } + else { + TRI_FreeString(TRI_CORE_MEM_ZONE, newpath); + } + } + else { + if (! TRI_IsDirectory(newfull)) { + TRI_PushBackVectorString(result, newpath); + } + else { + TRI_FreeString(TRI_CORE_MEM_ZONE, newpath); + } + } + + TRI_FreeString(TRI_CORE_MEM_ZONE, newfull); + } + } + + TRI_DestroyVectorString(&dirs); +} + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// @@ -214,6 +266,19 @@ bool TRI_IsDirectory (char const* path) { return (res == 0) && ((stbuf.st_mode & S_IFMT) == S_IFDIR); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if path is a symbolic link +//////////////////////////////////////////////////////////////////////////////// + +bool TRI_IsSymbolicLink (char const* path) { + struct stat stbuf; + int res; + + res = lstat(path, &stbuf); + + return (res == 0) && ((stbuf.st_mode & S_IFMT) == S_IFLNK); +} + //////////////////////////////////////////////////////////////////////////////// /// @brief checks if file exists //////////////////////////////////////////////////////////////////////////////// @@ -498,6 +563,21 @@ TRI_vector_string_t TRI_FilesDirectory (char const* path) { #endif +//////////////////////////////////////////////////////////////////////////////// +/// @brief lists the directory tree including files and directories +//////////////////////////////////////////////////////////////////////////////// + +TRI_vector_string_t TRI_FullTreeDirectory (char const* path) { + TRI_vector_string_t result; + + TRI_InitVectorString(&result, TRI_CORE_MEM_ZONE); + + TRI_PushBackVectorString(&result, TRI_DuplicateString("")); + ListTreeRecursively(path, "", &result); + + return result; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief renames a file //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/BasicsC/files.h b/lib/BasicsC/files.h index ddd8c5920f..f37905ba7b 100644 --- a/lib/BasicsC/files.h +++ b/lib/BasicsC/files.h @@ -61,6 +61,12 @@ bool TRI_SetCloseOnExecFile (socket_t fd); bool TRI_IsDirectory (char const* path); +//////////////////////////////////////////////////////////////////////////////// +/// @brief checks if path is a symbolic link +//////////////////////////////////////////////////////////////////////////////// + +bool TRI_IsSymbolicLink (char const* path); + //////////////////////////////////////////////////////////////////////////////// /// @brief checks if file exists //////////////////////////////////////////////////////////////////////////////// @@ -115,6 +121,12 @@ char* TRI_Concatenate3File (char const* path1, char const* path2, char const* na TRI_vector_string_t TRI_FilesDirectory (char const* path); +//////////////////////////////////////////////////////////////////////////////// +/// @brief lists the directory tree including files and directories +//////////////////////////////////////////////////////////////////////////////// + +TRI_vector_string_t TRI_FullTreeDirectory (char const* path); + //////////////////////////////////////////////////////////////////////////////// /// @brief renames a file //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/V8/v8-utils.cpp b/lib/V8/v8-utils.cpp index 258253bdbe..00f8935d62 100644 --- a/lib/V8/v8-utils.cpp +++ b/lib/V8/v8-utils.cpp @@ -712,7 +712,7 @@ static v8::Handle JS_Execute (v8::Arguments const& argv) { //////////////////////////////////////////////////////////////////////////////// /// @brief checks if a file of any type or directory exists /// -/// @FUN{fs.exists(@FA{filename})} +/// @FUN{fs.exists(@FA{path})} /// /// Returns true if a file (of any type) or a directory exists at a given /// path. If the file is a broken symbolic link, returns false. @@ -748,6 +748,72 @@ static v8::Handle JS_Getline (v8::Arguments const& argv) { return scope.Close(v8::String::New(line.c_str(), line.size())); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief tests if path is a directory +/// +/// @FUN{fs.isDirectory(@FA{path})} +/// +/// Returns true if the @FA{path} points to a directory. +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle JS_IsDirectory (v8::Arguments const& argv) { + v8::HandleScope scope; + + // extract arguments + if (argv.Length() != 1) { + return scope.Close(v8::ThrowException(v8::String::New("usage: isDirectory()"))); + } + + TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]); + + if (*name == 0) { + return scope.Close(v8::ThrowException(v8::String::New(" must be a string"))); + } + + // return result + return scope.Close(TRI_IsDirectory(*name) ? v8::True() : v8::False()); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief returns the directory tree +/// +/// @FUN{fs.listTree(@FA{path})} +/// +/// The function returns an array that starts with the given path, and all of +/// the paths relative to the given path, discovered by a depth first traversal +/// of every directory in any visited directory, reporting but not traversing +/// symbolic links to directories. The first path is always @LIT{""}, the path +/// relative to itself. +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle JS_ListTree (v8::Arguments const& argv) { + v8::HandleScope scope; + + // extract arguments + if (argv.Length() != 1) { + return scope.Close(v8::ThrowException(v8::String::New("usage: listTree()"))); + } + + TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]); + + if (*name == 0) { + return scope.Close(v8::ThrowException(v8::String::New(" must be a string"))); + } + + // constructed listing + v8::Handle result = v8::Array::New(); + TRI_vector_string_t list = TRI_FullTreeDirectory(*name); + + for (size_t i = 0; i < list._length; ++i) { + result->Set(i, v8::String::New(list._buffer[i])); + } + + TRI_DestroyVectorString(&list); + + // return result + return scope.Close(result); +} + //////////////////////////////////////////////////////////////////////////////// /// @brief reads a file and executes it /// @@ -1666,6 +1732,26 @@ void TRI_InitV8Utils (v8::Handle context, string const& path) { // create the global functions // ............................................................................. + context->Global()->Set(v8::String::New("FS_EXISTS"), + v8::FunctionTemplate::New(JS_Exists)->GetFunction(), + v8::ReadOnly); + + context->Global()->Set(v8::String::New("FS_IS_DIRECTORY"), + v8::FunctionTemplate::New(JS_IsDirectory)->GetFunction(), + v8::ReadOnly); + + context->Global()->Set(v8::String::New("FS_LIST_TREE"), + v8::FunctionTemplate::New(JS_ListTree)->GetFunction(), + v8::ReadOnly); + + context->Global()->Set(v8::String::New("FS_MOVE"), + v8::FunctionTemplate::New(JS_Move)->GetFunction(), + v8::ReadOnly); + + context->Global()->Set(v8::String::New("FS_REMOVE"), + v8::FunctionTemplate::New(JS_Remove)->GetFunction(), + v8::ReadOnly); + context->Global()->Set(v8::String::New("SYS_PARSE"), v8::FunctionTemplate::New(JS_Parse)->GetFunction(), v8::ReadOnly); @@ -1678,10 +1764,6 @@ void TRI_InitV8Utils (v8::Handle context, string const& path) { v8::FunctionTemplate::New(JS_Execute)->GetFunction(), v8::ReadOnly); - context->Global()->Set(v8::String::New("FS_EXISTS"), - v8::FunctionTemplate::New(JS_Exists)->GetFunction(), - v8::ReadOnly); - context->Global()->Set(v8::String::New("SYS_GETLINE"), v8::FunctionTemplate::New(JS_Getline)->GetFunction(), v8::ReadOnly); @@ -1698,14 +1780,6 @@ void TRI_InitV8Utils (v8::Handle context, string const& path) { v8::FunctionTemplate::New(JS_LogLevel)->GetFunction(), v8::ReadOnly); - context->Global()->Set(v8::String::New("FS_MOVE"), - v8::FunctionTemplate::New(JS_Move)->GetFunction(), - v8::ReadOnly); - - context->Global()->Set(v8::String::New("FS_REMOVE"), - v8::FunctionTemplate::New(JS_Remove)->GetFunction(), - v8::ReadOnly); - context->Global()->Set(v8::String::New("SYS_OUTPUT"), v8::FunctionTemplate::New(JS_Output)->GetFunction(), v8::ReadOnly); From 7be1c01bda8c32976412a7dc4f6b670a8aaa9cf9 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 23:24:10 +0100 Subject: [PATCH 07/26] removed linked in JavaScript code, separate files for 'fs' and 'console' --- Makefile.am | 3 +- Makefile.files | 13 - Makefile.in | 32 +-- arangod/V8Server/ApplicationV8.cpp | 2 + arangosh/V8Client/arangosh.cpp | 23 +- config/js2c.sh | 11 - etc/arangodb/arangosh.conf.in | 1 + etc/relative/arangosh.conf | 1 + js/Makefile.files | 13 +- js/actions/system/api-system.js | 340 +++++++++++++------------- js/common/bootstrap/module-console.js | 188 ++++++++++++++ js/common/bootstrap/module-fs.js | 74 ++++++ js/common/bootstrap/modules.js | 244 +++++------------- js/common/modules/jslint.js | 2 +- js/common/modules/jsunity.js | 4 +- js/server/version-check.js | 8 +- 16 files changed, 513 insertions(+), 446 deletions(-) delete mode 100755 config/js2c.sh create mode 100644 js/common/bootstrap/module-console.js create mode 100644 js/common/bootstrap/module-fs.js diff --git a/Makefile.am b/Makefile.am index 3161a009cd..52517c8b4c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -324,8 +324,7 @@ clean-local: built-sources: \ build_posix.h \ - @top_srcdir@/js/common/bootstrap/errors.js \ - $(JAVASCRIPT_HEADER) + @top_srcdir@/js/common/bootstrap/errors.js ################################################################################ ### @brief tags file diff --git a/Makefile.files b/Makefile.files index a114b4c7c1..f5ff1d4074 100644 --- a/Makefile.files +++ b/Makefile.files @@ -4,19 +4,6 @@ ## --SECTION-- JAVASCRIPT ## ----------------------------------------------------------------------------- -################################################################################ -### @brief JavaScript source code as header -################################################################################ - -JAVASCRIPT_HEADER = \ - js/common/bootstrap/js-errors.h \ - js/common/bootstrap/js-modules.h \ - js/common/bootstrap/js-monkeypatches.h \ - js/common/bootstrap/js-print.h \ - js/client/js-client.h - -BUILT_SOURCES += $(JAVASCRIPT_HEADER) - ################################################################################ ### @brief JavaScript modules for browser ################################################################################ diff --git a/Makefile.in b/Makefile.in index 955874796f..1d81ce9253 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,7 +23,7 @@ # -*- mode: Makefile; -*- ################################################################################ -### @brief JavaScript source code as header +### @brief JavaScript modules for browser ################################################################################ # -*- mode: Makefile; -*- @@ -995,8 +995,7 @@ top_srcdir = @top_srcdir@ ################################################################################ ### @brief sets up the directories ################################################################################ -BUILT_SOURCES = build_posix.h $(JAVASCRIPT_HEADER) \ - $(JAVASCRIPT_BROWSER) $(am__append_9) \ +BUILT_SOURCES = build_posix.h $(JAVASCRIPT_BROWSER) $(am__append_9) \ etc/arangodb/arangod.conf etc/arangodb/arangoirb.conf \ etc/arangodb/arangosh.conf $(am__append_14) \ Doxygen/.setup-directories @builddir@/.setup-js-directories \ @@ -1144,17 +1143,6 @@ nobase_pkgdata_DATA = $(shell find @srcdir@/js/actions -name "*.js" \ -print) $(shell find @srcdir@/html -name "*.js" -print) \ $(shell find @srcdir@/html -name "*.png" -print) \ $(am__append_8) -JAVASCRIPT_HEADER = \ - js/common/bootstrap/js-errors.h \ - js/common/bootstrap/js-modules.h \ - js/common/bootstrap/js-monkeypatches.h \ - js/common/bootstrap/js-print.h \ - js/client/js-client.h - - -################################################################################ -### @brief JavaScript modules for browser -################################################################################ JAVASCRIPT_BROWSER = \ html/admin/js/modules/statement-basics.js \ html/admin/js/modules/simple-query-basics.js \ @@ -1748,6 +1736,8 @@ WIKI = \ JAVASCRIPT_JSLINT = \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ + @srcdir@/js/common/bootstrap/module-console.js \ + @srcdir@/js/common/bootstrap/module-fs.js \ @srcdir@/js/server/modules/org/arangodb.js \ @srcdir@/js/server/modules/org/arangodb/actions.js \ @srcdir@/js/server/ArangoCollection.js \ @@ -5398,8 +5388,7 @@ clean-local: built-sources: \ build_posix.h \ - @top_srcdir@/js/common/bootstrap/errors.js \ - $(JAVASCRIPT_HEADER) + @top_srcdir@/js/common/bootstrap/errors.js GTAGS: echo $(GTAGS_FILES) | tr " " "\n" | gtags -i -f - @@ -5560,8 +5549,6 @@ jslint: @builddir@/.setup-js-directories: @test -d html/admin/js/modules || mkdir -p html/admin/js/modules - @test -d js/common/bootstrap || mkdir -p js/common/bootstrap - @test -d js/client || mkdir -p js/client @touch $@ ################################################################################ @@ -5574,15 +5561,6 @@ html/admin/js/modules/%.js: @srcdir@/js/common/modules/%.js .setup-js-directorie html/admin/js/modules/%.js: @srcdir@/js/client/modules/%.js .setup-js-directories (echo "module.define(\"`basename $< .js`\", function(exports, module) {" && cat $< && echo "});") > $@ -js/js-%.h: @srcdir@/js/%.js .setup-js-directories - @top_srcdir@/config/js2c.sh $< > $@ - -js/client/js-%.h: @srcdir@/js/client/%.js .setup-js-directories - @top_srcdir@/config/js2c.sh $< > $@ - -js/common/bootstrap/js-%.h: @srcdir@/js/common/bootstrap/%.js .setup-js-directories - @top_srcdir@/config/js2c.sh $< > $@ - @ENABLE_MRUBY_TRUE@@builddir@/.setup-mr-directories: @ENABLE_MRUBY_TRUE@ @test -d mr/common/bootstrap || mkdir -p mr/common/bootstrap @ENABLE_MRUBY_TRUE@ @test -d mr/server || mkdir -p mr/server diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index 6a23938750..7afebac790 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -643,6 +643,8 @@ bool ApplicationV8::prepareV8Instance (const size_t i) { vector files; files.push_back("common/bootstrap/modules.js"); + files.push_back("common/bootstrap/module-fs.js"); + files.push_back("common/bootstrap/module-console.js"); files.push_back("common/bootstrap/monkeypatches.js"); files.push_back("common/bootstrap/print.js"); files.push_back("common/bootstrap/errors.js"); diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index 8a6b402f30..92d195084f 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -62,12 +62,6 @@ using namespace triagens::httpclient; using namespace triagens::v8client; using namespace triagens::arango; -#include "js/common/bootstrap/js-print.h" -#include "js/common/bootstrap/js-modules.h" -#include "js/common/bootstrap/js-monkeypatches.h" -#include "js/common/bootstrap/js-errors.h" -#include "js/client/js-client.h" - // ----------------------------------------------------------------------------- // --SECTION-- private variables // ----------------------------------------------------------------------------- @@ -1300,17 +1294,14 @@ int main (int argc, char* argv[]) { // load java script from js/bootstrap/*.h files if (StartupPath.empty()) { - StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); - StartupLoader.defineScript("common/bootstrap/monkeypatches.js", JS_common_bootstrap_monkeypatches); - StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); - StartupLoader.defineScript("common/bootstrap/errors.js", JS_common_bootstrap_errors); - StartupLoader.defineScript("client/client.js", JS_client_client); - } - else { - LOGGER_DEBUG << "using JavaScript startup files at '" << StartupPath << "'"; - StartupLoader.setDirectory(StartupPath); + LOGGER_FATAL << "no 'javascript.startup-directory' has been supplied, giving up"; + TRI_FlushLogging(); + exit(EXIT_FAILURE); } + LOGGER_DEBUG << "using JavaScript startup files at '" << StartupPath << "'"; + StartupLoader.setDirectory(StartupPath); + context->Global()->Set(v8::String::New("ARANGO_QUIET"), v8::Boolean::New(BaseClient.quiet()), v8::ReadOnly); context->Global()->Set(v8::String::New("VALGRIND"), v8::Boolean::New((RUNNING_ON_VALGRIND) > 0)); @@ -1318,6 +1309,8 @@ int main (int argc, char* argv[]) { vector files; files.push_back("common/bootstrap/modules.js"); + files.push_back("common/bootstrap/module-fs.js"); + files.push_back("common/bootstrap/module-console.js"); if (JsLint.empty()) { files.push_back("common/bootstrap/monkeypatches.js"); diff --git a/config/js2c.sh b/config/js2c.sh deleted file mode 100755 index 5604c0ad7d..0000000000 --- a/config/js2c.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -NAME=`echo $1 | sed -e 's:^\(.*/\)*js/\(.*\)\.js$:\2:' | tr "/-" "__"` - -#cat $1 \ -# | sed -e 's:\(["\]\):\\\1:g' \ -# | awk 'BEGIN {print "static string JS_'$NAME' = string(\"\") " } { print " + \"" $0 "\\n\"" } END { print ";"}' - -cat $1 \ - | sed -e 's:\(["\]\):\\\1:g' \ - | awk 'BEGIN {print "const char* JS_'$NAME'[] = {" } { print " \"" $0 "\"," } END { print " \"//__end__\"\n};"}' - diff --git a/etc/arangodb/arangosh.conf.in b/etc/arangodb/arangosh.conf.in index 8499d72ef7..b2b6e744a6 100644 --- a/etc/arangodb/arangosh.conf.in +++ b/etc/arangodb/arangosh.conf.in @@ -2,4 +2,5 @@ endpoint = tcp://localhost:8529 [javascript] +startup-directory = @PKGDATADIR@/js modules-path = @PKGDATADIR@/js/client/modules;@PKGDATADIR@/js/common/modules diff --git a/etc/relative/arangosh.conf b/etc/relative/arangosh.conf index 3668d48d26..b54f1069f4 100644 --- a/etc/relative/arangosh.conf +++ b/etc/relative/arangosh.conf @@ -1,2 +1,3 @@ [javascript] +startup-directory = ./js modules-path = ./js/client/modules;./js/common/modules diff --git a/js/Makefile.files b/js/Makefile.files index 1f32cb88fb..cad56fa06c 100644 --- a/js/Makefile.files +++ b/js/Makefile.files @@ -11,6 +11,8 @@ JAVASCRIPT_JSLINT = \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ + @srcdir@/js/common/bootstrap/module-console.js \ + @srcdir@/js/common/bootstrap/module-fs.js \ @srcdir@/js/server/modules/org/arangodb.js \ @srcdir@/js/server/modules/org/arangodb/actions.js \ @srcdir@/js/server/ArangoCollection.js \ @@ -41,8 +43,6 @@ BUILT_SOURCES += @builddir@/.setup-js-directories @builddir@/.setup-js-directories: @test -d html/admin/js/modules || mkdir -p html/admin/js/modules - @test -d js/common/bootstrap || mkdir -p js/common/bootstrap - @test -d js/client || mkdir -p js/client @touch $@ ################################################################################ @@ -55,15 +55,6 @@ html/admin/js/modules/%.js: @srcdir@/js/common/modules/%.js .setup-js-directorie html/admin/js/modules/%.js: @srcdir@/js/client/modules/%.js .setup-js-directories (echo "module.define(\"`basename $< .js`\", function(exports, module) {" && cat $< && echo "});") > $@ -js/js-%.h: @srcdir@/js/%.js .setup-js-directories - @top_srcdir@/config/js2c.sh $< > $@ - -js/client/js-%.h: @srcdir@/js/client/%.js .setup-js-directories - @top_srcdir@/config/js2c.sh $< > $@ - -js/common/bootstrap/js-%.h: @srcdir@/js/common/bootstrap/%.js .setup-js-directories - @top_srcdir@/config/js2c.sh $< > $@ - ################################################################################ ### @brief cleanup ################################################################################ diff --git a/js/actions/system/api-system.js b/js/actions/system/api-system.js index ac42cf274c..b131a6c51a 100644 --- a/js/actions/system/api-system.js +++ b/js/actions/system/api-system.js @@ -34,10 +34,9 @@ /// @author Copyright 2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -(function() { - var actions = require("org/arangodb/actions"); - var internal = require("internal"); - var console = require("internal"); +var actions = require("org/arangodb/actions"); +var internal = require("internal"); +var console = require("internal"); // ----------------------------------------------------------------------------- // --SECTION-- standard routing @@ -52,102 +51,102 @@ /// @brief routing function //////////////////////////////////////////////////////////////////////////////// - function Routing (req, res) { - var action; - var execute; - var next; - var path = req.suffix.join("/"); +function Routing (req, res) { + var action; + var execute; + var next; + var path = req.suffix.join("/"); - action = actions.firstRouting(req.requestType, req.suffix); + action = actions.firstRouting(req.requestType, req.suffix); - execute = function () { - if (action.route === undefined) { - actions.resultNotImplemented(req, res, "unknown path '" + path + "'"); - return; - } + execute = function () { + if (action.route === undefined) { + actions.resultNotImplemented(req, res, "unknown path '" + path + "'"); + return; + } - if (action.route.path !== undefined) { - req.path = action.route.path; - } - else { - delete req.path; - } + if (action.route.path !== undefined) { + req.path = action.route.path; + } + else { + delete req.path; + } - if (action.prefix !== undefined) { - req.prefix = action.prefix; - } - else { - delete req.prefix; - } + if (action.prefix !== undefined) { + req.prefix = action.prefix; + } + else { + delete req.prefix; + } - if (action.suffix !== undefined) { - req.suffix = action.suffix; - } - else { - delete req.suffix; - } + if (action.suffix !== undefined) { + req.suffix = action.suffix; + } + else { + delete req.suffix; + } - if (action.urlParameters !== undefined) { - req.urlParameters = action.urlParameters; - } - else { - req.urlParameters = {}; - } + if (action.urlParameters !== undefined) { + req.urlParameters = action.urlParameters; + } + else { + req.urlParameters = {}; + } - var func = action.route.callback.controller; - if (func === null || typeof func !== 'function') { - func = actions.errorFunction(action.route, 'Invalid callback definition found for route ' + JSON.stringify(action.route)); - } + var func = action.route.callback.controller; + if (func === null || typeof func !== 'function') { + func = actions.errorFunction(action.route, 'Invalid callback definition found for route ' + JSON.stringify(action.route)); + } - try { - func(req, res, action.route.callback.options, next); - } - catch (err) { - actions.errorFunction(action.route, 'A runtime error occurred while executing an action: ' + String(err))(req, res, action.route.callback.options, next); - } - }; - - next = function () { - action = actions.nextRouting(action); - execute(); - }; + try { + func(req, res, action.route.callback.options, next); + } + catch (err) { + actions.errorFunction(action.route, 'A runtime error occurred while executing an action: ' + String(err))(req, res, action.route.callback.options, next); + } + }; + next = function () { + action = actions.nextRouting(action); execute(); + }; + + execute(); +} + +actions.defineHttp({ + url : "", + prefix : true, + context : "admin", + callback : Routing +}); + +//////////////////////////////////////////////////////////////////////////////// +/// @brief returns system status information for the server +//////////////////////////////////////////////////////////////////////////////// + +actions.defineHttp({ + url : "_admin/routing/reload", + context : "admin", + prefix : false, + callback : function (req, res) { + internal.executeGlobalContextFunction("require(\"org/arangodb/actions\").reloadRouting()"); + actions.resultOk(req, res, actions.HTTP_OK); } - - actions.defineHttp({ - url : "", - prefix : true, - context : "admin", - callback : Routing - }); +}); //////////////////////////////////////////////////////////////////////////////// /// @brief returns system status information for the server //////////////////////////////////////////////////////////////////////////////// - actions.defineHttp({ - url : "_admin/routing/reload", - context : "admin", - prefix : false, - callback : function (req, res) { - internal.executeGlobalContextFunction("require(\"org/arangodb/actions\").reloadRouting()"); - actions.resultOk(req, res, actions.HTTP_OK); - } - }); - -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns system status information for the server -//////////////////////////////////////////////////////////////////////////////// - - actions.defineHttp({ - url : "_admin/routing/routes", - context : "admin", - prefix : false, - callback : function (req, res) { - actions.resultOk(req, res, actions.HTTP_OK, actions.routingCache()); - } - }); +actions.defineHttp({ + url : "_admin/routing/routes", + context : "admin", + prefix : false, + callback : function (req, res) { + actions.resultOk(req, res, actions.HTTP_OK, actions.routingCache()); + } +}); //////////////////////////////////////////////////////////////////////////////// /// @} @@ -174,14 +173,14 @@ /// current system time as a Unix timestamp with microsecond precision. //////////////////////////////////////////////////////////////////////////////// - actions.defineHttp({ - url : "_admin/time", - context : "admin", - prefix : false, - callback : function (req, res) { - actions.resultOk(req, res, actions.HTTP_OK, { time : internal.time() }); - } - }); +actions.defineHttp({ + url : "_admin/time", + context : "admin", + prefix : false, + callback : function (req, res) { + actions.resultOk(req, res, actions.HTTP_OK, { time : internal.time() }); + } +}); //////////////////////////////////////////////////////////////////////////////// /// @fn JSF_GET_admin_echo @@ -200,16 +199,16 @@ /// - @LIT{parameters}: list of URL parameters received //////////////////////////////////////////////////////////////////////////////// - actions.defineHttp({ - url : "_admin/echo", - context : "admin", - prefix : true, - callback : function (req, res) { - res.responseCode = actions.HTTP_OK; - res.contentType = "application/json; charset=utf-8"; - res.body = JSON.stringify(req); - } - }); +actions.defineHttp({ + url : "_admin/echo", + context : "admin", + prefix : true, + callback : function (req, res) { + res.responseCode = actions.HTTP_OK; + res.contentType = "application/json; charset=utf-8"; + res.body = JSON.stringify(req); + } +}); //////////////////////////////////////////////////////////////////////////////// /// @fn JSF_GET_admin_status @@ -246,24 +245,24 @@ /// made which have required loading a memory page from disk. //////////////////////////////////////////////////////////////////////////////// - actions.defineHttp({ - url : "_admin/status", - context : "admin", +actions.defineHttp({ + url : "_admin/status", + context : "admin", - callback : function (req, res) { - var result; + callback : function (req, res) { + var result; - try { - result = {}; - result.system = SYS_PROCESS_STAT(); + try { + result = {}; + result.system = internal.processStat(); - actions.resultOk(req, res, actions.HTTP_OK, result); - } - catch (err) { - actions.resultException(req, res, err); - } + actions.resultOk(req, res, actions.HTTP_OK, result); } - }); + catch (err) { + actions.resultException(req, res, err); + } + } +}); //////////////////////////////////////////////////////////////////////////////// /// @} @@ -278,76 +277,76 @@ /// @{ //////////////////////////////////////////////////////////////////////////////// - function GET_admin_session (req, res) { - var result; - var realm; +function GET_admin_session (req, res) { + var result; + var realm; - if (req.user === null) { - realm = "basic realm=\"arangodb\""; + if (req.user === null) { + realm = "basic realm=\"arangodb\""; - res.responseCode = actions.HTTP_UNAUTHORIZED; - res.headers = { "www-authenticate" : realm }; - } - else { - var user = internal.db._collection("_users").firstExample({ user : req.user }); + res.responseCode = actions.HTTP_UNAUTHORIZED; + res.headers = { "www-authenticate" : realm }; + } + else { + var user = internal.db._collection("_users").firstExample({ user : req.user }); - if (user === null) { - actions.resultNotFound(req, res, internal.errors.ERROR_HTTP_NOT_FOUND.code, "unknown user '" + req.user + "'"); - } - else { - result = { - user : user.user, - permissions : user.permissions || [] - }; - - actions.resultOk(req, res, actions.HTTP_OK, result); - } - } + if (user === null) { + actions.resultNotFound(req, res, internal.errors.ERROR_HTTP_NOT_FOUND.code, "unknown user '" + req.user + "'"); } + else { + result = { + user : user.user, + permissions : user.permissions || [] + }; - function POST_admin_session (req, res) { - actions.resultUnsupported(req, res); + actions.resultOk(req, res, actions.HTTP_OK, result); } + } +} - function PUT_admin_session (req, res) { - actions.resultUnsupported(req, res); - } +function POST_admin_session (req, res) { + actions.resultUnsupported(req, res); +} - function DELETE_admin_session (req, res) { - actions.resultUnsupported(req, res); - } +function PUT_admin_session (req, res) { + actions.resultUnsupported(req, res); +} + +function DELETE_admin_session (req, res) { + actions.resultUnsupported(req, res); +} //////////////////////////////////////////////////////////////////////////////// /// @brief session call dispatcher //////////////////////////////////////////////////////////////////////////////// - actions.defineHttp({ - url : "_admin/session", - context : "admin", - prefix : false, - callback : function (req, res) { - try { - if (req.requestType === actions.GET) { - GET_admin_session(req, res); - } - else if (req.requestType === actions.DELETE) { - DELETE_admin_session(req, res); - } - else if (req.requestType === actions.POST) { - POST_admin_session(req, res); - } - else if (req.requestType === actions.PUT) { - PUT_admin_session(req, res); - } - else { - actions.resultUnsupported(req, res); - } +actions.defineHttp({ + url : "_admin/session", + context : "admin", + prefix : false, + callback : function (req, res) { + try { + if (req.requestType === actions.GET) { + GET_admin_session(req, res); } - catch (err) { - actions.resultException(req, res, err); + else if (req.requestType === actions.DELETE) { + DELETE_admin_session(req, res); + } + else if (req.requestType === actions.POST) { + POST_admin_session(req, res); + } + else if (req.requestType === actions.PUT) { + PUT_admin_session(req, res); + } + else { + actions.resultUnsupported(req, res); } } - }); + catch (err) { + actions.resultException(req, res, err); + } + } +}); //////////////////////////////////////////////////////////////////////////////// /// @} @@ -363,4 +362,3 @@ // mode: outline-minor // outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)" // End: - diff --git a/js/common/bootstrap/module-console.js b/js/common/bootstrap/module-console.js new file mode 100644 index 0000000000..c80a5f0450 --- /dev/null +++ b/js/common/bootstrap/module-console.js @@ -0,0 +1,188 @@ +/*jslint indent: 2, + nomen: true, + maxlen: 100, + sloppy: true, + vars: true, + white: true, + plusplus: true */ +/*global Module */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief module "console" +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2013 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- Module "console" +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleConsole +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief console module +//////////////////////////////////////////////////////////////////////////////// + +(function () { + Module.prototype.ModuleCache["/console"] = new Module("/console"); + + var internal = Module.prototype.ModuleCache["/internal"].exports; + var console = Module.prototype.ModuleCache["/console"].exports; + + console.getline = internal.getline; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief logs debug message +/// +/// @FUN{console.debug(@FA{format}, @FA{argument1}, ...)} +/// +/// Formats the arguments according to @FA{format} and logs the result as +/// debug message. +/// +/// String substitution patterns, which can be used in @FA{format}. +/// +/// - @LIT{\%s} string +/// - @LIT{\%d}, @LIT{\%i} integer +/// - @LIT{\%f} floating point number +/// - @LIT{\%o} object hyperlink +//////////////////////////////////////////////////////////////////////////////// + + console.debug = function () { + var msg; + + try { + msg = internal.sprintf.apply(internal.sprintf, arguments); + } + catch (err) { + msg = err + ": " + arguments; + } + + internal.log("debug", msg); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief logs error message +/// +/// @FUN{console.error(@FA{format}, @FA{argument1}, ...)} +/// +/// Formats the arguments according to @FA{format} and logs the result as +/// error message. +//////////////////////////////////////////////////////////////////////////////// + + console.error = function () { + var msg; + + try { + msg = internal.sprintf.apply(internal.sprintf, arguments); + } + catch (err) { + msg = err + ": " + arguments; + } + + internal.log("error", msg); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief logs info message +/// +/// @FUN{console.info(@FA{format}, @FA{argument1}, ...)} +/// +/// Formats the arguments according to @FA{format} and logs the result as +/// info message. +//////////////////////////////////////////////////////////////////////////////// + + console.info = function () { + var msg; + + try { + msg = internal.sprintf.apply(internal.sprintf, arguments); + } + catch (err) { + msg = err + ": " + arguments; + } + + internal.log("info", msg); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief logs log message +/// +/// @FUN{console.log(@FA{format}, @FA{argument1}, ...)} +/// +/// Formats the arguments according to @FA{format} and logs the result as +/// log message. +//////////////////////////////////////////////////////////////////////////////// + + console.log = function () { + var msg; + + try { + msg = internal.sprintf.apply(internal.sprintf, arguments); + } + catch (err) { + msg = err + ": " + arguments; + } + + internal.log("info", msg); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief logs warn message +/// +/// @FUN{console.warn(@FA{format}, @FA{argument1}, ...)} +/// +/// Formats the arguments according to @FA{format} and logs the result as +/// warn message. +//////////////////////////////////////////////////////////////////////////////// + + console.warn = function () { + var msg; + + try { + msg = internal.sprintf.apply(internal.sprintf, arguments); + } + catch (err) { + msg = err + ": " + arguments; + } + + internal.log("warn", msg); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +}()); + +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" +// End: diff --git a/js/common/bootstrap/module-fs.js b/js/common/bootstrap/module-fs.js new file mode 100644 index 0000000000..a77cc0fb4d --- /dev/null +++ b/js/common/bootstrap/module-fs.js @@ -0,0 +1,74 @@ +/*jslint indent: 2, + nomen: true, + maxlen: 100, + sloppy: true, + vars: true, + white: true, + plusplus: true */ +/*global Module */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief module "js" +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2013 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- Module "fs" +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleFS +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief file-system module +//////////////////////////////////////////////////////////////////////////////// + +(function () { + Module.prototype.ModuleCache["/fs"] = new Module("/fs"); + + var internal = Module.prototype.ModuleCache["/internal"].exports; + var fs = Module.prototype.ModuleCache["/fs"].exports; + + fs.exists = internal.exists; + fs.isDirectory = internal.isDirectory; + fs.listTree = internal.listTree; + fs.move = internal.move; + fs.remove = internal.remove; +}()); + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" +// End: diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index a71e69205a..2b7195751b 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -75,6 +75,7 @@ Module.prototype.ModuleExistsCache = {}; //////////////////////////////////////////////////////////////////////////////// Module.prototype.require = function (path) { + var internal; var content; var f; var module; @@ -91,7 +92,8 @@ Module.prototype.require = function (path) { } // locate file and read content - raw = this.ModuleCache["/internal"].exports.readFile(path); + internal = this.ModuleCache["/internal"].exports; + raw = internal.readFile(path); // test for parse errors first and fail early if a parse error detected if (! SYS_PARSE(raw.content, path)) { @@ -105,7 +107,7 @@ Module.prototype.require = function (path) { + raw.content + "\n});"; - f = SYS_EXECUTE(content, undefined, path); + f = internal.execute(content, undefined, path); if (f === undefined) { throw "cannot create context function"; @@ -254,35 +256,6 @@ function require (path) { /// @} //////////////////////////////////////////////////////////////////////////////// -// ----------------------------------------------------------------------------- -// --SECTION-- Module "fs" -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8ModuleFS -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief file-system module -//////////////////////////////////////////////////////////////////////////////// - -Module.prototype.ModuleCache["/fs"] = new Module("/fs"); - -(function () { - var fs = Module.prototype.ModuleCache["/fs"].exports; - - fs.exists = FS_EXISTS; - fs.isDirectory = FS_IS_DIRECTORY; - fs.listTree = FS_LIST_TREE; - fs.move = FS_MOVE; - fs.remove = FS_REMOVE; -}()); - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - // ----------------------------------------------------------------------------- // --SECTION-- Module "internal" // ----------------------------------------------------------------------------- @@ -300,28 +273,65 @@ Module.prototype.ModuleCache["/internal"] = new Module("/internal"); (function () { var internal = Module.prototype.ModuleCache["/internal"].exports; - var fs = Module.prototype.ModuleCache["/fs"].exports; // system functions internal.execute = SYS_EXECUTE; - internal.load = SYS_LOAD; - internal.log = SYS_LOG; - internal.logLevel = SYS_LOG_LEVEL; - internal.output = SYS_OUTPUT; - internal.processStat = SYS_PROCESS_STAT; - internal.read = SYS_READ; - internal.sprintf = SYS_SPRINTF; - internal.time = SYS_TIME; - internal.sha256 = SYS_SHA256; - internal.wait = SYS_WAIT; + delete SYS_EXECUTE; + internal.getline = SYS_GETLINE; + delete SYS_GETLINE; + + internal.load = SYS_LOAD; + delete SYS_LOAD; + + internal.log = SYS_LOG; + delete SYS_LOG; + + internal.logLevel = SYS_LOG_LEVEL; + delete SYS_LOG_LEVEL; + + internal.output = SYS_OUTPUT; + delete SYS_OUTPUT; + + internal.processStat = SYS_PROCESS_STAT; + delete SYS_PROCESS_STAT; + + internal.read = SYS_READ; + delete SYS_READ; + + internal.sha256 = SYS_SHA256; + delete SYS_SHA256; + + internal.sprintf = SYS_SPRINTF; + delete SYS_SPRINTF; + + internal.time = SYS_TIME; + delete SYS_TIME; + + internal.wait = SYS_WAIT; + delete SYS_WAIT; + + internal.exists = FS_EXISTS; + delete FS_EXISTS; + + internal.isDirectory = FS_IS_DIRECTORY; + delete FS_IS_DIRECTORY; + + internal.listTree = FS_LIST_TREE; + delete FS_LIST_TREE; + + internal.move = FS_MOVE; + delete FS_MOVE; + + internal.remove = FS_REMOVE; + delete FS_REMOVE; // password interface internal.encodePassword = function (password) { var salt; var encoded; - salt = internal.sha256("time:" + SYS_TIME()); + salt = internal.sha256("time:" + internal.time()); salt = salt.substr(0,8); encoded = "$1$" + salt + "$" + internal.sha256(salt + password); @@ -432,7 +442,7 @@ Module.prototype.ModuleCache["/internal"] = new Module("/internal"); n = p + "/" + path + ".js"; } - if (fs.exists(n)) { + if (internal.exists(n)) { Module.prototype.ModuleExistsCache[path] = true; return { path : n, content : internal.read(n) }; } @@ -486,7 +496,7 @@ Module.prototype.ModuleCache["/internal"] = new Module("/internal"); n = p + "/" + path + ".js"; } - if (fs.exists(n)) { + if (internal.exists(n)) { return internal.load(n); } } @@ -532,150 +542,6 @@ Module.prototype.ModuleCache["/internal"] = new Module("/internal"); }()); -// ----------------------------------------------------------------------------- -// --SECTION-- Module "console" -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8ModuleConsole -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief console module -//////////////////////////////////////////////////////////////////////////////// - -Module.prototype.ModuleCache["/console"] = new Module("/console"); - -(function () { - var internal = Module.prototype.ModuleCache["/internal"].exports; - var console = Module.prototype.ModuleCache["/console"].exports; - - console.getline = SYS_GETLINE; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief logs debug message -/// -/// @FUN{console.debug(@FA{format}, @FA{argument1}, ...)} -/// -/// Formats the arguments according to @FA{format} and logs the result as -/// debug message. -/// -/// String substitution patterns, which can be used in @FA{format}. -/// -/// - @LIT{\%s} string -/// - @LIT{\%d}, @LIT{\%i} integer -/// - @LIT{\%f} floating point number -/// - @LIT{\%o} object hyperlink -//////////////////////////////////////////////////////////////////////////////// - - console.debug = function () { - var msg; - - try { - msg = internal.sprintf.apply(internal.sprintf, arguments); - } - catch (err) { - msg = err + ": " + arguments; - } - - internal.log("debug", msg); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief logs error message -/// -/// @FUN{console.error(@FA{format}, @FA{argument1}, ...)} -/// -/// Formats the arguments according to @FA{format} and logs the result as -/// error message. -//////////////////////////////////////////////////////////////////////////////// - - console.error = function () { - var msg; - - try { - msg = internal.sprintf.apply(internal.sprintf, arguments); - } - catch (err) { - msg = err + ": " + arguments; - } - - internal.log("error", msg); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief logs info message -/// -/// @FUN{console.info(@FA{format}, @FA{argument1}, ...)} -/// -/// Formats the arguments according to @FA{format} and logs the result as -/// info message. -//////////////////////////////////////////////////////////////////////////////// - - console.info = function () { - var msg; - - try { - msg = internal.sprintf.apply(internal.sprintf, arguments); - } - catch (err) { - msg = err + ": " + arguments; - } - - internal.log("info", msg); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief logs log message -/// -/// @FUN{console.log(@FA{format}, @FA{argument1}, ...)} -/// -/// Formats the arguments according to @FA{format} and logs the result as -/// log message. -//////////////////////////////////////////////////////////////////////////////// - - console.log = function () { - var msg; - - try { - msg = internal.sprintf.apply(internal.sprintf, arguments); - } - catch (err) { - msg = err + ": " + arguments; - } - - internal.log("info", msg); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief logs warn message -/// -/// @FUN{console.warn(@FA{format}, @FA{argument1}, ...)} -/// -/// Formats the arguments according to @FA{format} and logs the result as -/// warn message. -//////////////////////////////////////////////////////////////////////////////// - - console.warn = function () { - var msg; - - try { - msg = internal.sprintf.apply(internal.sprintf, arguments); - } - catch (err) { - msg = err + ": " + arguments; - } - - internal.log("warn", msg); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -}()); - // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- diff --git a/js/common/modules/jslint.js b/js/common/modules/jslint.js index e6431ec196..8a291294eb 100644 --- a/js/common/modules/jslint.js +++ b/js/common/modules/jslint.js @@ -47,7 +47,7 @@ function RunTest (path, options) { var content; try { - content = SYS_READ(path); + content = internal.read(path); } catch (err) { console.error("cannot load test file '%s'", path); diff --git a/js/common/modules/jsunity.js b/js/common/modules/jsunity.js index 8f1b4374d6..ecd69e252a 100644 --- a/js/common/modules/jsunity.js +++ b/js/common/modules/jsunity.js @@ -348,10 +348,10 @@ function RunTest (path) { var content; var f; - content = SYS_READ(path); + content = internal.read(path); content = "(function(jsUnity){jsUnity.attachAssertions();" + content + "})"; - f = SYS_EXECUTE(content, undefined, path); + f = internal.execute(content, undefined, path); if (f == undefined) { throw "cannot create context function"; diff --git a/js/server/version-check.js b/js/server/version-check.js index 89ea783fb5..8b4ac35d72 100644 --- a/js/server/version-check.js +++ b/js/server/version-check.js @@ -92,9 +92,9 @@ } - if (FS_EXISTS(versionFile)) { + if (internal.exists(versionFile)) { // VERSION file exists, read its contents - var versionInfo = SYS_READ(versionFile); + var versionInfo = internal.read(versionFile); if (versionInfo != '') { var versionValues = JSON.parse(versionInfo); @@ -311,13 +311,13 @@ var currentVersion = parseFloat(currentServerVersion[1]); - if (! FS_EXISTS(versionFile)) { + if (! internal.exists(versionFile)) { console.info("No version information file found in database directory."); return runUpgrade(currentVersion); } // VERSION file exists, read its contents - var versionInfo = SYS_READ(versionFile); + var versionInfo = internal.read(versionFile); if (versionInfo != '') { var versionValues = JSON.parse(versionInfo); if (versionValues && versionValues.version && ! isNaN(versionValues.version)) { From 337cee7606ed3d8760b2ed5bdd4c45fa97ccb005 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sat, 5 Jan 2013 23:56:05 +0100 Subject: [PATCH 08/26] fixed jslint warnings --- Makefile.in | 4 + arangod/V8Server/ApplicationV8.cpp | 1 + arangosh/V8Client/arangosh.cpp | 1 + js/Makefile.files | 4 + js/common/bootstrap/module-console.js | 8 +- js/common/bootstrap/module-fs.js | 8 +- js/common/bootstrap/module-internal.js | 410 +++++++++++++++++++++++++ js/common/bootstrap/modules.js | 306 +----------------- js/common/bootstrap/monkeypatches.js | 33 +- js/common/modules/jslint/jslint.js | 10 +- 10 files changed, 459 insertions(+), 326 deletions(-) create mode 100644 js/common/bootstrap/module-internal.js diff --git a/Makefile.in b/Makefile.in index 1d81ce9253..8640d8bbe2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1736,8 +1736,12 @@ WIKI = \ JAVASCRIPT_JSLINT = \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ + @srcdir@/js/common/bootstrap/errors.js \ + @srcdir@/js/common/bootstrap/modules.js \ + @srcdir@/js/common/bootstrap/module-internal.js \ @srcdir@/js/common/bootstrap/module-console.js \ @srcdir@/js/common/bootstrap/module-fs.js \ + @srcdir@/js/common/bootstrap/monkeypatches.js \ @srcdir@/js/server/modules/org/arangodb.js \ @srcdir@/js/server/modules/org/arangodb/actions.js \ @srcdir@/js/server/ArangoCollection.js \ diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index 7afebac790..0259bfa757 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -643,6 +643,7 @@ bool ApplicationV8::prepareV8Instance (const size_t i) { vector files; files.push_back("common/bootstrap/modules.js"); + files.push_back("common/bootstrap/module-internal.js"); files.push_back("common/bootstrap/module-fs.js"); files.push_back("common/bootstrap/module-console.js"); files.push_back("common/bootstrap/monkeypatches.js"); diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index 92d195084f..e812dd546b 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -1309,6 +1309,7 @@ int main (int argc, char* argv[]) { vector files; files.push_back("common/bootstrap/modules.js"); + files.push_back("common/bootstrap/module-internal.js"); files.push_back("common/bootstrap/module-fs.js"); files.push_back("common/bootstrap/module-console.js"); diff --git a/js/Makefile.files b/js/Makefile.files index cad56fa06c..dbd48593d7 100644 --- a/js/Makefile.files +++ b/js/Makefile.files @@ -11,8 +11,12 @@ JAVASCRIPT_JSLINT = \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ + @srcdir@/js/common/bootstrap/errors.js \ + @srcdir@/js/common/bootstrap/modules.js \ + @srcdir@/js/common/bootstrap/module-internal.js \ @srcdir@/js/common/bootstrap/module-console.js \ @srcdir@/js/common/bootstrap/module-fs.js \ + @srcdir@/js/common/bootstrap/monkeypatches.js \ @srcdir@/js/server/modules/org/arangodb.js \ @srcdir@/js/server/modules/org/arangodb/actions.js \ @srcdir@/js/server/ArangoCollection.js \ diff --git a/js/common/bootstrap/module-console.js b/js/common/bootstrap/module-console.js index c80a5f0450..3f85a1cf62 100644 --- a/js/common/bootstrap/module-console.js +++ b/js/common/bootstrap/module-console.js @@ -1,10 +1,4 @@ -/*jslint indent: 2, - nomen: true, - maxlen: 100, - sloppy: true, - vars: true, - white: true, - plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ /*global Module */ //////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/bootstrap/module-fs.js b/js/common/bootstrap/module-fs.js index a77cc0fb4d..38260c1674 100644 --- a/js/common/bootstrap/module-fs.js +++ b/js/common/bootstrap/module-fs.js @@ -1,10 +1,4 @@ -/*jslint indent: 2, - nomen: true, - maxlen: 100, - sloppy: true, - vars: true, - white: true, - plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ /*global Module */ //////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/bootstrap/module-internal.js b/js/common/bootstrap/module-internal.js new file mode 100644 index 0000000000..6f77916796 --- /dev/null +++ b/js/common/bootstrap/module-internal.js @@ -0,0 +1,410 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true, nonpropdel: true */ +/*global require, module, Module, FS_MOVE, FS_REMOVE, FS_EXISTS, FS_IS_DIRECTORY, FS_LIST_TREE, + SYS_EXECUTE, SYS_LOAD, SYS_LOG, SYS_LOG_LEVEL, SYS_OUTPUT, SYS_PROCESS_STAT, SYS_READ, + SYS_SPRINTF, SYS_TIME, SYS_START_PAGER, SYS_STOP_PAGER, SYS_SHA256, SYS_WAIT, SYS_GETLINE, + SYS_PARSE, ARANGO_QUIET, MODULES_PATH, COLOR_OUTPUT, COLOR_OUTPUT_RESET, COLOR_BRIGHT, + COLOR_BLACK, COLOR_BOLD_BLACK, COLOR_BLINK, COLOR_BLUE, COLOR_BOLD_BLUE, COLOR_BOLD_GREEN, + COLOR_RED, COLOR_BOLD_RED, COLOR_GREEN, COLOR_WHITE, COLOR_BOLD_WHITE, COLOR_YELLOW, + COLOR_BOLD_YELLOW, PRETTY_PRINT */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief module "internal" +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2013 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- Module "internal" +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleInternal +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief internal module +//////////////////////////////////////////////////////////////////////////////// + +(function () { + Module.prototype.ModuleCache["/internal"] = new Module("/internal"); + + var internal = Module.prototype.ModuleCache["/internal"].exports; + + // system functions + internal.execute = SYS_EXECUTE; + delete SYS_EXECUTE; + + internal.getline = SYS_GETLINE; + delete SYS_GETLINE; + + internal.load = SYS_LOAD; + delete SYS_LOAD; + + internal.log = SYS_LOG; + delete SYS_LOG; + + internal.logLevel = SYS_LOG_LEVEL; + delete SYS_LOG_LEVEL; + + internal.output = SYS_OUTPUT; + delete SYS_OUTPUT; + + internal.parse= SYS_PARSE; + delete SYS_PARSE; + + internal.processStat = SYS_PROCESS_STAT; + delete SYS_PROCESS_STAT; + + internal.read = SYS_READ; + delete SYS_READ; + + internal.sha256 = SYS_SHA256; + delete SYS_SHA256; + + internal.sprintf = SYS_SPRINTF; + delete SYS_SPRINTF; + + internal.time = SYS_TIME; + delete SYS_TIME; + + internal.wait = SYS_WAIT; + delete SYS_WAIT; + + internal.exists = FS_EXISTS; + delete FS_EXISTS; + + internal.isDirectory = FS_IS_DIRECTORY; + delete FS_IS_DIRECTORY; + + internal.listTree = FS_LIST_TREE; + delete FS_LIST_TREE; + + internal.move = FS_MOVE; + delete FS_MOVE; + + internal.remove = FS_REMOVE; + delete FS_REMOVE; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- public constants +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleInternal +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief modules path +//////////////////////////////////////////////////////////////////////////////// + + internal.MODULES_PATH = ""; + + if (typeof MODULES_PATH !== "undefined") { + internal.MODULES_PATH = MODULES_PATH; + delete MODULES_PATH; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief quiet flag +//////////////////////////////////////////////////////////////////////////////// + + internal.ARANGO_QUIET = false; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief pretty print flag +//////////////////////////////////////////////////////////////////////////////// + + internal.PRETTY_PRINT = false; + + if (typeof PRETTY_PRINT !== "undefined") { + internal.PRETTY_PRINT = PRETTY_PRINT; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief color constants +//////////////////////////////////////////////////////////////////////////////// + + internal.COLOR_OUTPUT = false; + internal.COLOR_OUTPUT_DEFAULT = ""; + internal.COLOR_OUTPUT_RESET = ""; + internal.COLOR_BRIGHT = ""; + + if (typeof COLOR_OUTPUT !== "undefined") { + internal.COLOR_OUTPUT = COLOR_OUTPUT; + delete COLOR_OUTPUT; + } + + if (typeof COLOR_OUTPUT_RESET !== "undefined") { + internal.COLOR_OUTPUT_RESET = COLOR_OUTPUT_RESET; + delete COLOR_OUTPUT_RESET; + } + + if (typeof COLOR_BRIGHT !== "undefined") { + internal.COLOR_BRIGHT = COLOR_BRIGHT; + delete COLOR_BRIGHT; + } + + if (internal.COLOR_OUTPUT) { + internal.COLOR_OUTPUT_DEFAULT = internal.COLOR_BRIGHT; + + internal.COLOR_BLACK = COLOR_BLACK; + delete COLOR_BLACK; + + internal.COLOR_BOLD_BLACK = COLOR_BOLD_BLACK; + delete COLOR_BOLD_BLACK; + + internal.COLOR_BLINK = COLOR_BLINK; + delete COLOR_BLINK; + + internal.COLOR_BLUE = COLOR_BLUE; + delete COLOR_BLUE; + + internal.COLOR_BOLD_BLUE = COLOR_BOLD_BLUE; + delete COLOR_BOLD_BLUE; + + internal.COLOR_GREEN = COLOR_GREEN; + delete COLOR_GREEN; + + internal.COLOR_BOLD_GREEN = COLOR_BOLD_GREEN; + delete COLOR_BOLD_GREEN; + + internal.COLOR_RED = COLOR_RED; + delete COLOR_RED; + + internal.COLOR_BOLD_RED = COLOR_BOLD_RED; + delete COLOR_BOLD_RED; + + internal.COLOR_WHITE = COLOR_WHITE; + delete COLOR_WHITE; + + internal.COLOR_BOLD_WHITE = COLOR_BOLD_WHITE; + delete COLOR_BOLD_WHITE; + + internal.COLOR_YELLOW = COLOR_YELLOW; + delete COLOR_YELLOW; + + internal.COLOR_BOLD_YELLOW = COLOR_BOLD_YELLOW; + delete COLOR_BOLD_YELLOW; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- public methods +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleInternal +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief start pager +//////////////////////////////////////////////////////////////////////////////// + + internal.start_pager = function () {}; + + if (typeof SYS_START_PAGER !== "undefined") { + internal.start_pager = SYS_START_PAGER; + delete SYS_START_PAGER; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief stop pager +//////////////////////////////////////////////////////////////////////////////// + + internal.stop_pager = function () {}; + + if (typeof SYS_STOP_PAGER !== "undefined") { + internal.stop_pager = SYS_STOP_PAGER; + delete SYS_STOP_PAGER; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief encode password using SHA256 +//////////////////////////////////////////////////////////////////////////////// + + internal.encodePassword = function (password) { + var salt; + var encoded; + + salt = internal.sha256("time:" + internal.time()); + salt = salt.substr(0,8); + + encoded = "$1$" + salt + "$" + internal.sha256(salt + password); + + return encoded; + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief extends a prototype +//////////////////////////////////////////////////////////////////////////////// + + internal.extend = function (target, source) { + Object.getOwnPropertyNames(source) + .forEach(function(propName) { + Object.defineProperty(target, propName, + Object.getOwnPropertyDescriptor(source, propName)); + }); + + return target; + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief reads a file from the module path or the database +//////////////////////////////////////////////////////////////////////////////// + + internal.readFile = function (path) { + var i; + var mc; + var n; + + // try to load the file + var paths = internal.MODULES_PATH; + + for (i = 0; i < paths.length; ++i) { + var p = paths[i]; + + if (p === "") { + n = "." + path + ".js"; + } + else { + n = p + "/" + path + ".js"; + } + + if (internal.exists(n)) { + Module.prototype.ModuleExistsCache[path] = true; + return { path : n, content : internal.read(n) }; + } + } + + // try to load the module from the database + if (internal.db !== undefined) { + mc = internal.db._collection("_modules"); + + if (mc !== null && mc.hasOwnProperty("firstExample")) { + n = mc.firstExample({ path: path }); + + if (n !== null) { + if (n.hasOwnProperty('content')) { + Module.prototype.ModuleExistsCache[path] = true; + return { path : "_collection/" + path, content : n.content }; + } + + require("console").error("found empty content in '%s'", JSON.stringify(n)); + } + } + } + + Module.prototype.ModuleExistsCache[path] = false; + + throw "cannot find a file named '" + + path + + "' using the module path(s) '" + + internal.MODULES_PATH + "'"; + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief loads a file from the file-system +//////////////////////////////////////////////////////////////////////////////// + + internal.loadFile = function (path) { + var i; + + // try to load the file + var paths = internal.MODULES_PATH; + + for (i = 0; i < paths.length; ++i) { + var p = paths[i]; + var n; + + if (p === "") { + n = "." + path + ".js"; + } + else { + n = p + "/" + path + ".js"; + } + + if (internal.exists(n)) { + return internal.load(n); + } + } + + throw "cannot find a file named '" + + path + + "' using the module path(s) '" + + internal.MODULES_PATH + "'"; + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief defines a module +//////////////////////////////////////////////////////////////////////////////// + + internal.defineModule = function (path, file) { + var content; + var m; + var mc; + + content = internal.read(file); + + mc = internal.db._collection("_modules"); + + if (mc === null) { + mc = internal.db._create("_modules", { isSystem: true }); + } + + path = module.normalise(path); + m = mc.firstExample({ path: path }); + + if (m === null) { + mc.save({ path: path, module: content }); + } + else { + m.module = content; + mc.replace(m, m); + } + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +}()); + +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" +// End: diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index 2b7195751b..427144b4fc 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -1,17 +1,5 @@ -/*jslint indent: 2, - nomen: true, - maxlen: 100, - sloppy: true, - vars: true, - white: true, - plusplus: true */ -/*global - require, module, - SYS_EXECUTE, CONSOLE_ERROR, FS_MOVE, FS_REMOVE, FS_EXISTS, SYS_LOAD, SYS_LOG, - SYS_LOG_LEVEL, SYS_OUTPUT, SYS_PROCESS_STAT, SYS_READ, SYS_SPRINTF, SYS_TIME, - SYS_START_PAGER, SYS_STOP_PAGER, ARANGO_QUIET, MODULES_PATH, COLOR_OUTPUT, - COLOR_OUTPUT_RESET, COLOR_BRIGHT, PRETTY_PRINT, SYS_SHA256, SYS_WAIT, SYS_GETLINE -*/ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*global require, module: true */ //////////////////////////////////////////////////////////////////////////////// /// @brief JavaScript server functions @@ -96,7 +84,7 @@ Module.prototype.require = function (path) { raw = internal.readFile(path); // test for parse errors first and fail early if a parse error detected - if (! SYS_PARSE(raw.content, path)) { + if (! internal.parse(raw.content, path)) { throw "Javascript parse error in file '" + path + "'"; } @@ -132,7 +120,7 @@ Module.prototype.require = function (path) { Module.prototype.exists = function (path) { return this.ModuleExistsCache[path]; -} +}; //////////////////////////////////////////////////////////////////////////////// /// @brief normalises a path @@ -256,292 +244,6 @@ function require (path) { /// @} //////////////////////////////////////////////////////////////////////////////// -// ----------------------------------------------------------------------------- -// --SECTION-- Module "internal" -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8ModuleInternal -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief internal module -//////////////////////////////////////////////////////////////////////////////// - -Module.prototype.ModuleCache["/internal"] = new Module("/internal"); - -(function () { - var internal = Module.prototype.ModuleCache["/internal"].exports; - - // system functions - internal.execute = SYS_EXECUTE; - delete SYS_EXECUTE; - - internal.getline = SYS_GETLINE; - delete SYS_GETLINE; - - internal.load = SYS_LOAD; - delete SYS_LOAD; - - internal.log = SYS_LOG; - delete SYS_LOG; - - internal.logLevel = SYS_LOG_LEVEL; - delete SYS_LOG_LEVEL; - - internal.output = SYS_OUTPUT; - delete SYS_OUTPUT; - - internal.processStat = SYS_PROCESS_STAT; - delete SYS_PROCESS_STAT; - - internal.read = SYS_READ; - delete SYS_READ; - - internal.sha256 = SYS_SHA256; - delete SYS_SHA256; - - internal.sprintf = SYS_SPRINTF; - delete SYS_SPRINTF; - - internal.time = SYS_TIME; - delete SYS_TIME; - - internal.wait = SYS_WAIT; - delete SYS_WAIT; - - internal.exists = FS_EXISTS; - delete FS_EXISTS; - - internal.isDirectory = FS_IS_DIRECTORY; - delete FS_IS_DIRECTORY; - - internal.listTree = FS_LIST_TREE; - delete FS_LIST_TREE; - - internal.move = FS_MOVE; - delete FS_MOVE; - - internal.remove = FS_REMOVE; - delete FS_REMOVE; - - // password interface - internal.encodePassword = function (password) { - var salt; - var encoded; - - salt = internal.sha256("time:" + internal.time()); - salt = salt.substr(0,8); - - encoded = "$1$" + salt + "$" + internal.sha256(salt + password); - - return encoded; - } - - - - // command line parameter - internal.MODULES_PATH = ""; - - if (typeof MODULES_PATH !== "undefined") { - internal.MODULES_PATH = MODULES_PATH; - } - - - // output - internal.start_pager = function () {}; - internal.stop_pager = function () {}; - - internal.ARANGO_QUIET = false; - - internal.COLOR_OUTPUT = false; - internal.COLOR_OUTPUT_DEFAULT = ""; - internal.COLOR_OUTPUT_RESET = ""; - internal.COLOR_BRIGHT = ""; - - internal.PRETTY_PRINT = false; - - if (typeof SYS_START_PAGER !== "undefined") { - internal.start_pager = SYS_START_PAGER; - } - - if (typeof SYS_STOP_PAGER !== "undefined") { - internal.stop_pager = SYS_STOP_PAGER; - } - - if (typeof COLOR_OUTPUT !== "undefined") { - internal.COLOR_OUTPUT = COLOR_OUTPUT; - } - - if (typeof COLOR_OUTPUT_RESET !== "undefined") { - internal.COLOR_OUTPUT_RESET = COLOR_OUTPUT_RESET; - } - - if (typeof COLOR_BRIGHT !== "undefined") { - internal.COLOR_BRIGHT = COLOR_BRIGHT; - } - - if (typeof PRETTY_PRINT !== "undefined") { - internal.PRETTY_PRINT = PRETTY_PRINT; - } - - if (internal.COLOR_OUTPUT) { - internal.COLOR_OUTPUT_DEFAULT = internal.COLOR_BRIGHT; - - internal.COLOR_BLACK = COLOR_BLACK; - internal.COLOR_BOLD_BLACK = COLOR_BOLD_BLACK; - internal.COLOR_BLINK = COLOR_BLINK; - internal.COLOR_BLUE = COLOR_BLUE; - internal.COLOR_BOLD_BLUE = COLOR_BOLD_BLUE; - internal.COLOR_BRIGHT = COLOR_BRIGHT; - internal.COLOR_GREEN = COLOR_GREEN; - internal.COLOR_BOLD_GREEN = COLOR_BOLD_GREEN; - internal.COLOR_RED = COLOR_RED; - internal.COLOR_BOLD_RED = COLOR_BOLD_RED; - internal.COLOR_WHITE = COLOR_WHITE; - internal.COLOR_BOLD_WHITE = COLOR_BOLD_WHITE; - internal.COLOR_YELLOW = COLOR_YELLOW; - internal.COLOR_BOLD_YELLOW = COLOR_BOLD_YELLOW; - internal.COLOR_OUTPUT_RESET = COLOR_OUTPUT_RESET; - } - -//////////////////////////////////////////////////////////////////////////////// -/// @brief extends a prototype -//////////////////////////////////////////////////////////////////////////////// - - internal.extend = function (target, source) { - Object.getOwnPropertyNames(source) - .forEach(function(propName) { - Object.defineProperty(target, propName, - Object.getOwnPropertyDescriptor(source, propName)); - }); - - return target; - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief reads a file from the module path or the database -//////////////////////////////////////////////////////////////////////////////// - - internal.readFile = function (path) { - var i; - var mc; - var n; - - // try to load the file - var paths = internal.MODULES_PATH; - - for (i = 0; i < paths.length; ++i) { - var p = paths[i]; - - if (p === "") { - n = "." + path + ".js"; - } - else { - n = p + "/" + path + ".js"; - } - - if (internal.exists(n)) { - Module.prototype.ModuleExistsCache[path] = true; - return { path : n, content : internal.read(n) }; - } - } - - // try to load the module from the database - if (internal.db !== undefined) { - mc = internal.db._collection("_modules"); - - if (mc !== null && ("firstExample" in mc)) { - n = mc.firstExample({ path: path }); - - if (n !== null) { - if (n.hasOwnProperty('content')) { - Module.prototype.ModuleExistsCache[path] = true; - return { path : "_collection/" + path, content : n.content }; - } - else { - require("console").error("found empty content in '%s'", JSON.stringify(n)); - } - } - } - } - - Module.prototype.ModuleExistsCache[path] = false; - - throw "cannot find a file named '" - + path - + "' using the module path(s) '" - + internal.MODULES_PATH + "'"; - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief loads a file from the file-system -//////////////////////////////////////////////////////////////////////////////// - - internal.loadFile = function (path) { - var i; - - // try to load the file - var paths = internal.MODULES_PATH; - - for (i = 0; i < paths.length; ++i) { - var p = paths[i]; - var n; - - if (p === "") { - n = "." + path + ".js"; - } - else { - n = p + "/" + path + ".js"; - } - - if (internal.exists(n)) { - return internal.load(n); - } - } - - throw "cannot find a file named '" - + path - + "' using the module path(s) '" - + internal.MODULES_PATH + "'"; - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief defines a module -//////////////////////////////////////////////////////////////////////////////// - - internal.defineModule = function (path, file) { - var content; - var m; - var mc; - - content = internal.read(file); - - mc = internal.db._collection("_modules"); - - if (mc === null) { - mc = internal.db._create("_modules", { isSystem: true }); - } - - path = module.normalise(path); - m = mc.firstExample({ path: path }); - - if (m === null) { - mc.save({ path: path, module: content }); - } - else { - m.module = content; - mc.replace(m, m); - } - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -}()); - // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- diff --git a/js/common/bootstrap/monkeypatches.js b/js/common/bootstrap/monkeypatches.js index 127bd92bad..261dc6f486 100644 --- a/js/common/bootstrap/monkeypatches.js +++ b/js/common/bootstrap/monkeypatches.js @@ -1,8 +1,4 @@ -/*jslint indent: 2, - nomen: true, - maxlen: 100, - sloppy: true, - plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, plusplus: true */ //////////////////////////////////////////////////////////////////////////////// /// @brief Monkeypatches to built-in prototypes @@ -27,10 +23,20 @@ /// /// Copyright holder is triAGENS GmbH, Cologne, Germany /// -/// @author Dr. Frank Celler, Lucas Dohmen +/// @author Dr. Frank Celler +/// @author Lucas Dohmen /// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- monkey-patches +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8Shell +/// @{ +//////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////// /// @brief remove last occurrence of element from an array //////////////////////////////////////////////////////////////////////////////// @@ -90,4 +96,17 @@ Object.defineProperty(Object.prototype, "propertyKeys", { return (element[0] !== '_' && element[0] !== '$'); }); } -}); \ No newline at end of file +}); + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- END-OF-FILE +// ----------------------------------------------------------------------------- + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" +// End: diff --git a/js/common/modules/jslint/jslint.js b/js/common/modules/jslint/jslint.js index db95cfc73b..e938aabc49 100644 --- a/js/common/modules/jslint/jslint.js +++ b/js/common/modules/jslint/jslint.js @@ -182,6 +182,7 @@ // newcap true, if constructor names capitalization is ignored // node true, if Node.js globals should be predefined // nomen true, if names may have dangling _ +/// nonpropdel true, if delete should be allowed for non-properties // on true, if HTML event handlers should be allowed // passfail true, if the scan should stop on first error // plusplus true, if increment/decrement should be allowed @@ -274,7 +275,7 @@ 'min-height', 'min-width', missing_a, missing_a_after_b, missing_option, missing_property, missing_space_a_b, missing_url, missing_use_strict, mixed, mm, mode, move_invocation, move_var, n, name, name_function, nav, - nested_comment, newcap, node, noframes, nomen, noscript, not, + nested_comment, newcap, node, noframes, nomen, nonpropdel, noscript, not, not_a_constructor, not_a_defined, not_a_function, not_a_label, not_a_scope, not_greater, nud, number, object, octal_a, ol, on, opacity, open, optgroup, option, outer, outline, 'outline-color', 'outline-style', 'outline-width', @@ -356,6 +357,7 @@ var JSLINT = (function () { newcap : true, node : true, nomen : true, + nonpropdel: true, on : true, passfail : true, plusplus : true, @@ -3419,8 +3421,10 @@ klass: do { prefix('delete', function () { one_space(); var p = expression(0); - if (!p || (p.id !== '.' && p.id !== '[')) { - warn('deleted'); + if (!option.nonpropdel) { + if (!p || (p.id !== '.' && p.id !== '[')) { + warn('deleted'); + } } this.first = p; return this; From 3826a4603e697f49af4cc60e0dd4d23fbd570fb5 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 6 Jan 2013 00:23:40 +0100 Subject: [PATCH 09/26] removed print.js --- Documentation/Makefile.files | 1 - Makefile.in | 1 - arangod/V8Server/ApplicationV8.cpp | 1 - arangosh/V8Client/arangosh.cpp | 1 - html/admin/js/print.js | 1 - js/common/bootstrap/module-internal.js | 263 ++++++++++++++++++++ js/common/bootstrap/modules.js | 10 + js/common/bootstrap/print.js | 331 ------------------------- 8 files changed, 273 insertions(+), 336 deletions(-) delete mode 120000 html/admin/js/print.js delete mode 100644 js/common/bootstrap/print.js diff --git a/Documentation/Makefile.files b/Documentation/Makefile.files index 63998dad9f..2e7a929bdf 100644 --- a/Documentation/Makefile.files +++ b/Documentation/Makefile.files @@ -28,7 +28,6 @@ DOXYGEN = \ Doxygen/js/actions/system/api-simple.c \ Doxygen/js/actions/system/api-system.c \ Doxygen/js/common/bootstrap/modules.c \ - Doxygen/js/common/bootstrap/print.c \ Doxygen/js/common/modules/graph.c \ Doxygen/js/common/modules/jsunity.c \ Doxygen/js/common/modules/simple-query-basics.c \ diff --git a/Makefile.in b/Makefile.in index 8640d8bbe2..5f3d71afbf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1653,7 +1653,6 @@ DOXYGEN = \ Doxygen/js/actions/system/api-simple.c \ Doxygen/js/actions/system/api-system.c \ Doxygen/js/common/bootstrap/modules.c \ - Doxygen/js/common/bootstrap/print.c \ Doxygen/js/common/modules/graph.c \ Doxygen/js/common/modules/jsunity.c \ Doxygen/js/common/modules/simple-query-basics.c \ diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index 0259bfa757..95527ce898 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -647,7 +647,6 @@ bool ApplicationV8::prepareV8Instance (const size_t i) { files.push_back("common/bootstrap/module-fs.js"); files.push_back("common/bootstrap/module-console.js"); files.push_back("common/bootstrap/monkeypatches.js"); - files.push_back("common/bootstrap/print.js"); files.push_back("common/bootstrap/errors.js"); files.push_back("server/ahuacatl.js"); files.push_back("server/server.js"); diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index e812dd546b..b7eb852793 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -1317,7 +1317,6 @@ int main (int argc, char* argv[]) { files.push_back("common/bootstrap/monkeypatches.js"); } - files.push_back("common/bootstrap/print.js"); files.push_back("common/bootstrap/errors.js"); files.push_back("client/client.js"); diff --git a/html/admin/js/print.js b/html/admin/js/print.js deleted file mode 120000 index ef444857b5..0000000000 --- a/html/admin/js/print.js +++ /dev/null @@ -1 +0,0 @@ -../../../js/common/bootstrap/print.js \ No newline at end of file diff --git a/js/common/bootstrap/module-internal.js b/js/common/bootstrap/module-internal.js index 6f77916796..211ab3bf9e 100644 --- a/js/common/bootstrap/module-internal.js +++ b/js/common/bootstrap/module-internal.js @@ -218,6 +218,259 @@ /// @} //////////////////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// --SECTION-- private functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8ModuleInternal +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief prints objects to standard output +/// +/// @FUN{internal.printShell(@FA{arg1}, @FA{arg2}, @FA{arg3}, ...)} +/// +/// Only available in shell mode. +/// +/// Prints the arguments. If an argument is an object having a +/// function @FN{_PRINT}, then this function is called. Otherwise @FN{toJson} is +/// used. A final newline is printed +/// +/// @verbinclude fluent40 +//////////////////////////////////////////////////////////////////////////////// + + internal.printShell = function () { + var i; + + for (i = 0; i < arguments.length; ++i) { + if (0 < i) { + internal.output(" "); + } + + if (typeof(arguments[i]) === "string") { + internal.output(arguments[i]); + } + else { + internal.printRecursive(arguments[i], [], "~", [], 0); + } + } + + if (internal.COLOR_OUTPUT) { + internal.output(internal.COLOR_OUTPUT_RESET); + } + + internal.output("\n"); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief quote cache +//////////////////////////////////////////////////////////////////////////////// + + internal.characterQuoteCache = { + '\b': '\\b', // ASCII 8, Backspace + '\t': '\\t', // ASCII 9, Tab + '\n': '\\n', // ASCII 10, Newline + '\f': '\\f', // ASCII 12, Formfeed + '\r': '\\r', // ASCII 13, Carriage Return + '\"': '\\"', + '\\': '\\\\' + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief quotes a single character +//////////////////////////////////////////////////////////////////////////////// + + internal.quoteSingleJsonCharacter = function (c) { + if (internal.characterQuoteCache.hasOwnProperty[c]) { + return internal.characterQuoteCache[c]; + } + + var charCode = c.charCodeAt(0); + var result; + + if (charCode < 16) { + result = '\\u000'; + } + else if (charCode < 256) { + result = '\\u00'; + } + else if (charCode < 4096) { + result = '\\u0'; + } + else { + result = '\\u'; + } + + result += charCode.toString(16); + internal.characterQuoteCache[c] = result; + + return result; + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief quotes a string character +//////////////////////////////////////////////////////////////////////////////// + + internal.quoteJsonString = function (str) { + var quotable = /[\\\"\x00-\x1f]/g; + return '"' + str.replace(quotable, internal.quoteSingleJsonCharacter) + '"'; + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief prints objects to standard output without a new-line +//////////////////////////////////////////////////////////////////////////////// + + internal.printRecursive = function (value, seen, path, names, level) { + var p; + + if (seen === undefined) { + seen = []; + names = []; + } + + p = seen.indexOf(value); + + if (0 <= p) { + internal.output(names[p]); + } + else { + if (value instanceof Object) { + seen.push(value); + names.push(path); + } + + if (value instanceof Object) { + if ('_PRINT' in value) { + value._PRINT(seen, path, names, level); + } + else if (value instanceof Array) { + internal.printArray(value, seen, path, names, level); + } + else if (value.__proto__ === Object.prototype) { + internal.printObject(value, seen, path, names, level); + } + else if ('toString' in value) { + internal.output(value.toString()); + } + else { + internal.printObject(value, seen, path, names, level); + } + } + else if (value === undefined) { + internal.output("undefined"); + } + else { + if (typeof(value) === "string") { + internal.output(internal.quoteJsonString(value)); + } + else { + internal.output(String(value)); + } + } + } + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief JSON representation of an array +//////////////////////////////////////////////////////////////////////////////// + + internal.printArray = function (object, seen, path, names, level) { + if (object.length === 0) { + internal.output("[ ]"); + } + else { + var i; + var sep = ""; + + internal.output("["); + + var newLevel = level + 1; + + for (i = 0; i < object.length; i++) { + internal.output(sep); + + internal.printIndent(newLevel); + + internal.printRecursive(object[i], + seen, + path + "[" + i + "]", + names, + newLevel); + sep = ", "; + } + + internal.printIndent(level); + + internal.output("]"); + } + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief prints an object +//////////////////////////////////////////////////////////////////////////////// + + internal.printObject = function (object, seen, path, names, level) { + var sep = " "; + var k; + + internal.output("{"); + + var newLevel = level + 1; + + for (k in object) { + if (object.hasOwnProperty(k)) { + var val = object[k]; + + internal.output(sep); + + internal.printIndent(newLevel); + + if (internal.COLOR_OUTPUT) { + internal.output(internal.COLOR_OUTPUT_DEFAULT); + internal.output(internal.quoteJsonString(k)); + internal.output(internal.COLOR_OUTPUT_RESET); + internal.output(" : "); + } + else { + internal.output(internal.quoteJsonString(k), " : "); + } + + internal.printRecursive(val, + seen, + path + "[" + k + "]", + names, + newLevel); + sep = ", "; + } + } + + internal.printIndent(level); + + internal.output(" }"); + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief prints the ident for pretty printing +//////////////////////////////////////////////////////////////////////////////// + + internal.printIndent = function (level) { + var j; + + if (internal.PRETTY_PRINT) { + internal.output("\n"); + + for (j = 0; j < level; ++j) { + internal.output(" "); + } + } + }; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + // ----------------------------------------------------------------------------- // --SECTION-- public methods // ----------------------------------------------------------------------------- @@ -227,6 +480,16 @@ /// @{ //////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +/// @brief global print +//////////////////////////////////////////////////////////////////////////////// + + internal.print = internal.printShell; + + if (typeof internal.printBrowser === "function") { + internal.print = internal.printBrowser; + } + //////////////////////////////////////////////////////////////////////////////// /// @brief start pager //////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index 427144b4fc..5a86506638 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -240,6 +240,16 @@ function require (path) { return module.require(path); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief global print function +//////////////////////////////////////////////////////////////////////////////// + +function print () { + var internal = require("internal"); + + internal.print.apply(internal.print, arguments); +} + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// diff --git a/js/common/bootstrap/print.js b/js/common/bootstrap/print.js deleted file mode 100644 index 5bee1efc8d..0000000000 --- a/js/common/bootstrap/print.js +++ /dev/null @@ -1,331 +0,0 @@ -/*jslint indent: 2, - nomen: true, - maxlen: 100, - sloppy: true, - vars: true, - white: true, - plusplus: true */ -/*global require, print */ - -//////////////////////////////////////////////////////////////////////////////// -/// @brief printing -/// -/// @file -/// -/// DISCLAIMER -/// -/// Copyright 2010-2012 triagens GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is triAGENS GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - -(function () { - var internal = require("internal"); - -// ----------------------------------------------------------------------------- -// --SECTION-- Module "internal" -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -// --SECTION-- private functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Shell -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief prints objects to standard output -/// -/// @FUN{internal.printShell(@FA{arg1}, @FA{arg2}, @FA{arg3}, ...)} -/// -/// Only available in shell mode. -/// -/// Prints the arguments. If an argument is an object having a -/// function @FN{_PRINT}, then this function is called. Otherwise @FN{toJson} is -/// used. A final newline is printed -/// -/// @verbinclude fluent40 -//////////////////////////////////////////////////////////////////////////////// - - internal.printShell = function () { - var i; - - for (i = 0; i < arguments.length; ++i) { - if (0 < i) { - internal.output(" "); - } - - if (typeof(arguments[i]) === "string") { - internal.output(arguments[i]); - } - else { - internal.printRecursive(arguments[i], [], "~", [], 0); - } - } - - if (internal.COLOR_OUTPUT) { - internal.output(internal.COLOR_OUTPUT_RESET); - } - - internal.output("\n"); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief quote cache -//////////////////////////////////////////////////////////////////////////////// - - internal.characterQuoteCache = { - '\b': '\\b', // ASCII 8, Backspace - '\t': '\\t', // ASCII 9, Tab - '\n': '\\n', // ASCII 10, Newline - '\f': '\\f', // ASCII 12, Formfeed - '\r': '\\r', // ASCII 13, Carriage Return - '\"': '\\"', - '\\': '\\\\' - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief quotes a single character -//////////////////////////////////////////////////////////////////////////////// - - internal.quoteSingleJsonCharacter = function (c) { - if (internal.characterQuoteCache.hasOwnProperty[c]) { - return internal.characterQuoteCache[c]; - } - - var charCode = c.charCodeAt(0); - var result; - - if (charCode < 16) { - result = '\\u000'; - } - else if (charCode < 256) { - result = '\\u00'; - } - else if (charCode < 4096) { - result = '\\u0'; - } - else { - result = '\\u'; - } - - result += charCode.toString(16); - internal.characterQuoteCache[c] = result; - - return result; - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief quotes a string character -//////////////////////////////////////////////////////////////////////////////// - - internal.quoteJsonString = function (str) { - var quotable = /[\\\"\x00-\x1f]/g; - return '"' + str.replace(quotable, internal.quoteSingleJsonCharacter) + '"'; - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief prints objects to standard output without a new-line -//////////////////////////////////////////////////////////////////////////////// - - internal.printRecursive = function (value, seen, path, names, level) { - var p; - - if (seen === undefined) { - seen = []; - names = []; - } - - p = seen.indexOf(value); - - if (0 <= p) { - internal.output(names[p]); - } - else { - if (value instanceof Object) { - seen.push(value); - names.push(path); - } - - if (value instanceof Object) { - if ('_PRINT' in value) { - value._PRINT(seen, path, names, level); - } - else if (value instanceof Array) { - internal.printArray(value, seen, path, names, level); - } - else if (value.__proto__ === Object.prototype) { - internal.printObject(value, seen, path, names, level); - } - else if ('toString' in value) { - internal.output(value.toString()); - } - else { - internal.printObject(value, seen, path, names, level); - } - } - else if (value === undefined) { - internal.output("undefined"); - } - else { - if (typeof(value) === "string") { - internal.output(internal.quoteJsonString(value)); - } - else { - internal.output(String(value)); - } - } - } - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief prints the ident for pretty printing -/// -/// @FUN{internal.printIndent(@FA{level})} -/// -/// Only available in shell mode. -//////////////////////////////////////////////////////////////////////////////// - - internal.printIndent = function (level) { - var j; - - if (internal.PRETTY_PRINT) { - internal.output("\n"); - - for (j = 0; j < level; ++j) { - internal.output(" "); - } - } - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief JSON representation of an array -//////////////////////////////////////////////////////////////////////////////// - - internal.printArray = function (object, seen, path, names, level) { - if (object.length === 0) { - internal.output("[ ]"); - } - else { - var i; - var sep = ""; - - internal.output("["); - - var newLevel = level + 1; - - for (i = 0; i < object.length; i++) { - internal.output(sep); - - internal.printIndent(newLevel); - - internal.printRecursive(object[i], - seen, - path + "[" + i + "]", - names, - newLevel); - sep = ", "; - } - - internal.printIndent(level); - - internal.output("]"); - } - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @brief prints an object -//////////////////////////////////////////////////////////////////////////////// - - internal.printObject = function (object, seen, path, names, level) { - var sep = " "; - var k; - - internal.output("{"); - - var newLevel = level + 1; - - for (k in object) { - if (object.hasOwnProperty(k)) { - var val = object[k]; - - internal.output(sep); - - internal.printIndent(newLevel); - - if (internal.COLOR_OUTPUT) { - internal.output(internal.COLOR_OUTPUT_DEFAULT); - internal.output(internal.quoteJsonString(k)); - internal.output(internal.COLOR_OUTPUT_RESET); - internal.output(" : "); - } - else { - internal.output(internal.quoteJsonString(k), " : "); - } - - internal.printRecursive(val, - seen, - path + "[" + k + "]", - names, - newLevel); - sep = ", "; - } - } - - internal.printIndent(level); - - internal.output(" }"); - }; - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -}()); - -// ----------------------------------------------------------------------------- -// --SECTION-- global functions -// ----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// -/// @addtogroup V8Shell -/// @{ -//////////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// -/// @brief global print -//////////////////////////////////////////////////////////////////////////////// - -// must be a variable definition for the browser -if (typeof require("internal").printBrowser === "function") { - print = require("internal").print = require("internal").printBrowser; -} -else { - print = require("internal").print = require("internal").printShell; -} - -//////////////////////////////////////////////////////////////////////////////// -/// @} -//////////////////////////////////////////////////////////////////////////////// - -// Local Variables: -// mode: outline-minor -// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)" -// End: From acf596dcea8ea05f99c529f2fd4b0bfb7c00188b Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 6 Jan 2013 00:25:13 +0100 Subject: [PATCH 10/26] regenerated --- configure | 488 +++++++++++++++++++++++++++++------------------------- 1 file changed, 260 insertions(+), 228 deletions(-) diff --git a/configure b/configure index 3993e1ad0b..62ad969ff9 100755 --- a/configure +++ b/configure @@ -1,13 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for triAGENS ArangoDB 1.1.1. +# Generated by GNU Autoconf 2.69 for triAGENS ArangoDB 1.1.1. # # Report bugs to . # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -91,6 +89,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -135,6 +134,31 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -168,7 +192,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -213,14 +238,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -323,6 +359,14 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -444,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -478,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -499,28 +547,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1237,7 +1265,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1288,8 +1316,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1587,9 +1613,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF triAGENS ArangoDB configure 1.1.1 -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1633,7 +1659,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile @@ -1670,7 +1696,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp @@ -1708,7 +1734,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1745,7 +1771,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1777,7 +1803,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1791,7 +1817,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1833,7 +1859,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_run @@ -1865,7 +1891,7 @@ $as_echo "$ac_try_echo"; } >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1879,7 +1905,7 @@ fi # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link @@ -1892,10 +1918,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1962,7 +1988,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1971,7 +1997,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -2012,7 +2038,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -2026,7 +2052,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2044,7 +2070,7 @@ fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF @@ -2052,7 +2078,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by triAGENS ArangoDB $as_me 1.1.1, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2310,7 +2336,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;} || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -2564,7 +2590,7 @@ $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : +if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias @@ -2580,7 +2606,7 @@ fi $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2598,7 +2624,7 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : +if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then @@ -2613,7 +2639,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2631,7 +2657,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } -if test "${ac_cv_target+set}" = set; then : +if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then @@ -2646,7 +2672,7 @@ fi $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' @@ -2719,7 +2745,7 @@ am__api_version='1.12' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2739,7 +2765,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2803,11 +2829,11 @@ am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5 ;; + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's @@ -2911,7 +2937,7 @@ if test "$cross_compiling" != no; then set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2923,7 +2949,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2951,7 +2977,7 @@ if test -z "$ac_cv_prog_STRIP"; then set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2963,7 +2989,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3004,7 +3030,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : + if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3014,7 +3040,7 @@ do test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -3049,7 +3075,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -3061,7 +3087,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3089,7 +3115,7 @@ done $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3206,7 +3232,7 @@ esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if test "${am_cv_make_support_nested_variables+set}" = set; then : +if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) @@ -3344,7 +3370,7 @@ if test -z "$CXX"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -3356,7 +3382,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3388,7 +3414,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -3400,7 +3426,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3552,7 +3578,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3595,7 +3621,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3654,7 +3680,7 @@ $as_echo "$ac_try_echo"; } >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3665,7 +3691,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3706,7 +3732,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3716,7 +3742,7 @@ OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3753,7 +3779,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -3839,7 +3865,7 @@ depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3971,7 +3997,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then : + if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded @@ -4087,7 +4113,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -4108,7 +4134,7 @@ if test -n "$ac_tool_prefix"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -4120,7 +4146,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4152,7 +4178,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -4164,7 +4190,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4205,7 +4231,7 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -4234,7 +4260,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4271,7 +4297,7 @@ ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -4349,7 +4375,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4358,8 +4384,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -4448,7 +4473,7 @@ depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4588,7 +4613,7 @@ if test -z "$CXX"; then set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4600,7 +4625,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4632,7 +4657,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : +if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then @@ -4644,7 +4669,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -4710,7 +4735,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : +if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4747,7 +4772,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } -if test "${ac_cv_prog_cxx_g+set}" = set; then : +if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag @@ -4833,7 +4858,7 @@ depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -4969,7 +4994,7 @@ if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -5085,7 +5110,7 @@ else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -5103,7 +5128,7 @@ $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then : +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5236,7 +5261,7 @@ fi $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -5437,7 +5462,7 @@ if test -n "$ac_tool_prefix"; then set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5449,7 +5474,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5477,7 +5502,7 @@ if test -z "$ac_cv_prog_RANLIB"; then set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5489,7 +5514,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -5730,7 +5755,7 @@ if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if test "${ac_cv_sys_largefile_CC+set}" = set; then : +if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no @@ -5781,7 +5806,7 @@ $as_echo "$ac_cv_sys_largefile_CC" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test "${ac_cv_sys_file_offset_bits+set}" = set; then : +if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -5850,7 +5875,7 @@ rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if test "${ac_cv_sys_large_files+set}" = set; then : +if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do @@ -5917,6 +5942,8 @@ _ACEOF esac rm -rf conftest* fi + + fi @@ -6068,7 +6095,7 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; } set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_acx_pthread_config+set}" = set; then : +if ${ac_cv_prog_acx_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$acx_pthread_config"; then @@ -6080,7 +6107,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6224,7 +6251,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then : +if ${ac_cv_prog_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then @@ -6236,7 +6263,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6388,7 +6415,7 @@ $as_echo "$as_me: .............................................................. set dummy dot; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_DOT_EXEC+set}" = set; then : +if ${ac_cv_path_DOT_EXEC+:} false; then : $as_echo_n "(cached) " >&6 else case $DOT_EXEC in @@ -6402,7 +6429,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DOT_EXEC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6449,7 +6476,7 @@ fi set dummy markdown; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_MARKDOWN_EXEC+set}" = set; then : +if ${ac_cv_path_MARKDOWN_EXEC+:} false; then : $as_echo_n "(cached) " >&6 else case $MARKDOWN_EXEC in @@ -6463,7 +6490,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MARKDOWN_EXEC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6508,7 +6535,7 @@ fi set dummy html2text; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_HTML2TEXT_EXEC+set}" = set; then : +if ${ac_cv_path_HTML2TEXT_EXEC+:} false; then : $as_echo_n "(cached) " >&6 else case $HTML2TEXT_EXEC in @@ -6522,7 +6549,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_HTML2TEXT_EXEC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6664,7 +6691,7 @@ $as_echo "$as_me: .............................................................. set dummy bison; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_BISON+set}" = set; then : +if ${ac_cv_prog_BISON+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$BISON"; then @@ -6676,7 +6703,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_BISON="bison" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6744,7 +6771,7 @@ do set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_LEX+set}" = set; then : +if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then @@ -6756,7 +6783,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -6788,7 +6815,8 @@ a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } -e { yyless (input () != 0); } +e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ + yyless ((input () != 0)); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% @@ -6814,7 +6842,7 @@ $as_echo "$ac_try_echo"; } >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } -if test "${ac_cv_prog_lex_root+set}" = set; then : +if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6833,7 +6861,7 @@ LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } -if test "${ac_cv_lib_lex+set}" = set; then : +if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else @@ -6863,7 +6891,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } -if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then : +if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the @@ -6874,7 +6902,8 @@ ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#define YYTEXT_POINTER 1 + + #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : @@ -6951,7 +6980,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sincos in -lm" >&5 $as_echo_n "checking for sincos in -lm... " >&6; } -if test "${ac_cv_lib_m_sincos+set}" = set; then : +if ${ac_cv_lib_m_sincos+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6985,7 +7014,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sincos" >&5 $as_echo "$ac_cv_lib_m_sincos" >&6; } -if test "x$ac_cv_lib_m_sincos" = x""yes; then : +if test "x$ac_cv_lib_m_sincos" = xyes; then : MATH_LIBS="-lm" fi @@ -7091,7 +7120,7 @@ if test "x$tr_READLINE" = xyes -o "x$tr_READLINE" = xmaybe; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -7105,7 +7134,7 @@ do for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -7154,7 +7183,7 @@ $as_echo "$ac_cv_path_GREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -7171,7 +7200,7 @@ do for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -7221,7 +7250,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7351,7 +7380,7 @@ done for ac_header in readline/readline.h do : ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default" -if test "x$ac_cv_header_readline_readline_h" = x""yes; then : +if test "x$ac_cv_header_readline_readline_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_READLINE_READLINE_H 1 _ACEOF @@ -7399,7 +7428,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 $as_echo_n "checking for readline in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_readline+set}" = set; then : +if ${ac_cv_lib_readline_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7433,7 +7462,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 $as_echo "$ac_cv_lib_readline_readline" >&6; } -if test "x$ac_cv_lib_readline_readline" = x""yes; then : +if test "x$ac_cv_lib_readline_readline" = xyes; then : READLINE_LIBS="-lreadline $READLINE_LIBS" else tr_library_found=no @@ -7613,7 +7642,7 @@ SAVE_LIBS="$LIBS" for ac_header in openssl/ssl.h do : ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default" -if test "x$ac_cv_header_openssl_ssl_h" = x""yes; then : +if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENSSL_SSL_H 1 _ACEOF @@ -7625,7 +7654,7 @@ done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_get_ex_data in -lcrypto" >&5 $as_echo_n "checking for CRYPTO_get_ex_data in -lcrypto... " >&6; } -if test "${ac_cv_lib_crypto_CRYPTO_get_ex_data+set}" = set; then : +if ${ac_cv_lib_crypto_CRYPTO_get_ex_data+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7659,7 +7688,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_get_ex_data" >&5 $as_echo "$ac_cv_lib_crypto_CRYPTO_get_ex_data" >&6; } -if test "x$ac_cv_lib_crypto_CRYPTO_get_ex_data" = x""yes; then : +if test "x$ac_cv_lib_crypto_CRYPTO_get_ex_data" = xyes; then : OPENSSL_LIBS="-lcrypto $OPENSSL_LIBS" else as_fn_error $? "please install the OpenSSL library" "$LINENO" 5 @@ -7668,7 +7697,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_get_error in -lssl" >&5 $as_echo_n "checking for SSL_get_error in -lssl... " >&6; } -if test "${ac_cv_lib_ssl_SSL_get_error+set}" = set; then : +if ${ac_cv_lib_ssl_SSL_get_error+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7702,7 +7731,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_get_error" >&5 $as_echo "$ac_cv_lib_ssl_SSL_get_error" >&6; } -if test "x$ac_cv_lib_ssl_SSL_get_error" = x""yes; then : +if test "x$ac_cv_lib_ssl_SSL_get_error" = xyes; then : OPENSSL_LIBS="-lssl $OPENSSL_LIBS" else as_fn_error $? "Please install the OpenSSL library" "$LINENO" 5 @@ -7778,7 +7807,7 @@ $as_echo "$tr_OPENSSL_NEEDS_ZLIB" >&6; } if test "x$tr_OPENSSL_NEEDS_ZLIB" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zError in -lz" >&5 $as_echo_n "checking for zError in -lz... " >&6; } -if test "${ac_cv_lib_z_zError+set}" = set; then : +if ${ac_cv_lib_z_zError+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7812,7 +7841,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zError" >&5 $as_echo "$ac_cv_lib_z_zError" >&6; } -if test "x$ac_cv_lib_z_zError" = x""yes; then : +if test "x$ac_cv_lib_z_zError" = xyes; then : OPENSSL_LIBS="$OPENSSL_LIBS -lz" else as_fn_error $? "please install the static zlib library" "$LINENO" 5 @@ -8091,7 +8120,7 @@ ch_LIBEV="$tr_LIBEV" for ac_header in ev.h do : ac_fn_c_check_header_mongrel "$LINENO" "ev.h" "ac_cv_header_ev_h" "$ac_includes_default" -if test "x$ac_cv_header_ev_h" = x""yes; then : +if test "x$ac_cv_header_ev_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EV_H 1 _ACEOF @@ -8106,7 +8135,7 @@ done if test "x$tr_LIBEV" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 $as_echo_n "checking for clock_gettime in -lrt... " >&6; } -if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then : +if ${ac_cv_lib_rt_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8140,7 +8169,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } -if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then : +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : LIBEV_LIBS="-lrt $LIBEV_LIBS" LIBS="-lrt $LIBS" fi @@ -8180,7 +8209,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ev_now in -lev" >&5 $as_echo_n "checking for ev_now in -lev... " >&6; } -if test "${ac_cv_lib_ev_ev_now+set}" = set; then : +if ${ac_cv_lib_ev_ev_now+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8214,7 +8243,7 @@ LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ev_ev_now" >&5 $as_echo "$ac_cv_lib_ev_ev_now" >&6; } -if test "x$ac_cv_lib_ev_ev_now" = x""yes; then : +if test "x$ac_cv_lib_ev_ev_now" = xyes; then : LIBEV_LIBS="-lev $LIBEV_LIBS" else tr_library_found=no @@ -8481,7 +8510,7 @@ tr_V8="yes" as_ac_Lib=`$as_echo "ac_cv_lib_v8_v8::V8::GetVersion()" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for v8::V8::GetVersion() in -lv8" >&5 $as_echo_n "checking for v8::V8::GetVersion() in -lv8... " >&6; } -if eval "test \"\${$as_ac_Lib+set}\"" = set; then : +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8815,10 +8844,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -8954,7 +8994,7 @@ if test -z "${ENABLE_MRUBY_TRUE}" && test -z "${ENABLE_MRUBY_FALSE}"; then Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -9055,6 +9095,7 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -9250,16 +9291,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -9319,28 +9360,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -9362,7 +9391,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by triAGENS ArangoDB $as_me 1.1.1, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -9429,10 +9458,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ triAGENS ArangoDB config.status 1.1.1 -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -9523,7 +9552,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -9563,7 +9592,7 @@ do "config/config.h") CONFIG_HEADERS="$CONFIG_HEADERS config/config.h" ;; "lib/BasicsC/local-configuration.h") CONFIG_HEADERS="$CONFIG_HEADERS lib/BasicsC/local-configuration.h" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -9586,9 +9615,10 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -9596,12 +9626,13 @@ $debug || { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -9623,7 +9654,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -9651,7 +9682,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -9699,7 +9730,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -9731,7 +9762,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -9765,7 +9796,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -9777,8 +9808,8 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -9879,7 +9910,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -9898,7 +9929,7 @@ do for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -9907,7 +9938,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -9933,8 +9964,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -10070,21 +10101,22 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -10095,20 +10127,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. From fb881581e10c1f74b3b34f2cc8efa5f4dcc83df8 Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 6 Jan 2013 01:31:32 +0100 Subject: [PATCH 11/26] fixed GUI --- Makefile.in | 7 +- html/admin/index.html | 9 +- .../js/{avocsh1.js => arangodb/browser.js} | 162 ++++++++++-------- html/admin/js/arangodb/client.js | 1 + html/admin/js/arangodb/errors.js | 1 + html/admin/js/arangodb/module-internal.js | 1 + html/admin/js/arangodb/monkeypatches.js | 1 + html/admin/js/client.js | 1 - html/admin/js/errors.js | 1 - html/admin/js/master.js | 3 +- js/Makefile.files | 7 +- js/actions/system/api-system.js | 2 - js/client/client.js | 6 - js/common/bootstrap/module-console.js | 2 - js/common/bootstrap/module-fs.js | 2 - js/common/bootstrap/module-internal.js | 116 ++++++++----- js/common/bootstrap/modules.js | 3 + js/common/modules/jslint/jslint.js | 10 +- 18 files changed, 191 insertions(+), 144 deletions(-) rename html/admin/js/{avocsh1.js => arangodb/browser.js} (87%) create mode 120000 html/admin/js/arangodb/client.js create mode 120000 html/admin/js/arangodb/errors.js create mode 120000 html/admin/js/arangodb/module-internal.js create mode 120000 html/admin/js/arangodb/monkeypatches.js delete mode 120000 html/admin/js/client.js delete mode 120000 html/admin/js/errors.js diff --git a/Makefile.in b/Makefile.in index 5f3d71afbf..9c0f1f2e6c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1733,17 +1733,18 @@ WIKI = \ jsUnity JAVASCRIPT_JSLINT = \ + @srcdir@/html/admin/js/arangodb/browser.js \ @srcdir@/js/actions/system/api-collection.js \ @srcdir@/js/actions/system/api-structure.js \ @srcdir@/js/common/bootstrap/errors.js \ - @srcdir@/js/common/bootstrap/modules.js \ - @srcdir@/js/common/bootstrap/module-internal.js \ @srcdir@/js/common/bootstrap/module-console.js \ @srcdir@/js/common/bootstrap/module-fs.js \ + @srcdir@/js/common/bootstrap/module-internal.js \ + @srcdir@/js/common/bootstrap/modules.js \ @srcdir@/js/common/bootstrap/monkeypatches.js \ + @srcdir@/js/server/ArangoCollection.js \ @srcdir@/js/server/modules/org/arangodb.js \ @srcdir@/js/server/modules/org/arangodb/actions.js \ - @srcdir@/js/server/ArangoCollection.js \ @srcdir@/js/server/ArangoStructure.js @ENABLE_ALL_IN_ONE_ICU_TRUE@ICUDIR = @abs_top_srcdir@/3rdParty/icu/BUILD diff --git a/html/admin/index.html b/html/admin/index.html index cf6194f8a3..dae9e088a0 100644 --- a/html/admin/index.html +++ b/html/admin/index.html @@ -27,13 +27,14 @@ - - - + + + + - +