mirror of https://gitee.com/bigwinds/arangodb
Merge branch '1.0' of github.com:triAGENS/ArangoDB
Conflicts: CHANGELOG CONTRIBUTING.md Doxygen/arango-html.doxy Doxygen/arango-latex.doxy Doxygen/arango-xml.doxy Doxygen/arango.template Makefile.in Makefile.local Makefile.unittests VERSION config/config.sub configure configure.ac js/actions/system/api-system.js js/client/js-client.h js/common/bootstrap/js-modules.h js/server/js-ahuacatl.h packetize.sh
This commit is contained in:
commit
939c5ece15
16
CHANGELOG
16
CHANGELOG
|
@ -1,5 +1,10 @@
|
|||
not released yet
|
||||
----------------
|
||||
v1.1.beta1 (2012-XX-XX)
|
||||
-----------------------
|
||||
|
||||
* WARNING:
|
||||
- the user has changed from "arango" to "arangodb", the start script has changed from
|
||||
"arangod" to "arangodb", the database directory has changed from "/var/arangodb" to
|
||||
"/var/lib/arangodb" to be compliant with various Linux policies
|
||||
|
||||
* having the OpenSSL library installed is now a prerequisite to compiling ArangoDB
|
||||
removed the --enable-ssl configure option
|
||||
|
@ -112,9 +117,14 @@ not released yet
|
|||
as before. The Javascript API in the shell also offers a new update() method in extension to
|
||||
the previously existing replace() method.
|
||||
|
||||
v1.0.1 (2012-XX-XX)
|
||||
|
||||
v1.0.1 (2012-09-30)
|
||||
-------------------
|
||||
|
||||
* added AQL function TO_LIST
|
||||
|
||||
* draft for issue #165: front-end application howto
|
||||
|
||||
* updated mruby to cf8fdea4a6598aa470e698e8cbc9b9b492319d
|
||||
|
||||
* fix for issue #190: install doesn't create log directory
|
||||
|
|
|
@ -17,7 +17,7 @@ Please follow these guidelines if you want to contribute to ArangoDB:
|
|||
* bug fixes should be done in the "devel" first, before being applied to master or other branches
|
||||
* If missing, install the required prerequisites. They are listed [here](https://github.com/triAGENS/ArangoDB/wiki/Compiling).
|
||||
* configure and make your local clone. If you intend to modify the parser files, please make sure to active the --enable-maintainer-mode configure option. In this case, you also need to have Python installed.
|
||||
* Make sure your local unmodified clone works locally before making any code changes. You can do so by running the included test suite (i.e. make unittests)
|
||||
* Make sure the unmodified clone works locally before making any code changes. You can do so by running the included test suite (i.e. make unittests)
|
||||
* If you intend to do documentation changes, you also must install Doxygen in any recent version.
|
||||
|
||||
## Making Changes
|
||||
|
@ -28,6 +28,7 @@ Please follow these guidelines if you want to contribute to ArangoDB:
|
|||
* If the modifications change any documented behavior or add new features, document the changes. The documentation can be found in arangod/Documentation directory. To recreate the documentation locally, run make doxygen. This will re-create all documentation files in the Doxygen directory in your repository. You can inspect the documentation in this folder using a text editor or a browser
|
||||
* When done, run the complete test suite and make sure all tests pass
|
||||
* When finished, push the changes to your GitHub repository and send a pull request from your fork to the ArangoDB repository. Please make sure to select the appropriate branches there
|
||||
* You must use the Apache License for your changes
|
||||
|
||||
## Additional Resources
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<?php include "../include/footer.php" ?>
|
|
@ -1 +0,0 @@
|
|||
<?php include "../include/header.php" ?>
|
|
@ -1,22 +1,19 @@
|
|||
# -*- mode: Makefile; -*-
|
||||
|
||||
MANUAL_DST="www@www.arangodb.org:/var/www/www.arangodb.org/avoc/manuals"
|
||||
IMAGES_DST="www@www.arangodb.org:/var/www/www.arangodb.org/avoc/manuals/images"
|
||||
MANUAL_DST=www@www.arangodb.org:/var/www/www.arangodb.org/avoc/manuals
|
||||
IMAGES_DST=www@www.arangodb.org:/var/www/www.arangodb.org/avoc/manuals/images
|
||||
|
||||
OUTPUT_FOLDER="Doxygen/manuals/$(PACKAGE_VERSION)"
|
||||
OUTPUT_FOLDER=Doxygen/manuals/$(PACKAGE_VERSION)
|
||||
|
||||
################################################################################
|
||||
## publish
|
||||
################################################################################
|
||||
|
||||
.PHONY: publish publish-prepare publish-wiki publish-html publish-pdf
|
||||
.PHONY: publish publish-wiki publish-html publish-pdf
|
||||
|
||||
publish: publish-prepare publish-wiki publish-html publish-pdf
|
||||
publish: publish-wiki publish-html publish-pdf
|
||||
cd Doxygen/manuals && scp -r "$(PACKAGE_VERSION)" $(MANUAL_DST)
|
||||
|
||||
publish-prepare:
|
||||
@test -d $(OUTPUT_FOLDER) || mkdir -p $(OUTPUT_FOLDER)
|
||||
|
||||
publish-wiki:
|
||||
(cd Doxygen/wiki && git checkout --force -- . && git clean -f -d -x && git pull)
|
||||
$(MAKE) wiki
|
||||
|
|
|
@ -168,9 +168,9 @@ echo
|
|||
echo "########################################################"
|
||||
echo "Call mkepmlist to create a sublist"
|
||||
|
||||
for dir in js/actions/system js/server js/server/modules js/server/modules/org/arangodb js/client js/client/modules js/common/modules js/common/bootstrap; do
|
||||
echo " mkepmlist -u ${susr} -g ${sgrp} --prefix ${share_base}/${dir} ${sfolder_name}/${dir}/*.js >> ${SUBLIST}"
|
||||
mkepmlist -u ${susr} -g ${sgrp} --prefix ${share_base}/${dir} ${sfolder_name}/${dir}/*.js >> ${SUBLIST}
|
||||
for dir in `find js -type d`; do
|
||||
echo " mkepmlist -u ${susr} -g ${sgrp} --prefix ${share_base}/${dir} ${sfolder_name}/${dir}/*.js >> ${SUBLIST}"
|
||||
mkepmlist -u ${susr} -g ${sgrp} --prefix ${share_base}/${dir} ${sfolder_name}/${dir}/*.js >> ${SUBLIST}
|
||||
done
|
||||
|
||||
for dir in . css css/images media media/icons media/images js js/modules; do
|
||||
|
|
5869
Makefile.in
5869
Makefile.in
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,134 +0,0 @@
|
|||
|
||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
||||
|
||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
T_END = 0,
|
||||
T_FOR = 258,
|
||||
T_LET = 259,
|
||||
T_FILTER = 260,
|
||||
T_RETURN = 261,
|
||||
T_COLLECT = 262,
|
||||
T_SORT = 263,
|
||||
T_LIMIT = 264,
|
||||
T_ASC = 265,
|
||||
T_DESC = 266,
|
||||
T_IN = 267,
|
||||
T_INTO = 268,
|
||||
T_NULL = 269,
|
||||
T_TRUE = 270,
|
||||
T_FALSE = 271,
|
||||
T_STRING = 272,
|
||||
T_QUOTED_STRING = 273,
|
||||
T_NUMBER = 274,
|
||||
T_PARAMETER = 275,
|
||||
T_ASSIGN = 276,
|
||||
T_NOT = 277,
|
||||
T_AND = 278,
|
||||
T_OR = 279,
|
||||
T_EQ = 280,
|
||||
T_NE = 281,
|
||||
T_LT = 282,
|
||||
T_GT = 283,
|
||||
T_LE = 284,
|
||||
T_GE = 285,
|
||||
T_PLUS = 286,
|
||||
T_MINUS = 287,
|
||||
T_TIMES = 288,
|
||||
T_DIV = 289,
|
||||
T_MOD = 290,
|
||||
T_EXPAND = 291,
|
||||
T_QUESTION = 292,
|
||||
T_COLON = 293,
|
||||
T_COMMA = 294,
|
||||
T_OPEN = 295,
|
||||
T_CLOSE = 296,
|
||||
T_DOC_OPEN = 297,
|
||||
T_DOC_CLOSE = 298,
|
||||
T_LIST_OPEN = 299,
|
||||
T_LIST_CLOSE = 300,
|
||||
UPLUS = 301,
|
||||
UMINUS = 302,
|
||||
FUNCCALL = 303,
|
||||
REFERENCE = 304,
|
||||
INDEXED = 305
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 26 "arangod/Ahuacatl/ahuacatl-grammar.y"
|
||||
|
||||
TRI_aql_node_t* node;
|
||||
char* strval;
|
||||
bool boolval;
|
||||
int64_t intval;
|
||||
|
||||
|
||||
|
||||
/* Line 1676 of yacc.c */
|
||||
#line 112 "arangod/Ahuacatl/ahuacatl-grammar.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
||||
typedef struct YYLTYPE
|
||||
{
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
} YYLTYPE;
|
||||
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYLTYPE_IS_DECLARED 1
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -384,10 +384,34 @@
|
|||
/// <ul>
|
||||
/// <li>@ref UserManualActionsIntro</li>
|
||||
/// <li>@ref UserManualActionsHelloWorld</li>
|
||||
/// <li>@ref UserManualActionsMatches
|
||||
/// <ul>
|
||||
/// <li>@ref UserManualActionsMatchesExact</li>
|
||||
/// <li>@ref UserManualActionsMatchesPrefix</li>
|
||||
/// <li>@ref UserManualActionsMatchesParameterized</li>
|
||||
/// <li>@ref UserManualActionsMatchesConstraint</li>
|
||||
/// <li>@ref UserManualActionsMatchesOptional</li>
|
||||
/// <li>@ref UserManualActionsMatchesMethod</li>
|
||||
/// <li>@ref UserManualActionsMatching</li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// <li>@ref UserManualActionsHelloJson</li>
|
||||
/// <li>@ref UserManualActionsEcho</li>
|
||||
/// <li>@ref UserManualActionsDYO</li>
|
||||
/// <li>@ref UserManualActionsAdvanced</li>
|
||||
/// <li>@ref UserManualActionsContent
|
||||
/// <ul>
|
||||
/// <li>@ref UserManualActionsContentStatic</li>
|
||||
/// <li>@ref UserManualActionsContentAction</li>
|
||||
/// <li>@ref UserManualActionsContentController</li>
|
||||
/// <li>@ref UserManualActionsContentPrefix</li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// <li>@ref UserManualActionsReqRes</li>
|
||||
/// <li>@ref UserManualActionsAdvanced
|
||||
/// <ul>
|
||||
/// <li>@ref UserManualActionsAdvancedRedirects</li>
|
||||
/// <li>@ref UserManualActionsAdvancedBundles</li>
|
||||
/// <li>@ref UserManualActionsAdvancedMiddleware</li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// </ul>
|
||||
|
@ -488,8 +512,8 @@
|
|||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/hello/world",
|
||||
/// ........> callback: {
|
||||
/// ........> url: { match: "/hello/world" },
|
||||
/// ........> content: {
|
||||
/// ........> contentType: "text/html",
|
||||
/// ........> body: "<html><body>Hello World</body></html>" }});
|
||||
/// @endcode
|
||||
|
@ -498,13 +522,186 @@
|
|||
/// or call the internal reload function.
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> require("internal").reloadRouting()
|
||||
/// arangosh> require("org/arangodb/routing").reload()
|
||||
/// @endcode
|
||||
///
|
||||
/// Now use the browser and access
|
||||
///
|
||||
/// @LIT{http://localhost:8529/hello/world}
|
||||
///
|
||||
/// You should see the @LIT{Hello World} in our browser.
|
||||
///
|
||||
/// @section UserManualActionsMatches Matching an URL
|
||||
/////////////////////////////////////////////////////
|
||||
///
|
||||
/// There are a lot of options for the @LIT{url} attribute. If you define
|
||||
/// different routing for the same path, then the following simple rule is
|
||||
/// applied in order to determine which match wins: If there are two matches,
|
||||
/// then the more specific wins. I. e, if there is a wildcard match and an exact
|
||||
/// match, the exact match is prefered. If there is a short and a long match,
|
||||
/// the longer match wins.
|
||||
///
|
||||
/// @subsection UserManualActionsMatchesExact Exact Match
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/world" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the match must be exact. Only the request for @LIT{/hello/world} will
|
||||
/// match, everything else, e. g. @LIT{/hello/world/my} or @LIT{/hello/world2},
|
||||
/// will not match.
|
||||
///
|
||||
/// The following definition is a short-cut for an exact match.
|
||||
///
|
||||
/// @code
|
||||
/// { url: "/hello/world" }
|
||||
/// @endcode
|
||||
///
|
||||
/// @subsection UserManualActionsMatchesPrefix Prefix Match
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/world/*" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the match can be a prefix match. The requests for @LIT{/hello/world},
|
||||
/// @LIT{/hello/world/my}, and @LIT{/hello/world/how/are/you} will all
|
||||
/// match. However @LIT{/hello/world2} does not match. Prefix matches within an
|
||||
/// URL part, i. e. @LIT{/hello/world*}, are not allowed. The wildcard must
|
||||
/// occur at the end, i. e.
|
||||
///
|
||||
/// @code
|
||||
/// /hello/*/world
|
||||
/// @endcode
|
||||
///
|
||||
/// is also disallowed.
|
||||
///
|
||||
/// If you define two routes
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/world/*" } }
|
||||
/// { url: { match: "/hello/world/emil" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the second route will be used for @LIT{/hello/world/emil} because it is
|
||||
/// more specific.
|
||||
///
|
||||
/// @subsection UserManualActionsMatchesParameterized Parameterized Match
|
||||
///
|
||||
/// A parameterized match is similar to a prefix match, but the parameters are
|
||||
/// also allowed inside the URL path.
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/:name/world" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the URL must have three parts, the first part being @LIT{hello} and the
|
||||
/// third part @LIT{world}. For example, @LIT{/hello/emil/world} will match,
|
||||
/// while @LIT{/hello/emil/meyer/world} will not.
|
||||
///
|
||||
/// @subsection UserManualActionsMatchesConstraint Constraint Match
|
||||
///
|
||||
/// A constraint match is similar to a parameterized match, but the parameters
|
||||
/// carries a constraint.
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/:name/world", constraint: { name: "/[a-z]+/" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the URL must have three parts, the first part being @LIT{hello} and the
|
||||
/// third part @LIT{world}. The second part must be all lowercase.
|
||||
///
|
||||
/// It is possible to use more then one constraint for the same URL part.
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/:name|:id/world",
|
||||
/// constraint: { name: "/[a-z]+/", id: "/[0-9]+/" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// @subsection UserManualActionsMatchesOptional Optional Match
|
||||
///
|
||||
/// An optional match is similar to a parameterized match, but the last
|
||||
/// parameter is optional.
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/:name?", constraint: { name: "/[a-z]+/" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the URL @LIT{/hello} and @LIT{/hello/emil} will match.
|
||||
///
|
||||
/// If the definitions are
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/world" } }
|
||||
/// { url: { match: "/hello/:name", constraint: { name: "/[a-z]+/" } }
|
||||
/// { url: { match: "/hello/*" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// then the URL @LIT{/hello/world} will be matched by the first route, because it
|
||||
/// is the most specific. The URL @LIT{/hello/you} will be matched by the second
|
||||
/// route, because it is more specific than the prefix match.
|
||||
///
|
||||
/// @subsection UserManualActionsMatchesMethod Method Restriction
|
||||
///
|
||||
/// You can restrict the match to specific methods.
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/world", methods: [ "post", "put" ] }
|
||||
/// @endcode
|
||||
///
|
||||
/// then only @LIT{POST} and @LIT{PUT} requests will match.
|
||||
///
|
||||
/// @subsection UserManualActionsMatching More on Matching
|
||||
///
|
||||
/// Remember that the more specific match wins.
|
||||
///
|
||||
/// - A match without parameter or wildcard is more specific than a match with
|
||||
/// parameters or wildcard.
|
||||
/// - A match with parameter is more specific than a match with a wildcard.
|
||||
/// - If there is more than one parameter, specificity is applied from left to
|
||||
/// right.
|
||||
///
|
||||
/// Consider the following definitions
|
||||
///
|
||||
/// @code
|
||||
/// (1) { url: { match: "/hello/world" } }
|
||||
/// (2) { url: { match: "/hello/:name", constraint: { name: "/[a-z]+/" } }
|
||||
/// (3) { url: { match: "/:something/world" }
|
||||
/// (4) { url: { match: "/hello/*" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// Then
|
||||
///
|
||||
/// - @LIT{/hello/world} is match by (1)
|
||||
/// - @LIT{/hello/emil} is match by (2)
|
||||
/// - @LIT{/your/world} is match by (3)
|
||||
/// - @LIT{/hello/you} is match by (4)
|
||||
///
|
||||
/// You can write the following document into the @LIT{_routing} collection
|
||||
/// to test the above examples.
|
||||
///
|
||||
/// @code
|
||||
/// {
|
||||
/// routes: [
|
||||
/// { url: { match: "/hello/world" }, content: "route 1" },
|
||||
/// { url: { match: "/hello/:name|:id", constraint: { name: "/[a-z]+/", id: "/[0-9]+/" } }, content: "route 2" },
|
||||
/// { url: { match: "/:something/world" }, content: "route 3" },
|
||||
/// { url: { match: "/hello/*" }, content: "route 4" },
|
||||
/// ]
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// @section UserManualActionsHelloJson A Hello World Example for JSON
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
///
|
||||
|
@ -512,8 +709,8 @@
|
|||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/hello/json",
|
||||
/// ........> callback: {
|
||||
/// ........> url: "/hello/json",
|
||||
/// ........> content: {
|
||||
/// ........> contentType: "application/json",
|
||||
/// ........> body: "{ \"hello\" : \"world\" }" }});
|
||||
/// arangosh> require("internal").reloadRouting()
|
||||
|
@ -534,18 +731,165 @@
|
|||
/// { "hello" : "world" }
|
||||
/// @endcode
|
||||
///
|
||||
/// @section UserManualActionsEcho A Dynamic Example
|
||||
////////////////////////////////////////////////////
|
||||
/// @section UserManualActionsContent Delivering Content
|
||||
////////////////////////////////////////////////////////
|
||||
///
|
||||
/// The above examples deliver static content, which is fine for an example.
|
||||
/// But the real power of actions lies in dynamic actions which use JavaScript
|
||||
/// to construct the result.
|
||||
/// There are a lot of different ways on how to deliver content. We have already
|
||||
/// seen the simplest one, where static content is delivered. The fun, however,
|
||||
/// starts when delivering dynamic content.
|
||||
///
|
||||
/// @subsection UserManualActionsContentStatic Static Content
|
||||
///
|
||||
/// You can specify a body and a content-type.
|
||||
///
|
||||
/// @code
|
||||
/// { content: {
|
||||
/// contentType: "text/html",
|
||||
/// body: "<html><body>Hallo World</body></html>"
|
||||
/// }
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// If the content type is @LIT{text/plain} then you can use the short-cut
|
||||
///
|
||||
/// @code
|
||||
/// { content: "Hallo World" }
|
||||
/// @endcode
|
||||
///
|
||||
/// @subsection UserManualActionsContentAction A Simple Action
|
||||
///
|
||||
/// The simplest dynamic action is:
|
||||
///
|
||||
/// @code
|
||||
/// { action: { controller: "org/arangodb/actions", do: "echoRequest" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// It is not possible to store functions directly in the routing table, but you
|
||||
/// can call functions defined in modules. In the above example the function can
|
||||
/// be accessed from JavaScript as:
|
||||
///
|
||||
/// @LIT{require("org/arangodb/actions").echoRequest}
|
||||
///
|
||||
/// The function @LIT{echoRequest} is pre-defined. It takes the request objects
|
||||
/// and echos it in the response.
|
||||
///
|
||||
/// The signature of such a function must be
|
||||
///
|
||||
/// @code
|
||||
/// function (req, res, options, next)
|
||||
/// @endcode
|
||||
///
|
||||
/// For example
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> url: "/hello/echo",
|
||||
/// ........> action: "org/arangodb/actions/echoRequest" });
|
||||
/// @endcode
|
||||
///
|
||||
/// Reload the routing and check
|
||||
///
|
||||
/// @LIT{http://127.0.0.1:8529/hello/echo}
|
||||
///
|
||||
/// You should see something like
|
||||
///
|
||||
/// @code
|
||||
/// {
|
||||
/// "request": {
|
||||
/// "path": "/hello/echo",
|
||||
/// "headers": {
|
||||
/// "accept-encoding": "gzip, deflate",
|
||||
/// "accept-language": "de-de,de;q=0.8,en-us;q=0.5,en;q=0.3",
|
||||
/// "connection": "keep-alive",
|
||||
/// "content-length": "0",
|
||||
/// "host": "localhost:8529",
|
||||
/// "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0"
|
||||
/// },
|
||||
/// "requestType": "GET",
|
||||
/// "parameters": { }
|
||||
/// },
|
||||
/// "options": { }
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// The request might contain @LIT{path}, @LIT{prefix}, @LIT{suffix}, and
|
||||
/// @LIT{urlParameters} attributes. @LIT{path} is the complete path as supplied
|
||||
/// by the user and always available. If a prefix was matched, then this prefix
|
||||
/// is stored in the attribute @LIT{prefix} and the remaining URL parts are
|
||||
/// stored as an array in @LIT{suffix}. If one or more parameters were matched,
|
||||
/// then the parameter values are stored in @LIT{urlParameters}.
|
||||
///
|
||||
/// For example, if the url description is
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: "/hello/:name/:action" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// and you request the path @LIT{/hello/emil/jump}, then the request object
|
||||
/// will contain the following attribute
|
||||
///
|
||||
/// @code
|
||||
/// urlParameters: { name: "emil", action: "jump" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// @subsection UserManualActionsContentController Action Controller
|
||||
///
|
||||
/// As an alternative to the simple action, you can use controllers. A
|
||||
/// controller is a module, defines the function @LIT{get}, @LIT{put},
|
||||
/// @LIT{post}, @LIT{delete}, @LIT{head}, @LIT{patch}. If a request of
|
||||
/// the corresponding type is matched, the function will be called.
|
||||
///
|
||||
/// For example
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> url: "/hello/echo",
|
||||
/// ........> action: { controller: "org/arangodb/actions/echoController" } });
|
||||
/// @endcode
|
||||
///
|
||||
/// @subsection UserManualActionsContentPrefix Prefix Action Controller
|
||||
///
|
||||
/// The controller is selected when the definition is read. There is a
|
||||
/// more flexible, but slower and maybe insecure variant, the prefix
|
||||
/// controller.
|
||||
///
|
||||
/// Assume that the url is a prefix match
|
||||
///
|
||||
/// @code
|
||||
/// { url: { match: /hello/*" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// You can use
|
||||
///
|
||||
/// @code
|
||||
/// { action: { prefixController: "org/arangodb/actions" } }
|
||||
/// @endcode
|
||||
///
|
||||
/// to define a prefix controller. If the URL @LIT{/hello/echoController} is
|
||||
/// given, then the module @LIT{org/arangodb/actions/echoController} is used.
|
||||
///
|
||||
/// If you use an prefix controller, you should make certain that no unwanted
|
||||
/// actions are available under the prefix.
|
||||
///
|
||||
/// The definition
|
||||
///
|
||||
/// @code
|
||||
/// { action: "org/arangodb/actions" }
|
||||
/// @endcode
|
||||
///
|
||||
/// is a short-cut for a prefix controller definition.
|
||||
///
|
||||
/// @section UserManualActionsReqRes Requests and Responses
|
||||
///////////////////////////////////////////////////////////
|
||||
///
|
||||
/// The controller must define handler functions which take a request object and
|
||||
/// fill the response object.
|
||||
///
|
||||
/// A very simple example is the function @LIT{echoRequest} defined in
|
||||
/// the module @LIT{org/arangodb/actions}.
|
||||
///
|
||||
/// @code
|
||||
/// function (req, res, next, options) {
|
||||
/// function (req, res, options, next) {
|
||||
/// var result;
|
||||
///
|
||||
/// result = { request: req, options: options };
|
||||
|
@ -556,21 +900,12 @@
|
|||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// That functions accepts a request and returns this request as JSON object.
|
||||
///
|
||||
/// It is not possible to store functions directly in the routing table, but you
|
||||
/// can call functions defined in modules. In the above example the function can
|
||||
/// be accessed from JavaScript as:
|
||||
///
|
||||
/// @LIT{require("org/arangodb/actions").echoRequest}
|
||||
///
|
||||
/// You can use it in the routing collection by specifying the name
|
||||
/// @LIT{"org/arangodb/actions/echoRequest"}.
|
||||
/// Install it as
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/hello/echo",
|
||||
/// ........> callback: "org/arangodb/actions/echoRequest" });
|
||||
/// ........> url: "/echo",
|
||||
/// ........> action: "org/arangodb/actions/echoRequest" });
|
||||
/// @endcode
|
||||
///
|
||||
/// Reload the routing and check
|
||||
|
@ -603,30 +938,30 @@
|
|||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// Please note that
|
||||
/// Note that
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/hello/echo",
|
||||
/// ........> callback: "org/arangodb/actions/echoRequest" });
|
||||
/// ........> url: "/echo",
|
||||
/// ........> action: "org/arangodb/actions/echoRequest" });
|
||||
/// @endcode
|
||||
///
|
||||
/// is a short-cut for
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/hello/echo-long",
|
||||
/// ........> callback: {
|
||||
/// ........> for: "org/arangodb/actions",
|
||||
/// ........> do: "echoRequest" }});
|
||||
/// ........> url: "/echo",
|
||||
/// ........> action: { do: "org/arangodb/actions/echoRequest" } });
|
||||
/// @endcode
|
||||
///
|
||||
/// The verbose form allows you to pass options to the called function:
|
||||
/// The latter form allows you to pass options to the called function:
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> a = db._routing.firstExample({path: "/hello/echo-long"});
|
||||
/// arangosh> a.callback.options = { option: "my option1" };
|
||||
/// arangosh> db._replace(a, a);
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> url: "/echo",
|
||||
/// ........> action: {
|
||||
/// ........> do: "org/arangodb/actions/echoRequest",
|
||||
/// ........> options: { "Hallo": "World" } } });
|
||||
/// @endcode
|
||||
///
|
||||
/// You should now see the options in the result.
|
||||
|
@ -643,98 +978,68 @@
|
|||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// @section UserManualActionsDYO Define Your Own Callback
|
||||
//////////////////////////////////////////////////////////
|
||||
///
|
||||
/// You can define your own callbacks by adding a new module to ArangoDB. In
|
||||
/// order to avoid name clashes modules should be named
|
||||
///
|
||||
/// @LIT{tld/domain/modulename}
|
||||
///
|
||||
/// where @LIT{domain.tld} is your domain name. For development you can store
|
||||
/// your code in files in the filesystem, see @ref MODULES_PATH and
|
||||
/// @ref MODULES.
|
||||
///
|
||||
/// However, when you are finished with the development, you can rollout the
|
||||
/// module code by storing it inside the @LIT{_modules} collection.
|
||||
///
|
||||
/// Create a file @LIT{hello-world.js} with the following content:
|
||||
///
|
||||
/// @code
|
||||
/// var actions = require("org/arangodb/actions");
|
||||
///
|
||||
/// exports.helloWorld = function (req, res) {
|
||||
/// res.contentType = "text/html";
|
||||
/// res.responseCode = actions.HTTP_OK;
|
||||
/// res.body = "<html><body>Hello World!</body></html>";
|
||||
/// };
|
||||
/// @endcode
|
||||
///
|
||||
/// Load this file as new module @LIT{de/celler/hello-world} into the database
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> require("internal").defineModule("de/celler/hello-world", "hello-world.js");
|
||||
/// @endcode
|
||||
///
|
||||
/// Define a corresponding routing
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/my/echo",
|
||||
/// ........> callback: "de/celler/hello-world/helloWorld" });
|
||||
/// arangosh> require("internal").reloadRouting()
|
||||
/// @endcode
|
||||
///
|
||||
/// and check it
|
||||
///
|
||||
/// @LIT{http://localhost:8529/my/echo}
|
||||
///
|
||||
/// @section UserManualActionsAdvanced Advanced Usages
|
||||
//////////////////////////////////////////////////////
|
||||
///
|
||||
/// For detailed information see the reference manual.
|
||||
///
|
||||
/// @subsection UserManualActionsAdvancedPrefix Using Prefixes
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// @subsection UserManualActionsAdvancedRedirects Redirects
|
||||
///
|
||||
/// All the above definitions require an exact match. If you set the
|
||||
/// @LIT{prefix} attribute to @LIT{true}, additional paths are ignored and the
|
||||
/// URL also results in a match.
|
||||
/// Use the following for a permanent redirect:
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/hello",
|
||||
/// ........> prefix: true,
|
||||
/// ........> callback: "org/arangodb/actions/echoRequest" });
|
||||
/// ........> url: "/",
|
||||
/// ........> action: {
|
||||
/// ........> do: "org/arangodb/actions/redirectRequest",
|
||||
/// ........> options: {
|
||||
/// ........> permanently: true,
|
||||
/// ........> destination: "http://somewhere.else/" } } });
|
||||
/// @endcode
|
||||
///
|
||||
/// Now try
|
||||
/// @subsection UserManualActionsAdvancedBundles Routing Bundles
|
||||
///
|
||||
/// @LIT{http://localhost:8529/hello/this/is/ignored/but/available/in/path}
|
||||
///
|
||||
/// The complete path is available in the @LIT{path} attribute, while the
|
||||
/// matched prefix is available in the @LIT{prefix} attribute.
|
||||
/// Instead of adding all routes for package separately, you can
|
||||
/// specify a bundle.
|
||||
///
|
||||
/// @code
|
||||
/// {
|
||||
/// "request": {
|
||||
/// "prefix": "/hello",
|
||||
/// "path": "/hello/this/is/ignored/but/available/in/path",
|
||||
/// ...
|
||||
/// },
|
||||
/// "options": { }
|
||||
/// routes: [
|
||||
/// { url: "/url1", content: "..." },
|
||||
/// { url: "/url2", content: "..." },
|
||||
/// { url: "/url3", content: "..." },
|
||||
/// ...
|
||||
/// ]
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// The advantage is, that you can put all your routes into one document
|
||||
/// and use a common prefix.
|
||||
///
|
||||
/// @code
|
||||
/// {
|
||||
/// urlPrefix: "/test",
|
||||
///
|
||||
/// routes: [
|
||||
/// { url: "/url1", content: "..." },
|
||||
/// { url: "/url2", content: "..." },
|
||||
/// { url: "/url3", content: "..." },
|
||||
/// ...
|
||||
/// ]
|
||||
/// }
|
||||
/// @endcode
|
||||
///
|
||||
/// will define the URL @LIT{/test/url1}, @LIT{/test/url2}, and
|
||||
/// @LIT{/test/url3}.
|
||||
///
|
||||
/// @subsection UserManualActionsAdvancedMiddleware Writing Middleware
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
///
|
||||
/// Assume, you want to log every request. In this case you can easily define
|
||||
/// an action for the whole url-space @LIT{/}. This action simply logs
|
||||
/// the requests, calls the next in line, and logs the response.
|
||||
///
|
||||
/// @code
|
||||
/// exports.logRequest = function (req, res, next, options) {
|
||||
/// exports.logRequest = function (req, res, options, next) {
|
||||
/// console.log("received request: %s", JSON.stringify(req));
|
||||
/// next();
|
||||
/// console.log("produced response: %s", JSON.stringify(res));
|
||||
|
@ -747,23 +1052,10 @@
|
|||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/",
|
||||
/// ........> topdown: true,
|
||||
/// ........> prefix: true,
|
||||
/// ........> callback: "org/arangodb/actions/logRequest" });
|
||||
/// @endcode
|
||||
///
|
||||
/// @subsection UserManualActionsAdvancedeRedirect Redirects
|
||||
////////////////////////////////////////////////////////////
|
||||
///
|
||||
/// Use the following for a permanent redirect:
|
||||
///
|
||||
/// @code
|
||||
/// arangosh> db._routing.save({
|
||||
/// ........> path: "/",
|
||||
/// ........> topdown: true,
|
||||
/// ........> prefix: true,
|
||||
/// ........> callback: { redirect: "http://somewhere.else.org/hallo" });
|
||||
/// ........> middleware: [
|
||||
/// ........> { url: { match: "/*" }, action: "org/arangodb/actions/logRequest" }
|
||||
/// ........> ]
|
||||
/// ........> });
|
||||
/// @endcode
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -774,5 +1066,5 @@
|
|||
// Local Variables:
|
||||
// mode: c++
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
||||
// outline-regexp: "\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @section\\|/// @subsection\\|/// @\\}\\)"
|
||||
// End:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
780
config/depcomp
780
config/depcomp
|
@ -1,780 +0,0 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2012-07-12.20; # UTC
|
||||
|
||||
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' "$nl" < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
|
||||
# However on
|
||||
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\':
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
# tcc 0.9.26 (FIXME still under development at the moment of writing)
|
||||
# will emit a similar output, but also prepend the continuation lines
|
||||
# with horizontal tabulation characters.
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form 'foo.o: dependent.h',
|
||||
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# '$object: dependent.h' and one to simply 'dependent.h:'.
|
||||
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
|
||||
< "$tmpdepfile" > "$depfile"
|
||||
sed '
|
||||
s/[ '"$tab"'][ '"$tab"']*/ /g
|
||||
s/^ *//
|
||||
s/ *\\*$//
|
||||
s/^[^:]*: *//
|
||||
/^$/d
|
||||
/:$/d
|
||||
s/$/ :/
|
||||
' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'`
|
||||
tmpdepfile="$base.d"
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir="$base.d-lock"
|
||||
trap "echo '$0: caught signal, cleaning up...' >&2; rm -rf $lockdir" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0 ; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir $lockdir 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rm -rf $lockdir
|
||||
break
|
||||
else
|
||||
## the lock is being held by a different process,
|
||||
## wait until the winning process is done or we timeout
|
||||
while test -d $lockdir && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test "$stat" = 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -43,55 +43,74 @@
|
|||
/// @brief routing function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function Routing (req, res) {
|
||||
var callbacks;
|
||||
var current;
|
||||
var i;
|
||||
var next;
|
||||
function Routing (req, res) {
|
||||
var execute;
|
||||
var next;
|
||||
var path = req.suffix.join("/");
|
||||
|
||||
callbacks = actions.routing(req.requestType, req.suffix);
|
||||
current = 0;
|
||||
action = actions.firstRouting(req.requestType, req.suffix);
|
||||
|
||||
next = function () {
|
||||
var callback;
|
||||
execute = function () {
|
||||
if (action.route === undefined) {
|
||||
actions.resultNotImplemented(req, res, "unknown path '" + path + "'");
|
||||
return;
|
||||
}
|
||||
|
||||
if (callbacks.length <= current) {
|
||||
actions.resultNotImplemented(req, res,
|
||||
"unknown path '" + req.suffix.join("/") + "'");
|
||||
return;
|
||||
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.suffix !== undefined) {
|
||||
req.suffix = action.suffix;
|
||||
}
|
||||
else {
|
||||
delete req.suffix;
|
||||
}
|
||||
|
||||
if (action.urlParameters !== undefined) {
|
||||
req.urlParameters = action.urlParameters;
|
||||
}
|
||||
else {
|
||||
req.urlParameters = {};
|
||||
}
|
||||
|
||||
action.route.callback.controller(req, res, action.route.callback.options, next);
|
||||
}
|
||||
|
||||
callback = callbacks[current++];
|
||||
next = function () {
|
||||
action = actions.nextRouting(action);
|
||||
execute();
|
||||
}
|
||||
|
||||
if (callback == null) {
|
||||
actions.resultNotImplemented(req, res,
|
||||
"not implemented '" + req.suffix.join("/") + "'");
|
||||
}
|
||||
else {
|
||||
req.prefix = callback.path;
|
||||
callback.func(req, res, next, callback.options);
|
||||
}
|
||||
execute();
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
actions.defineHttp({
|
||||
url : "",
|
||||
prefix : true,
|
||||
context : "admin",
|
||||
callback : Routing
|
||||
});
|
||||
|
||||
actions.defineHttp({
|
||||
url : "",
|
||||
prefix : true,
|
||||
context : "admin",
|
||||
callback : Routing
|
||||
});
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/reloadRouting",
|
||||
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 : "_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);
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
|
@ -106,39 +125,6 @@ actions.defineHttp({
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns redirection to index page
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function AdminRedirect (req, res) {
|
||||
var dest = "/_admin/html/index.html";
|
||||
|
||||
res.responseCode = actions.HTTP_MOVED_PERMANENTLY;
|
||||
res.contentType = "text/html";
|
||||
|
||||
res.body = "<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href=\""
|
||||
+ dest
|
||||
+ "\">"
|
||||
+ dest
|
||||
+ "</a>.</p></body></html>";
|
||||
|
||||
res.headers = { location : dest };
|
||||
}
|
||||
|
||||
actions.defineHttp({
|
||||
url : "",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : AdminRedirect
|
||||
});
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : AdminRedirect
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_GET_admin_time
|
||||
/// @brief returns the system time
|
||||
|
@ -151,14 +137,14 @@ actions.defineHttp({
|
|||
/// 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
|
||||
|
@ -177,16 +163,16 @@ actions.defineHttp({
|
|||
/// - @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
|
||||
|
|
|
@ -406,10 +406,24 @@ function help () {
|
|||
|
||||
internal.reloadRouting = function () {
|
||||
if (typeof arango !== 'undefined') {
|
||||
arango.POST("/_admin/reloadRouting", "");
|
||||
arango.POST("/_admin/routing/reload", "");
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief rebuilds the routing cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.routingCache = function () {
|
||||
var result;
|
||||
|
||||
if (typeof arango !== 'undefined') {
|
||||
result = arango.GET("/_admin/routing/routes", "");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,142 +0,0 @@
|
|||
const char* JS_common_bootstrap_errors[] = {
|
||||
"/*jslint indent: 2,",
|
||||
" nomen: true,",
|
||||
" maxlen: 240,",
|
||||
" sloppy: true,",
|
||||
" vars: true,",
|
||||
" white: true,",
|
||||
" plusplus: true */",
|
||||
"/*global require */",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief auto-generated file generated from errors.dat",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"(function () {",
|
||||
" var internal = require(\"internal\");",
|
||||
"",
|
||||
" internal.errors = {",
|
||||
" \"ERROR_NO_ERROR\" : { \"code\" : 0, \"message\" : \"no error\" }, ",
|
||||
" \"ERROR_FAILED\" : { \"code\" : 1, \"message\" : \"failed\" }, ",
|
||||
" \"ERROR_SYS_ERROR\" : { \"code\" : 2, \"message\" : \"system error\" }, ",
|
||||
" \"ERROR_OUT_OF_MEMORY\" : { \"code\" : 3, \"message\" : \"out of memory\" }, ",
|
||||
" \"ERROR_INTERNAL\" : { \"code\" : 4, \"message\" : \"internal error\" }, ",
|
||||
" \"ERROR_ILLEGAL_NUMBER\" : { \"code\" : 5, \"message\" : \"illegal number\" }, ",
|
||||
" \"ERROR_NUMERIC_OVERFLOW\" : { \"code\" : 6, \"message\" : \"numeric overflow\" }, ",
|
||||
" \"ERROR_ILLEGAL_OPTION\" : { \"code\" : 7, \"message\" : \"illegal option\" }, ",
|
||||
" \"ERROR_DEAD_PID\" : { \"code\" : 8, \"message\" : \"dead process identifier\" }, ",
|
||||
" \"ERROR_NOT_IMPLEMENTED\" : { \"code\" : 9, \"message\" : \"not implemented\" }, ",
|
||||
" \"ERROR_BAD_PARAMETER\" : { \"code\" : 10, \"message\" : \"bad parameter\" }, ",
|
||||
" \"ERROR_FORBIDDEN\" : { \"code\" : 11, \"message\" : \"forbidden\" }, ",
|
||||
" \"ERROR_OUT_OF_MEMORY_MMAP\" : { \"code\" : 12, \"message\" : \"out of memory in mmap\" }, ",
|
||||
" \"ERROR_CORRUPTED_CSV\" : { \"code\" : 13, \"message\" : \"csv is corrupt\" }, ",
|
||||
" \"ERROR_HTTP_BAD_PARAMETER\" : { \"code\" : 400, \"message\" : \"bad parameter\" }, ",
|
||||
" \"ERROR_HTTP_FORBIDDEN\" : { \"code\" : 403, \"message\" : \"forbidden\" }, ",
|
||||
" \"ERROR_HTTP_NOT_FOUND\" : { \"code\" : 404, \"message\" : \"not found\" }, ",
|
||||
" \"ERROR_HTTP_METHOD_NOT_ALLOWED\" : { \"code\" : 405, \"message\" : \"method not supported\" }, ",
|
||||
" \"ERROR_HTTP_SERVER_ERROR\" : { \"code\" : 500, \"message\" : \"internal server error\" }, ",
|
||||
" \"ERROR_HTTP_CORRUPTED_JSON\" : { \"code\" : 600, \"message\" : \"invalid JSON object\" }, ",
|
||||
" \"ERROR_HTTP_SUPERFLUOUS_SUFFICES\" : { \"code\" : 601, \"message\" : \"superfluous URL suffices\" }, ",
|
||||
" \"ERROR_ARANGO_ILLEGAL_STATE\" : { \"code\" : 1000, \"message\" : \"illegal state\" }, ",
|
||||
" \"ERROR_ARANGO_SHAPER_FAILED\" : { \"code\" : 1001, \"message\" : \"illegal shaper\" }, ",
|
||||
" \"ERROR_ARANGO_DATAFILE_SEALED\" : { \"code\" : 1002, \"message\" : \"datafile sealed\" }, ",
|
||||
" \"ERROR_ARANGO_UNKNOWN_COLLECTION_TYPE\" : { \"code\" : 1003, \"message\" : \"unknown type\" }, ",
|
||||
" \"ERROR_ARANGO_READ_ONLY\" : { \"code\" : 1004, \"message\" : \"ready only\" }, ",
|
||||
" \"ERROR_ARANGO_DUPLICATE_IDENTIFIER\" : { \"code\" : 1005, \"message\" : \"duplicate identifier\" }, ",
|
||||
" \"ERROR_ARANGO_DATAFILE_UNREADABLE\" : { \"code\" : 1006, \"message\" : \"datafile unreadable\" }, ",
|
||||
" \"ERROR_ARANGO_CORRUPTED_DATAFILE\" : { \"code\" : 1100, \"message\" : \"corrupted datafile\" }, ",
|
||||
" \"ERROR_ARANGO_ILLEGAL_PARAMETER_FILE\" : { \"code\" : 1101, \"message\" : \"illegal parameter file\" }, ",
|
||||
" \"ERROR_ARANGO_CORRUPTED_COLLECTION\" : { \"code\" : 1102, \"message\" : \"corrupted collection\" }, ",
|
||||
" \"ERROR_ARANGO_MMAP_FAILED\" : { \"code\" : 1103, \"message\" : \"mmap failed\" }, ",
|
||||
" \"ERROR_ARANGO_FILESYSTEM_FULL\" : { \"code\" : 1104, \"message\" : \"filesystem full\" }, ",
|
||||
" \"ERROR_ARANGO_NO_JOURNAL\" : { \"code\" : 1105, \"message\" : \"no journal\" }, ",
|
||||
" \"ERROR_ARANGO_DATAFILE_ALREADY_EXISTS\" : { \"code\" : 1106, \"message\" : \"cannot create/rename datafile because it already exists\" }, ",
|
||||
" \"ERROR_ARANGO_DATABASE_LOCKED\" : { \"code\" : 1107, \"message\" : \"database is locked\" }, ",
|
||||
" \"ERROR_ARANGO_COLLECTION_DIRECTORY_ALREADY_EXISTS\" : { \"code\" : 1108, \"message\" : \"cannot create/rename collection because directory already exists\" }, ",
|
||||
" \"ERROR_ARANGO_CONFLICT\" : { \"code\" : 1200, \"message\" : \"conflict\" }, ",
|
||||
" \"ERROR_ARANGO_WRONG_VOCBASE_PATH\" : { \"code\" : 1201, \"message\" : \"wrong path for database\" }, ",
|
||||
" \"ERROR_ARANGO_DOCUMENT_NOT_FOUND\" : { \"code\" : 1202, \"message\" : \"document not found\" }, ",
|
||||
" \"ERROR_ARANGO_COLLECTION_NOT_FOUND\" : { \"code\" : 1203, \"message\" : \"collection not found\" }, ",
|
||||
" \"ERROR_ARANGO_COLLECTION_PARAMETER_MISSING\" : { \"code\" : 1204, \"message\" : \"parameter 'collection' not found\" }, ",
|
||||
" \"ERROR_ARANGO_DOCUMENT_HANDLE_BAD\" : { \"code\" : 1205, \"message\" : \"illegal document handle\" }, ",
|
||||
" \"ERROR_ARANGO_MAXIMAL_SIZE_TOO_SMALL\" : { \"code\" : 1206, \"message\" : \"maixaml size of journal too small\" }, ",
|
||||
" \"ERROR_ARANGO_DUPLICATE_NAME\" : { \"code\" : 1207, \"message\" : \"duplicate name\" }, ",
|
||||
" \"ERROR_ARANGO_ILLEGAL_NAME\" : { \"code\" : 1208, \"message\" : \"illegal name\" }, ",
|
||||
" \"ERROR_ARANGO_NO_INDEX\" : { \"code\" : 1209, \"message\" : \"no suitable index known\" }, ",
|
||||
" \"ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED\" : { \"code\" : 1210, \"message\" : \"unique constraint violated\" }, ",
|
||||
" \"ERROR_ARANGO_GEO_INDEX_VIOLATED\" : { \"code\" : 1211, \"message\" : \"geo index violated\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_NOT_FOUND\" : { \"code\" : 1212, \"message\" : \"index not found\" }, ",
|
||||
" \"ERROR_ARANGO_CROSS_COLLECTION_REQUEST\" : { \"code\" : 1213, \"message\" : \"cross collection request not allowed\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_HANDLE_BAD\" : { \"code\" : 1214, \"message\" : \"illegal index handle\" }, ",
|
||||
" \"ERROR_ARANGO_CAP_CONSTRAINT_ALREADY_DEFINED\" : { \"code\" : 1215, \"message\" : \"cap constraint already defined\" }, ",
|
||||
" \"ERROR_ARANGO_DOCUMENT_TOO_LARGE\" : { \"code\" : 1216, \"message\" : \"document too large\" }, ",
|
||||
" \"ERROR_ARANGO_COLLECTION_NOT_UNLOADED\" : { \"code\" : 1217, \"message\" : \"collection must be unloaded\" }, ",
|
||||
" \"ERROR_ARANGO_COLLECTION_TYPE_INVALID\" : { \"code\" : 1218, \"message\" : \"collection type invalid\" }, ",
|
||||
" \"ERROR_ARANGO_DATAFILE_FULL\" : { \"code\" : 1300, \"message\" : \"datafile full\" }, ",
|
||||
" \"ERROR_QUERY_KILLED\" : { \"code\" : 1500, \"message\" : \"query killed\" }, ",
|
||||
" \"ERROR_QUERY_PARSE\" : { \"code\" : 1501, \"message\" : \"%s\" }, ",
|
||||
" \"ERROR_QUERY_EMPTY\" : { \"code\" : 1502, \"message\" : \"query is empty\" }, ",
|
||||
" \"ERROR_QUERY_SCRIPT\" : { \"code\" : 1503, \"message\" : \"runtime error '%s'\" }, ",
|
||||
" \"ERROR_QUERY_NUMBER_OUT_OF_RANGE\" : { \"code\" : 1504, \"message\" : \"number out of range\" }, ",
|
||||
" \"ERROR_QUERY_VARIABLE_NAME_INVALID\" : { \"code\" : 1510, \"message\" : \"variable name '%s' has an invalid format\" }, ",
|
||||
" \"ERROR_QUERY_VARIABLE_REDECLARED\" : { \"code\" : 1511, \"message\" : \"variable '%s' is assigned multiple times\" }, ",
|
||||
" \"ERROR_QUERY_VARIABLE_NAME_UNKNOWN\" : { \"code\" : 1512, \"message\" : \"unknown variable '%s'\" }, ",
|
||||
" \"ERROR_QUERY_COLLECTION_NOT_FOUND\" : { \"code\" : 1520, \"message\" : \"unable to open collection '%s'\" }, ",
|
||||
" \"ERROR_QUERY_COLLECTION_LOCK_FAILED\" : { \"code\" : 1521, \"message\" : \"unable to read-lock collection %s\" }, ",
|
||||
" \"ERROR_QUERY_TOO_MANY_COLLECTIONS\" : { \"code\" : 1522, \"message\" : \"too many collections\" }, ",
|
||||
" \"ERROR_QUERY_DOCUMENT_ATTRIBUTE_REDECLARED\" : { \"code\" : 1530, \"message\" : \"document attribute '%s' is assigned multiple times\" }, ",
|
||||
" \"ERROR_QUERY_FUNCTION_NAME_UNKNOWN\" : { \"code\" : 1540, \"message\" : \"usage of unknown function '%s'\" }, ",
|
||||
" \"ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH\" : { \"code\" : 1541, \"message\" : \"invalid number of arguments for function '%s'\" }, ",
|
||||
" \"ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH\" : { \"code\" : 1542, \"message\" : \"invalid argument type used in call to function '%s()'\" }, ",
|
||||
" \"ERROR_QUERY_BIND_PARAMETERS_INVALID\" : { \"code\" : 1550, \"message\" : \"invalid structure of bind parameters\" }, ",
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_MISSING\" : { \"code\" : 1551, \"message\" : \"no value specified for declared bind parameter '%s'\" }, ",
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_UNDECLARED\" : { \"code\" : 1552, \"message\" : \"bind parameter '%s' was not declared in the query\" }, ",
|
||||
" \"ERROR_QUERY_BIND_PARAMETER_TYPE\" : { \"code\" : 1553, \"message\" : \"bind parameter '%s' has an invalid value or type\" }, ",
|
||||
" \"ERROR_QUERY_INVALID_LOGICAL_VALUE\" : { \"code\" : 1560, \"message\" : \"invalid logical value\" }, ",
|
||||
" \"ERROR_QUERY_INVALID_ARITHMETIC_VALUE\" : { \"code\" : 1561, \"message\" : \"invalid arithmetic value\" }, ",
|
||||
" \"ERROR_QUERY_DIVISION_BY_ZERO\" : { \"code\" : 1562, \"message\" : \"division by zero\" }, ",
|
||||
" \"ERROR_QUERY_LIST_EXPECTED\" : { \"code\" : 1563, \"message\" : \"list expected\" }, ",
|
||||
" \"ERROR_QUERY_FAIL_CALLED\" : { \"code\" : 1569, \"message\" : \"FAIL(%s) called\" }, ",
|
||||
" \"ERROR_QUERY_GEO_INDEX_MISSING\" : { \"code\" : 1570, \"message\" : \"no suitable geo index found for geo restriction on '%s'\" }, ",
|
||||
" \"ERROR_CURSOR_NOT_FOUND\" : { \"code\" : 1600, \"message\" : \"cursor not found\" }, ",
|
||||
" \"ERROR_KEYVALUE_INVALID_KEY\" : { \"code\" : 1800, \"message\" : \"invalid key declaration\" }, ",
|
||||
" \"ERROR_KEYVALUE_KEY_EXISTS\" : { \"code\" : 1801, \"message\" : \"key already exists\" }, ",
|
||||
" \"ERROR_KEYVALUE_KEY_NOT_FOUND\" : { \"code\" : 1802, \"message\" : \"key not found\" }, ",
|
||||
" \"ERROR_KEYVALUE_KEY_NOT_UNIQUE\" : { \"code\" : 1803, \"message\" : \"key is not unique\" }, ",
|
||||
" \"ERROR_KEYVALUE_KEY_NOT_CHANGED\" : { \"code\" : 1804, \"message\" : \"key value not changed\" }, ",
|
||||
" \"ERROR_KEYVALUE_KEY_NOT_REMOVED\" : { \"code\" : 1805, \"message\" : \"key value not removed\" }, ",
|
||||
" \"ERROR_KEYVALUE_NO_VALUE\" : { \"code\" : 1806, \"message\" : \"missing value\" }, ",
|
||||
" \"ERROR_GRAPH_INVALID_GRAPH\" : { \"code\" : 1901, \"message\" : \"invalid graph\" }, ",
|
||||
" \"ERROR_GRAPH_COULD_NOT_CREATE_GRAPH\" : { \"code\" : 1902, \"message\" : \"could not create graph\" }, ",
|
||||
" \"ERROR_GRAPH_INVALID_VERTEX\" : { \"code\" : 1903, \"message\" : \"invalid vertex\" }, ",
|
||||
" \"ERROR_GRAPH_COULD_NOT_CREATE_VERTEX\" : { \"code\" : 1904, \"message\" : \"could not create vertex\" }, ",
|
||||
" \"ERROR_GRAPH_COULD_NOT_CHANGE_VERTEX\" : { \"code\" : 1905, \"message\" : \"could not change vertex\" }, ",
|
||||
" \"ERROR_GRAPH_INVALID_EDGE\" : { \"code\" : 1906, \"message\" : \"invalid edge\" }, ",
|
||||
" \"ERROR_GRAPH_COULD_NOT_CREATE_EDGE\" : { \"code\" : 1907, \"message\" : \"could not create edge\" }, ",
|
||||
" \"ERROR_GRAPH_COULD_NOT_CHANGE_EDGE\" : { \"code\" : 1908, \"message\" : \"could not change edge\" }, ",
|
||||
" \"SIMPLE_CLIENT_UNKNOWN_ERROR\" : { \"code\" : 2000, \"message\" : \"unknown client error\" }, ",
|
||||
" \"SIMPLE_CLIENT_COULD_NOT_CONNECT\" : { \"code\" : 2001, \"message\" : \"could not connect to server\" }, ",
|
||||
" \"SIMPLE_CLIENT_COULD_NOT_WRITE\" : { \"code\" : 2002, \"message\" : \"could not write to server\" }, ",
|
||||
" \"SIMPLE_CLIENT_COULD_NOT_READ\" : { \"code\" : 2003, \"message\" : \"could not read from server\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_PQ_INSERT_FAILED\" : { \"code\" : 3100, \"message\" : \"priority queue insert failure\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_PQ_REMOVE_FAILED\" : { \"code\" : 3110, \"message\" : \"priority queue remove failure\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_PQ_REMOVE_ITEM_MISSING\" : { \"code\" : 3111, \"message\" : \"priority queue remove failure - item missing in index\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_HASH_INSERT_ITEM_DUPLICATED\" : { \"code\" : 3312, \"message\" : \"(non-unique) hash index insert failure - document duplicated in index\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_SKIPLIST_INSERT_ITEM_DUPLICATED\" : { \"code\" : 3313, \"message\" : \"(non-unique) skiplist index insert failure - document duplicated in index\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_HASH_DOCUMENT_ATTRIBUTE_MISSING\" : { \"code\" : 3200, \"message\" : \"hash index insertion warning - attribute missing in document\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_HASH_UPDATE_ATTRIBUTE_MISSING\" : { \"code\" : 3202, \"message\" : \"hash index update warning - attribute missing in revised document\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_HASH_REMOVE_ITEM_MISSING\" : { \"code\" : 3211, \"message\" : \"hash index remove failure - item missing in index\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_SKIPLIST_DOCUMENT_ATTRIBUTE_MISSING\" : { \"code\" : 3300, \"message\" : \"skiplist index insertion warning - attribute missing in document\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_SKIPLIST_UPDATE_ATTRIBUTE_MISSING\" : { \"code\" : 3302, \"message\" : \"skiplist index update warning - attribute missing in revised document\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_MISSING\" : { \"code\" : 3311, \"message\" : \"skiplist index remove failure - item missing in index\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_BITARRAY_DOCUMENT_ATTRIBUTE_MISSING\" : { \"code\" : 3400, \"message\" : \"bitarray index insertion warning - attribute missing in document\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING\" : { \"code\" : 3402, \"message\" : \"bitarray index update warning - attribute missing in revised document\" }, ",
|
||||
" \"WARNING_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING\" : { \"code\" : 3411, \"message\" : \"bitarray index remove failure - item missing in index\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE\" : { \"code\" : 3413, \"message\" : \"bitarray index insert failure - document attribute value unsupported in index\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES\" : { \"code\" : 3415, \"message\" : \"bitarray index creation failure - one or more index attributes are duplicated.\" }, ",
|
||||
" \"ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES\" : { \"code\" : 3417, \"message\" : \"bitarray index creation failure - one or more index attribute values are duplicated.\" }, ",
|
||||
"};",
|
||||
"}());",
|
||||
"",
|
||||
"//__end__"
|
||||
};
|
|
@ -1,638 +0,0 @@
|
|||
const char* JS_common_bootstrap_modules[] = {
|
||||
"/*jslint indent: 2,",
|
||||
" nomen: true,",
|
||||
" maxlen: 100,",
|
||||
" sloppy: true,",
|
||||
" vars: true,",
|
||||
" white: true,",
|
||||
" plusplus: true */",
|
||||
"/*global require, module, ModuleCache, 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 */",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief JavaScript server functions",
|
||||
"///",
|
||||
"/// @file",
|
||||
"///",
|
||||
"/// DISCLAIMER",
|
||||
"///",
|
||||
"/// Copyright 2010-2011 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, triAGENS GmbH, Cologne, Germany",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- Module",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8Module",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief module cache",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"ModuleCache = {};",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief module constructor",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"function Module (id) {",
|
||||
" this.id = id;",
|
||||
" this.exports = {};",
|
||||
"}",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief loads a file and creates a new module descriptor",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"Module.prototype.require = function (path) {",
|
||||
" var content;",
|
||||
" var f;",
|
||||
" var module;",
|
||||
" var paths;",
|
||||
" var raw;",
|
||||
" var sandbox;",
|
||||
"",
|
||||
" // first get rid of any \"..\" and \".\"",
|
||||
" path = this.normalise(path);",
|
||||
"",
|
||||
" // check if you already know the module, return the exports",
|
||||
" if (ModuleCache.hasOwnProperty(path)) {",
|
||||
" return ModuleCache[path].exports;",
|
||||
" }",
|
||||
"",
|
||||
" // locate file and read content",
|
||||
" raw = ModuleCache[\"/internal\"].exports.readFile(path);",
|
||||
"",
|
||||
" // create a new sandbox and execute",
|
||||
" module = ModuleCache[path] = new Module(path);",
|
||||
"",
|
||||
" content = \"(function (module, exports, require, print) {\"",
|
||||
" + raw.content ",
|
||||
" + \"\\n});\";",
|
||||
"",
|
||||
" f = SYS_EXECUTE(content, undefined, path);",
|
||||
"",
|
||||
" if (f === undefined) {",
|
||||
" throw \"cannot create context function\";",
|
||||
" }",
|
||||
"",
|
||||
" f(module,",
|
||||
" module.exports,",
|
||||
" function(path) { return module.require(path); },",
|
||||
" ModuleCache[\"/internal\"].exports.print);",
|
||||
"",
|
||||
" return module.exports;",
|
||||
"};",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief normalises a path",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"Module.prototype.normalise = function (path) {",
|
||||
" var i;",
|
||||
" var n;",
|
||||
" var p;",
|
||||
" var q;",
|
||||
" var x;",
|
||||
"",
|
||||
" if (path === \"\") {",
|
||||
" return this.id;",
|
||||
" }",
|
||||
"",
|
||||
" p = path.split('/');",
|
||||
"",
|
||||
" // relative path",
|
||||
" if (p[0] === \".\" || p[0] === \"..\") {",
|
||||
" q = this.id.split('/');",
|
||||
" q.pop();",
|
||||
" q = q.concat(p);",
|
||||
" }",
|
||||
"",
|
||||
" // absolute path",
|
||||
" else {",
|
||||
" q = p;",
|
||||
" }",
|
||||
"",
|
||||
" // normalize path",
|
||||
" n = [];",
|
||||
"",
|
||||
" for (i = 0; i < q.length; ++i) {",
|
||||
" x = q[i];",
|
||||
"",
|
||||
" if (x === \"..\") {",
|
||||
" if (n.length === 0) {",
|
||||
" throw \"cannot cross module top\";",
|
||||
" }",
|
||||
"",
|
||||
" n.pop();",
|
||||
" }",
|
||||
" else if (x !== \"\" && x !== \".\") {",
|
||||
" n.push(x);",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" return \"/\" + n.join('/');",
|
||||
"};",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief unloads module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"Module.prototype.unload = function (path) {",
|
||||
" if (! path) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" var norm = module.normalise(path);",
|
||||
"",
|
||||
" if ( norm === \"/\"",
|
||||
" || norm === \"/internal\"",
|
||||
" || norm === \"/console\"",
|
||||
" || norm === \"/fs\") {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" delete ModuleCache[norm];",
|
||||
"};",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief unloads module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"Module.prototype.unloadAll = function () {",
|
||||
" var path;",
|
||||
"",
|
||||
" for (path in ModuleCache) {",
|
||||
" if (ModuleCache.hasOwnProperty(path)) {",
|
||||
" this.unload(path);",
|
||||
" }",
|
||||
" }",
|
||||
"};",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief top-level module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"module = ModuleCache[\"/\"] = new Module(\"/\");",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief global require function",
|
||||
"///",
|
||||
"/// @FUN{require(@FA{path})}",
|
||||
"///",
|
||||
"/// @FN{require} checks if the file specified by @FA{path} has already been",
|
||||
"/// loaded. If not, the content of the file is executed in a new",
|
||||
"/// context. Within the context you can use the global variable @CODE{exports}",
|
||||
"/// in order to export variables and functions. This variable is returned by",
|
||||
"/// @FN{require}.",
|
||||
"///",
|
||||
"/// Assume that your module file is @CODE{test1.js} and contains",
|
||||
"///",
|
||||
"/// @verbinclude modules-require-1",
|
||||
"///",
|
||||
"/// Then you can use @FN{require} to load the file and access the exports.",
|
||||
"///",
|
||||
"/// @verbinclude modules-require-2",
|
||||
"///",
|
||||
"/// @FN{require} follows the specification",
|
||||
"/// <a href=\"http://wiki.commonjs.org/wiki/Modules/1.1.1\">Modules/1.1.1</a>.",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"function require (path) {",
|
||||
" return module.require(path);",
|
||||
"}",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- Module \"fs\"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8ModuleFS",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief file-system module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"ModuleCache[\"/fs\"] = new Module(\"/fs\");",
|
||||
"",
|
||||
"(function () {",
|
||||
" var fs = ModuleCache[\"/fs\"].exports;",
|
||||
"",
|
||||
" fs.exists = FS_EXISTS;",
|
||||
" fs.move = FS_MOVE;",
|
||||
" fs.remove = FS_REMOVE;",
|
||||
"}());",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- Module \"internal\"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8ModuleInternal",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief internal module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"ModuleCache[\"/internal\"] = new Module(\"/internal\");",
|
||||
"",
|
||||
"(function () {",
|
||||
" var internal = ModuleCache[\"/internal\"].exports;",
|
||||
" var fs = 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;",
|
||||
"",
|
||||
"",
|
||||
" // password interface",
|
||||
" internal.encodePassword = function (password) {",
|
||||
" var salt;",
|
||||
" var encoded;",
|
||||
"",
|
||||
" salt = internal.sha256(\"time:\" + SYS_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 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 (fs.exists(n)) {",
|
||||
" return { path : n, content : internal.read(n) };",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" // try to load the module from the database",
|
||||
" mc = internal.db._collection(\"_modules\");",
|
||||
"",
|
||||
" if (mc !== null) {",
|
||||
" n = mc.firstExample({ path: path });",
|
||||
"",
|
||||
" if (n !== null) {",
|
||||
" return { path : \"_collection/\" + path, content : n.module };",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" 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 (fs.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) {",
|
||||
" throw \"you need to upgrade your database using 'arango-upgrade'\";",
|
||||
" }",
|
||||
"",
|
||||
" 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-- Module \"console\"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8ModuleConsole",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief console module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"ModuleCache[\"/console\"] = new Module(\"/console\");",
|
||||
"",
|
||||
"(function () {",
|
||||
" var internal = ModuleCache[\"/internal\"].exports;",
|
||||
" var console = 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",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"// Local Variables:",
|
||||
"// mode: outline-minor",
|
||||
"// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"",
|
||||
"// End:",
|
||||
"//__end__"
|
||||
};
|
|
@ -1,334 +0,0 @@
|
|||
const char* JS_common_bootstrap_print[] = {
|
||||
"/*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,",
|
||||
" k,",
|
||||
" internal.COLOR_OUTPUT_RESET, ",
|
||||
" \" : \");",
|
||||
" }",
|
||||
" 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:",
|
||||
"//__end__"
|
||||
};
|
|
@ -460,7 +460,7 @@ ModuleCache["/internal"] = new Module("/internal");
|
|||
mc = internal.db._collection("_modules");
|
||||
|
||||
if (mc === null) {
|
||||
throw "you need to upgrade your database using 'arango-upgrade'";
|
||||
mc = internal.db._create("_modules", { isSystem: true });
|
||||
}
|
||||
|
||||
path = module.normalise(path);
|
||||
|
|
|
@ -348,13 +348,7 @@ function RunTest (path) {
|
|||
var content;
|
||||
var f;
|
||||
|
||||
try {
|
||||
content = SYS_READ(path);
|
||||
}
|
||||
catch (err) {
|
||||
console.error("cannot load test file '%s'", path);
|
||||
return;
|
||||
}
|
||||
content = SYS_READ(path);
|
||||
|
||||
content = "(function(jsUnity){jsUnity.attachAssertions();" + content + "})";
|
||||
f = SYS_EXECUTE(content, undefined, path);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,652 +0,0 @@
|
|||
const char* JS_server_server[] = {
|
||||
"/*jslint indent: 2,",
|
||||
" nomen: true,",
|
||||
" maxlen: 100,",
|
||||
" sloppy: true,",
|
||||
" vars: true,",
|
||||
" white: true,",
|
||||
" plusplus: true */",
|
||||
"/*global require, db, edges, ModuleCache, Module,",
|
||||
" ArangoCollection, ArangoDatabase,",
|
||||
" ArangoError, ShapedJson,",
|
||||
" SYS_DEFINE_ACTION */",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief JavaScript server functions",
|
||||
"///",
|
||||
"/// @file",
|
||||
"///",
|
||||
"/// DISCLAIMER",
|
||||
"///",
|
||||
"/// Copyright 2011-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",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- Module \"internal\"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8ModuleInternal",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief internal module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"(function () {",
|
||||
" var internal = require(\"internal\");",
|
||||
" var console = require(\"console\");",
|
||||
"",
|
||||
" internal.db = db;",
|
||||
" internal.edges = db;",
|
||||
" internal.ArangoCollection = ArangoCollection;",
|
||||
"",
|
||||
" if (typeof SYS_DEFINE_ACTION === \"undefined\") {",
|
||||
" internal.defineAction = function() {",
|
||||
" console.error(\"SYS_DEFINE_ACTION not available\");",
|
||||
" };",
|
||||
" }",
|
||||
" else {",
|
||||
" internal.defineAction = SYS_DEFINE_ACTION;",
|
||||
" }",
|
||||
"",
|
||||
" if (typeof SYS_EXECUTE_GLOBAL_CONTEXT_FUNCTION === \"undefined\") {",
|
||||
" internal.executeGlobalContextFunction = function() {",
|
||||
" console.error(\"SYS_EXECUTE_GLOBAL_CONTEXT_FUNCTION not available\");",
|
||||
" };",
|
||||
" }",
|
||||
" else {",
|
||||
" internal.executeGlobalContextFunction = SYS_EXECUTE_GLOBAL_CONTEXT_FUNCTION;",
|
||||
" }",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- Module \"simple-query\"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8ModuleSimpleQuery",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief simple-query module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" try {",
|
||||
" require(\"simple-query\");",
|
||||
" }",
|
||||
" catch (err) {",
|
||||
" console.error(\"while loading 'simple-query' module: %s\", err);",
|
||||
" }",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- Module \"monkeypatches\"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8ModuleMonkeypatches",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief monkeypatches module",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" try {",
|
||||
" require(\"monkeypatches\");",
|
||||
" }",
|
||||
" catch (err) {",
|
||||
" console.error(\"while loading 'monkeypatches' module: %s\", err);",
|
||||
" }",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- ShapedJson",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8Shell",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief prints a shaped json",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ShapedJson.prototype._PRINT = function(seen, path, names, level) {",
|
||||
" if (this instanceof ShapedJson) {",
|
||||
" internal.printObject(this, seen, path, names, level);",
|
||||
" }",
|
||||
" else {",
|
||||
" internal.output(this.toString());",
|
||||
" }",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- ArangoError",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8Shell",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief prints an error",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoError.prototype._PRINT = function() {",
|
||||
" var errorNum = this.errorNum;",
|
||||
" var errorMessage = this.errorMessage;",
|
||||
"",
|
||||
" internal.output(\"[ArangoError \", errorNum, \": \", errorMessage, \"]\");",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief converts error to string",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoError.prototype.toString = function() {",
|
||||
" var errorNum = this.errorNum;",
|
||||
" var errorMessage = this.errorMessage;",
|
||||
"",
|
||||
" return \"[ArangoError \" + errorNum + \": \" + errorMessage + \"]\";",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- ArangoDatabase",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8Shell",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief factory method to create a new statement",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype._createStatement = function (data) { ",
|
||||
" return new ArangoStatement(this, data);",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief drops a collection",
|
||||
"///",
|
||||
"/// @FUN{db._drop(@FA{collection})}",
|
||||
"///",
|
||||
"/// Drops a @FA{collection} and all its indexes.",
|
||||
"///",
|
||||
"/// @FUN{db._drop(@FA{collection-identifier})}",
|
||||
"///",
|
||||
"/// Drops a collection identified by @FA{collection-identifier} and all its",
|
||||
"/// indexes. No error is thrown if there is no such collection.",
|
||||
"///",
|
||||
"/// @FUN{db._drop(@FA{collection-name})}",
|
||||
"///",
|
||||
"/// Drops a collection named @FA{collection-name} and all its indexes. No error",
|
||||
"/// is thrown if there is no such collection.",
|
||||
"///",
|
||||
"/// @EXAMPLES",
|
||||
"///",
|
||||
"/// Drops a collection:",
|
||||
"///",
|
||||
"/// @verbinclude shell_collection-drop-db",
|
||||
"///",
|
||||
"/// Drops a collection identified by name:",
|
||||
"///",
|
||||
"/// @verbinclude shell_collection-drop-name-db",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype._drop = function(name) {",
|
||||
" var collection = name;",
|
||||
"",
|
||||
" if (! (name instanceof ArangoCollection)) {",
|
||||
" collection = internal.db._collection(name);",
|
||||
" }",
|
||||
"",
|
||||
" if (collection === null) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" return collection.drop();",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief truncates a collection",
|
||||
"///",
|
||||
"/// @FUN{db._truncate(@FA{collection})}",
|
||||
"///",
|
||||
"/// Truncates a @FA{collection}, removing all documents but keeping all its",
|
||||
"/// indexes.",
|
||||
"///",
|
||||
"/// @FUN{db._truncate(@FA{collection-identifier})}",
|
||||
"///",
|
||||
"/// Truncates a collection identified by @FA{collection-identified}. No error is",
|
||||
"/// thrown if there is no such collection.",
|
||||
"///",
|
||||
"/// @FUN{db._truncate(@FA{collection-name})}",
|
||||
"///",
|
||||
"/// Truncates a collection named @FA{collection-name}. No error is thrown if",
|
||||
"/// there is no such collection.",
|
||||
"///",
|
||||
"/// @EXAMPLES",
|
||||
"///",
|
||||
"/// Truncates a collection:",
|
||||
"///",
|
||||
"/// @verbinclude shell_collection-truncate-db",
|
||||
"///",
|
||||
"/// Truncates a collection identified by name:",
|
||||
"///",
|
||||
"/// @verbinclude shell_collection-truncate-name-db",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype._truncate = function(name) {",
|
||||
" var collection = name;",
|
||||
"",
|
||||
" if (! (name instanceof ArangoCollection)) {",
|
||||
" collection = internal.db._collection(name);",
|
||||
" }",
|
||||
"",
|
||||
" if (collection === null) {",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" collection.truncate();",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief finds an index",
|
||||
"///",
|
||||
"/// @FUN{db._index(@FA{index-handle})}",
|
||||
"///",
|
||||
"/// Returns the index with @FA{index-handle} or null if no such index exists.",
|
||||
"///",
|
||||
"/// @EXAMPLES",
|
||||
"///",
|
||||
"/// @verbinclude shell_index-read-db",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype._index = function(id) {",
|
||||
" if (id.hasOwnProperty(\"id\")) {",
|
||||
" id = id.id;",
|
||||
" }",
|
||||
"",
|
||||
" var re = /^([0-9]+)\\/([0-9]+)/;",
|
||||
" var pa = re.exec(id);",
|
||||
" var err;",
|
||||
"",
|
||||
" if (pa === null) {",
|
||||
" err = new ArangoError();",
|
||||
" err.errorNum = internal.errors.ERROR_ARANGO_INDEX_HANDLE_BAD.code;",
|
||||
" err.errorMessage = internal.errors.ERROR_ARANGO_INDEX_HANDLE_BAD.message;",
|
||||
" throw err;",
|
||||
" }",
|
||||
"",
|
||||
" var col = this._collection(parseInt(pa[1]));",
|
||||
"",
|
||||
" if (col === null) {",
|
||||
" err = new ArangoError();",
|
||||
" err.errorNum = internal.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code;",
|
||||
" err.errorMessage = internal.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.message;",
|
||||
" throw err;",
|
||||
" }",
|
||||
"",
|
||||
" var indexes = col.getIndexes();",
|
||||
" var i;",
|
||||
"",
|
||||
" for (i = 0; i < indexes.length; ++i) {",
|
||||
" var index = indexes[i];",
|
||||
"",
|
||||
" if (index.id === id) {",
|
||||
" return index;",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" return null;",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief drops an index",
|
||||
"///",
|
||||
"/// @FUN{db._dropIndex(@FA{index})}",
|
||||
"///",
|
||||
"/// Drops the @FA{index}. If the index does not exists, then @LIT{false} is",
|
||||
"/// returned. If the index existed and was dropped, then @LIT{true} is",
|
||||
"/// returned. Note that you cannot drop the primary index.",
|
||||
"///",
|
||||
"/// @FUN{db._dropIndex(@FA{index-handle})}",
|
||||
"///",
|
||||
"/// Drops the index with @FA{index-handle}.",
|
||||
"///",
|
||||
"/// @EXAMPLES",
|
||||
"///",
|
||||
"/// @verbinclude shell_index-drop-index-db",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype._dropIndex = function(id) {",
|
||||
" if (id.hasOwnProperty(\"id\")) {",
|
||||
" id = id.id;",
|
||||
" }",
|
||||
"",
|
||||
" var re = /^([0-9]+)\\/([0-9]+)/;",
|
||||
" var pa = re.exec(id);",
|
||||
" var err;",
|
||||
"",
|
||||
" if (pa === null) {",
|
||||
" err = new ArangoError();",
|
||||
" err.errorNum = internal.errors.ERROR_ARANGO_INDEX_HANDLE_BAD.code;",
|
||||
" err.errorMessage = internal.errors.ERROR_ARANGO_INDEX_HANDLE_BAD.message;",
|
||||
" throw err;",
|
||||
" }",
|
||||
"",
|
||||
" var col = this._collection(parseInt(pa[1]));",
|
||||
"",
|
||||
" if (col === null) {",
|
||||
" err = new ArangoError();",
|
||||
" err.errorNum = internal.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.code;",
|
||||
" err.errorMessage = internal.errors.ERROR_ARANGO_COLLECTION_NOT_FOUND.message;",
|
||||
" throw err;",
|
||||
" }",
|
||||
"",
|
||||
" return col.dropIndex(id);",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief prints a database",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype._PRINT = function(seen, path, names, level) {",
|
||||
" internal.output(\"[ArangoDatabase \\\"\" + this._path + \"\\\"]\");",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief strng representation of a database",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoDatabase.prototype.toString = function(seen, path, names, level) {",
|
||||
" return \"[ArangoDatabase \\\"\" + this._path + \"\\\"]\";",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- ArangoCollection",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8Shell",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief collection is corrupted",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.STATUS_CORRUPTED = 0;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief collection is new born",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.STATUS_NEW_BORN = 1;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief collection is unloaded",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.STATUS_UNLOADED = 2;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief collection is loaded",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.STATUS_LOADED = 3;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief collection is unloading",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.STATUS_UNLOADING = 4;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief collection is deleted",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.STATUS_DELETED = 5;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief document collection",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
" ",
|
||||
" ArangoCollection.TYPE_DOCUMENT = 2;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief edge collection",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.TYPE_EDGE = 3;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief attachment collection",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.TYPE_ATTACHMENT = 4;",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief converts collection into an array",
|
||||
"///",
|
||||
"/// @FUN{@FA{collection}.toArray()}",
|
||||
"///",
|
||||
"/// Converts the collection into an array of documents. Never use this call",
|
||||
"/// in a production environment.",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.prototype.toArray = function() {",
|
||||
" return this.ALL(null, null).documents;",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief truncates a collection",
|
||||
"///",
|
||||
"/// @FUN{@FA{collection}.truncate()}",
|
||||
"///",
|
||||
"/// Truncates a @FA{collection}, removing all documents but keeping all its",
|
||||
"/// indexes.",
|
||||
"///",
|
||||
"/// @EXAMPLES",
|
||||
"///",
|
||||
"/// Truncates a collection:",
|
||||
"///",
|
||||
"/// @verbinclude shell_collection-truncate",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.prototype.truncate = function() {",
|
||||
" return internal.db._truncate(this);",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief finds an index of a collection",
|
||||
"///",
|
||||
"/// @FUN{@FA{collection}.index(@FA{index-handle})}",
|
||||
"///",
|
||||
"/// Returns the index with @FA{index-handle} or null if no such index exists.",
|
||||
"///",
|
||||
"/// @EXAMPLES",
|
||||
"///",
|
||||
"/// @verbinclude shell_index-read",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.prototype.index = function(id) {",
|
||||
" var indexes = this.getIndexes();",
|
||||
" var i;",
|
||||
"",
|
||||
" if (typeof id === \"string\") {",
|
||||
" var re = /^([0-9]+)\\/([0-9]+)/;",
|
||||
" var pa = re.exec(id);",
|
||||
"",
|
||||
" if (pa === null) {",
|
||||
" id = this._id + \"/\" + id;",
|
||||
" }",
|
||||
" }",
|
||||
" else if (id.hasOwnProperty(\"id\")) {",
|
||||
" id = id.id;",
|
||||
" }",
|
||||
"",
|
||||
" for (i = 0; i < indexes.length; ++i) {",
|
||||
" var index = indexes[i];",
|
||||
"",
|
||||
" if (index.id === id) {",
|
||||
" return index;",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" return null;",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief prints a collection",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.prototype._PRINT = function() {",
|
||||
" var status = type = \"unknown\";",
|
||||
"",
|
||||
" switch (this.status()) {",
|
||||
" case ArangoCollection.STATUS_NEW_BORN: status = \"new born\"; break;",
|
||||
" case ArangoCollection.STATUS_UNLOADED: status = \"unloaded\"; break;",
|
||||
" case ArangoCollection.STATUS_UNLOADING: status = \"unloading\"; break;",
|
||||
" case ArangoCollection.STATUS_LOADED: status = \"loaded\"; break;",
|
||||
" case ArangoCollection.STATUS_CORRUPTED: status = \"corrupted\"; break;",
|
||||
" case ArangoCollection.STATUS_DELETED: status = \"deleted\"; break;",
|
||||
" }",
|
||||
"",
|
||||
" switch (this.type()) {",
|
||||
" case ArangoCollection.TYPE_DOCUMENT: type = \"document\"; break;",
|
||||
" case ArangoCollection.TYPE_EDGE: type = \"edge\"; break;",
|
||||
" case ArangoCollection.TYPE_ATTACHMENT: type = \"attachment\"; break;",
|
||||
" }",
|
||||
"",
|
||||
" internal.output(\"[ArangoCollection \",",
|
||||
" this._id, ",
|
||||
" \", \\\"\", this.name(), \"\\\" (type \", type, \", status \", status, \")]\");",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief strng representation of a collection",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" ArangoCollection.prototype.toString = function(seen, path, names, level) {",
|
||||
" return \"[ArangoCollection \" + this._id + \"]\";",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- ArangoStatement",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @addtogroup V8Shell",
|
||||
"/// @{",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
" ",
|
||||
" try {",
|
||||
" var SQ = require(\"simple-query-basics\");",
|
||||
" var SB = require(\"statement-basics\");",
|
||||
" internal.ArangoStatement = SB.ArangoStatement;",
|
||||
" ArangoStatement = SB.ArangoStatement;",
|
||||
" }",
|
||||
" catch (err) {",
|
||||
" console.error(\"while loading 'statement-basics' module: %s\", err);",
|
||||
" }",
|
||||
" ",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief parse a query and return the results",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" SB.ArangoStatement.prototype.parse = function () {",
|
||||
" var result = AHUACATL_PARSE(this._query); ",
|
||||
"",
|
||||
" return { \"bindVars\" : result.parameters, \"collections\" : result.collections };",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief explain a query and return the results",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" SB.ArangoStatement.prototype.explain = function () {",
|
||||
" return AHUACATL_EXPLAIN(this._query); ",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @brief execute the query",
|
||||
"///",
|
||||
"/// This will return a cursor with the query results in case of success.",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
" SB.ArangoStatement.prototype.execute = function () {",
|
||||
" var result = AHUACATL_RUN(this._query, ",
|
||||
" this._bindVars, ",
|
||||
" this._doCount != undefined ? this._doCount : false, ",
|
||||
" null, ",
|
||||
" true); ",
|
||||
" return new SQ.GeneralArrayCursor(result, 0, null);",
|
||||
" };",
|
||||
"",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"/// @}",
|
||||
"////////////////////////////////////////////////////////////////////////////////",
|
||||
"",
|
||||
"}());",
|
||||
"",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"// --SECTION-- END-OF-FILE",
|
||||
"// -----------------------------------------------------------------------------",
|
||||
"",
|
||||
"// Local Variables:",
|
||||
"// mode: outline-minor",
|
||||
"// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @\\\\}\\\\)\"",
|
||||
"// End:",
|
||||
"//__end__"
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,49 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief example controller
|
||||
///
|
||||
/// @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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var actions = require("org/arangodb/actions");
|
||||
|
||||
exports.head = function (req, res, next, options) {
|
||||
res.responseCode = actions.HTTP_OK;
|
||||
res.contentType = "application/json; charset=utf-8";
|
||||
res.body = "";
|
||||
}
|
||||
|
||||
exports.do = function (req, res, next, options) {
|
||||
res.responseCode = actions.HTTP_OK;
|
||||
res.contentType = "application/json; charset=utf-8";
|
||||
res.body = JSON.stringify(req);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
||||
// End:
|
|
@ -0,0 +1,478 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief tests for routing
|
||||
///
|
||||
/// @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 2012, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var actions = require("org/arangodb/actions");
|
||||
var internal = require("internal");
|
||||
var jsunity = require("jsunity");
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- test suite
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief single patterns routing
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function routingSuiteSingle () {
|
||||
var errors = internal.errors;
|
||||
var cn = "_routing";
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
setUp : function () {
|
||||
internal.db._drop(cn);
|
||||
collection = internal.db._create(cn, { isSystem: true });
|
||||
|
||||
collection.save({
|
||||
url: { match: "/hello/world" },
|
||||
content: "c1"
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: "/world/hello",
|
||||
content: "c2"
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: "/prefix/hello/*",
|
||||
content: "c3"
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: { match: "/param/:hello/world", constraint: { hello: "[0-9]+" } },
|
||||
content: "c4"
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: { match: "/opt/:hello?", constraint: { hello: "[0-9]+" }, methods: [ 'get' ] },
|
||||
content: "c5"
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: "/json",
|
||||
content: { contentType: "application/json", body: '{"text": "c6"}' }
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: "/p/h/*",
|
||||
content: "p1"
|
||||
});
|
||||
|
||||
collection.save({
|
||||
url: "/p/h",
|
||||
content: "p2"
|
||||
});
|
||||
|
||||
actions.reloadRouting();
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRouting: function () {
|
||||
var r = actions.firstRouting('GET', "/hello/world");
|
||||
assertEqual('c1', r.route.route.content);
|
||||
|
||||
assertEqual('/hello/world', r.route.path);
|
||||
assertEqual(undefined, r.prefix);
|
||||
assertEqual(undefined, r.suffix);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing (sort-cut for match)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRoutingShort: function () {
|
||||
var r = actions.firstRouting('GET', "/world/hello");
|
||||
assertEqual('c2', r.route.route.content);
|
||||
|
||||
assertEqual('/world/hello', r.route.path);
|
||||
assertEqual(undefined, r.prefix);
|
||||
assertEqual(undefined, r.suffix);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing (prefix)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRoutingPrefix: function () {
|
||||
var r = actions.firstRouting('GET', "/prefix/hello/world");
|
||||
assertEqual('c3', r.route.route.content);
|
||||
|
||||
assertEqual('/prefix/hello(/[^/]+)*', r.route.path);
|
||||
assertEqual('/prefix/hello', r.prefix);
|
||||
assertEqual(['world'], r.suffix);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing (parameter)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRoutingParameter: function () {
|
||||
var r = actions.firstRouting('GET', "/param/12345/world");
|
||||
assertEqual('c4', r.route.route.content);
|
||||
|
||||
assertEqual('/param/[0-9]+/world', r.route.path);
|
||||
assertEqual(undefined, r.prefix);
|
||||
assertEqual(undefined, r.suffix);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
|
||||
r = actions.firstRouting('GET', "/param/a12345/world");
|
||||
assertEqual(undefined, r.route);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing (optional)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRoutingOptional: function () {
|
||||
var r = actions.firstRouting('GET', "/opt/12345");
|
||||
assertEqual('c5', r.route.route.content);
|
||||
|
||||
assertEqual('/opt(/[0-9]+)?', r.route.path);
|
||||
assertEqual(undefined, r.prefix);
|
||||
assertEqual(undefined, r.suffix);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
|
||||
r = actions.firstRouting('GET', "/opt");
|
||||
assertEqual('c5', r.route.route.content);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing (optional)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRoutingMethod: function () {
|
||||
var r = actions.firstRouting('HEAD', "/opt/12345");
|
||||
assertEqual(undefined, r.route);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing (prefix vs non-prefix)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRoutingNonPrefix: function () {
|
||||
var r = actions.firstRouting('GET', "/p/h");
|
||||
assertEqual('p2', r.route.route.content);
|
||||
|
||||
assertEqual('/p/h', r.route.path);
|
||||
assertEqual(undefined, r.prefix);
|
||||
assertEqual(undefined, r.suffix);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
|
||||
assertEqual('/p/h(/[^/]+)*', r.route.path);
|
||||
assertEqual('/p/h', r.prefix);
|
||||
assertEqual([], r.suffix);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: content string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContentString: function () {
|
||||
var r = actions.firstRouting('GET', "/opt/12345");
|
||||
|
||||
req = {};
|
||||
res = {};
|
||||
|
||||
r.route.callback.controller(req, res);
|
||||
|
||||
assertEqual(actions.HTTP_OK, res.responseCode);
|
||||
assertEqual("text/plain", res.contentType);
|
||||
assertEqual("c5", res.body);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: content json
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testContentJson: function () {
|
||||
var r = actions.firstRouting('GET', "/json");
|
||||
|
||||
req = {};
|
||||
res = {};
|
||||
|
||||
r.route.callback.controller(req, res);
|
||||
|
||||
assertEqual(actions.HTTP_OK, res.responseCode);
|
||||
assertEqual("application/json", res.contentType);
|
||||
assertEqual('{"text": "c6"}', res.body);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- test suite
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief bundle without prefix
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function routingSuiteBundle () {
|
||||
var errors = internal.errors;
|
||||
var cn = "_routing";
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
setUp : function () {
|
||||
internal.db._drop(cn);
|
||||
collection = internal.db._create(cn, { isSystem: true });
|
||||
|
||||
collection.save({
|
||||
middleware: [
|
||||
{ url: { match: "/*" }, content: "m1" },
|
||||
{ url: { match: "/hello/*" }, content: "m2" },
|
||||
{ url: { match: "/hello/world" }, content: "m3" },
|
||||
{ url: { match: "/:name/world" }, content: "m4" }
|
||||
],
|
||||
|
||||
routes: [
|
||||
{ url: { match: "/*" }, content: "c1" },
|
||||
{ url: { match: "/hello/*" }, content: "c2" },
|
||||
{ url: { match: "/hello/world" }, content: "c3" },
|
||||
{ url: { match: "/hello/:name|:id", constraint: { name: "/[a-z]+/", id: "/[0-9]+/" } }, content: "c4" },
|
||||
{ url: { match: "/hello/:name/:id", constraint: { name: "/[a-z]+/", id: "/[0-9]+/" } }, content: "c5" },
|
||||
{ url: { match: "/:name/world" }, content: "c6" },
|
||||
{ url: { match: "/hello" }, content: "c7" }
|
||||
]
|
||||
});
|
||||
|
||||
actions.reloadRouting();
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: routing cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRoutingCache: function () {
|
||||
var cache = actions.routingCache();
|
||||
|
||||
assertEqual(3, cache.routes.GET.exact.hello.parameters.length);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRouting: function () {
|
||||
var r = actions.firstRouting('GET', "/hello/world");
|
||||
assertEqual('m1', r.route.route.content);
|
||||
assertEqual('(/[^/]+)*', r.route.path);
|
||||
|
||||
// middleware: unspecific to specific
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('m4', r.route.route.content);
|
||||
assertEqual('/[^/]+/world', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('m2', r.route.route.content);
|
||||
assertEqual('/hello(/[^/]+)*', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('m3', r.route.route.content);
|
||||
assertEqual('/hello/world', r.route.path);
|
||||
|
||||
// routing: specific to unspecific
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c3', r.route.route.content);
|
||||
assertEqual('/hello/world', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c4', r.route.route.content);
|
||||
assertEqual(1, r.route.urlParameters.name);
|
||||
assertEqual('/hello/[a-z]+', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c2', r.route.route.content);
|
||||
assertEqual('/hello(/[^/]+)*', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c6', r.route.route.content);
|
||||
assertEqual('/[^/]+/world', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c1', r.route.route.content);
|
||||
assertEqual('(/[^/]+)*', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- test suite
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief bundle with prefix
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function routingSuitePrefix () {
|
||||
var errors = internal.errors;
|
||||
var cn = "_routing";
|
||||
|
||||
return {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set up
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
setUp : function () {
|
||||
internal.db._drop(cn);
|
||||
collection = internal.db._create(cn, { isSystem: true });
|
||||
|
||||
collection.save({
|
||||
urlPrefix: "/test",
|
||||
|
||||
middleware: [
|
||||
{ url: { match: "/*" }, content: "m1" },
|
||||
{ url: { match: "/hello/*" }, content: "m2" },
|
||||
{ url: { match: "/hello/world" }, content: "m3" },
|
||||
{ url: { match: "/:name/world" }, content: "m4" }
|
||||
],
|
||||
|
||||
routes: [
|
||||
{ url: { match: "/*" }, content: "c1" },
|
||||
{ url: { match: "/hello/*" }, content: "c2" },
|
||||
{ url: { match: "/hello/world" }, content: "c3" },
|
||||
{ url: { match: "/hello/:name|:id", constraint: { name: "/[a-z]+/", id: "/[0-9]+/" } }, content: "c4" },
|
||||
{ url: { match: "/hello/:name/:id", constraint: { name: "/[a-z]+/", id: "/[0-9]+/" } }, content: "c5" },
|
||||
{ url: { match: "/:name/world" }, content: "c6" },
|
||||
{ url: { match: "/hello" }, content: "c7" }
|
||||
]
|
||||
});
|
||||
|
||||
actions.reloadRouting();
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: routing cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testRoutingCache: function () {
|
||||
var cache = actions.routingCache();
|
||||
|
||||
assertEqual(3, cache.routes.GET.exact.test.exact.hello.parameters.length);
|
||||
},
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief test: simple routing
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
testSimpleRouting: function () {
|
||||
var r = actions.firstRouting('GET', "/test/hello/world");
|
||||
assertEqual('m1', r.route.route.content);
|
||||
assertEqual('/test(/[^/]+)*', r.route.path);
|
||||
|
||||
// middleware: unspecific to specific
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('m4', r.route.route.content);
|
||||
assertEqual('/test/[^/]+/world', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('m2', r.route.route.content);
|
||||
assertEqual('/test/hello(/[^/]+)*', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('m3', r.route.route.content);
|
||||
assertEqual('/test/hello/world', r.route.path);
|
||||
|
||||
// routing: specific to unspecific
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c3', r.route.route.content);
|
||||
assertEqual('/test/hello/world', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c4', r.route.route.content);
|
||||
assertEqual(2, r.route.urlParameters.name);
|
||||
assertEqual('/test/hello/[a-z]+', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c2', r.route.route.content);
|
||||
assertEqual('/test/hello(/[^/]+)*', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c6', r.route.route.content);
|
||||
assertEqual('/test/[^/]+/world', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual('c1', r.route.route.content);
|
||||
assertEqual('/test(/[^/]+)*', r.route.path);
|
||||
|
||||
r = actions.nextRouting(r);
|
||||
assertEqual(undefined, r.route);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- main
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the test suites
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
jsunity.run(routingSuiteSingle);
|
||||
jsunity.run(routingSuiteBundle);
|
||||
jsunity.run(routingSuitePrefix);
|
||||
|
||||
return jsunity.done();
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
||||
// End:
|
File diff suppressed because it is too large
Load Diff
2357
lib/V8/v8-json.cpp
2357
lib/V8/v8-json.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue