1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Heiko Kernbach 2013-04-08 02:50:50 +02:00
commit d23ef475da
50 changed files with 593 additions and 673 deletions

View File

@ -5,13 +5,13 @@ content-type: application/json; charset=utf-8
{
"system" : {
"minorPageFaults" : 15867,
"majorPageFaults" : 68,
"userTime" : 0.74,
"systemTime" : 0.13,
"numberThreads" : 15,
"residentSize" : 5876,
"virtualSize" : 3469815808
"minorPageFaults" : 18666,
"majorPageFaults" : 57,
"userTime" : 1.162991,
"systemTime" : 0.464635,
"numberThreads" : 0,
"residentSize" : 34525184,
"virtualSize" : 0
},
"client" : {
"httpConnections" : 1,
@ -25,33 +25,33 @@ content-type: application/json; charset=utf-8
]
},
"totalTime" : {
"count" : 48,
"count" : 54,
"counts" : [
46,
51,
0,
0,
0,
0,
0,
2
3
]
},
"requestTime" : {
"count" : 48,
"count" : 54,
"counts" : [
46,
51,
0,
0,
0,
0,
0,
2
3
]
},
"queueTime" : {
"count" : 47,
"count" : 53,
"counts" : [
47,
53,
0,
0,
0,
@ -61,20 +61,20 @@ content-type: application/json; charset=utf-8
]
},
"bytesSent" : {
"count" : 48,
"count" : 54,
"counts" : [
8,
39,
0,
13,
27,
13,
1,
0,
0
]
},
"bytesReceived" : {
"count" : 48,
"count" : 54,
"counts" : [
46,
52,
2,
0,
0,

View File

@ -1,8 +1,8 @@
{
"_id" : "_users/1585754",
"_rev" : "1585754",
"_key" : "1585754",
"_id" : "_users/1589671",
"_rev" : "1589671",
"_key" : "1589671",
"active" : true,
"user" : "root",
"password" : "$1$5197b9af$45f98c0c777bd2b59e767ec75eeb1351f5a11eac4e1f40425c3f84ba83553903"
"password" : "$1$e0d13aed$328469fc501398de5c3626dcc0a5a567e01b4bafbc06d89c0a5cf2b09872ca14"
}

View File

@ -11,6 +11,6 @@
"programming"
],
"_id" : "demo/schlonz",
"_rev" : "9908826",
"_rev" : "12468647",
"_key" : "schlonz"
}

View File

@ -1,15 +1,15 @@
unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=productsNoWait
unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products
{ "Hello": "World" }
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "16069210"
location: /_api/document/productsNoWait/16069210
etag: "21316007"
location: /_api/document/products/21316007
{
"error" : false,
"_id" : "productsNoWait/16069210",
"_rev" : "16069210",
"_key" : "16069210"
"_id" : "products/21316007",
"_rev" : "21316007",
"_key" : "21316007"
}

View File

@ -3,13 +3,13 @@ unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collec
HTTP/1.1 201 Created
content-type: application/json; charset=utf-8
etag: "13251162"
location: /_api/document/products/13251162
etag: "17973671"
location: /_api/document/products/17973671
{
"error" : false,
"_id" : "products/13251162",
"_rev" : "13251162",
"_key" : "13251162"
"_id" : "products/17973671",
"_rev" : "17973671",
"_key" : "17973671"
}

View File

@ -3,13 +3,13 @@ unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collec
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "23999066"
location: /_api/document/products/23999066
etag: "29049255"
location: /_api/document/products/29049255
{
"error" : false,
"_id" : "products/23999066",
"_rev" : "23999066",
"_key" : "23999066"
"_id" : "products/29049255",
"_rev" : "29049255",
"_key" : "29049255"
}

View File

@ -1,4 +1,4 @@
unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=productsUnknown
unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products
{ "Hello": "World" }
HTTP/1.1 404 Not Found
@ -6,7 +6,7 @@ content-type: application/json; charset=utf-8
{
"error" : true,
"errorMessage" : "collection /_api/collection/productsUnknown not found",
"errorMessage" : "collection /_api/collection/products not found",
"code" : 404,
"errorNum" : 1203
}

View File

@ -1,15 +1,15 @@
unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=productsNoWait&waitForSync=true
unix> curl -X POST --data @- --dump - http://localhost:8529/_api/document?collection=products&waitForSync=true
{ "Hello": "World" }
HTTP/1.1 201 Created
content-type: application/json; charset=utf-8
etag: "14627418"
location: /_api/document/productsNoWait/14627418
etag: "19743143"
location: /_api/document/products/19743143
{
"error" : false,
"_id" : "productsNoWait/14627418",
"_rev" : "14627418",
"_key" : "14627418"
"_id" : "products/19743143",
"_rev" : "19743143",
"_key" : "19743143"
}

View File

@ -1,13 +1,13 @@
unix> curl --dump - http://localhost:8529/_api/document/products1/19214938
unix> curl --dump - http://localhost:8529/_api/document/products/24265127
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
etag: "19214938"
etag: "24265127"
{
"hallo" : "world",
"_id" : "products1/19214938",
"_rev" : "19214938",
"_key" : "19214938"
"_id" : "products/24265127",
"_rev" : "24265127",
"_key" : "24265127"
}

View File

@ -1,13 +1,13 @@
unix> curl --dump - http://localhost:8529/_api/document/?collection=24457818
unix> curl --dump - http://localhost:8529/_api/document/?collection=products
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
{
"documents" : [
"/_api/document/products3/26358362",
"/_api/document/products3/25440858",
"/_api/document/products3/26096218"
"/_api/document/products/31408551",
"/_api/document/products/31146407",
"/_api/document/products/30622119"
]
}

View File

@ -1,3 +1,6 @@
unix> curl --data @- --dump - http://localhost:8529/_api/document/productshead/32256602
{}
unix> curl -X HEAD --dump - http://localhost:8529/_api/document/products/37306791
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
etag: "37306791"

View File

@ -1,13 +1,2 @@
unix> curl --header 'if-none-match: "29110874"' --dump - http://localhost:8529/_api/document/products2/29110874
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
etag: "29110874"
{
"hallo" : "world",
"_id" : "products2/29110874",
"_rev" : "29110874",
"_key" : "29110874"
}
unix> curl --header 'if-none-match: "34292135"' --dump - http://localhost:8529/_api/document/products/34292135

View File

@ -1,15 +1,3 @@
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products4/27472474
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/32653735
{}
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "28062298"
location: /_api/document/products4/27472474
{
"error" : false,
"_id" : "products4/27472474",
"_rev" : "28062298",
"_key" : "27472474"
}

View File

@ -1,15 +1,3 @@
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products6/22360666
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/27410855
{}
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "22950490"
location: /_api/document/products6/22360666
{
"error" : false,
"_id" : "products6/22360666",
"_rev" : "22950490",
"_key" : "22360666"
}

View File

@ -1,15 +1,3 @@
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products7/17642074
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/22757799
{}
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "18100826"
location: /_api/document/products7/17642074
{
"error" : false,
"_id" : "products7/17642074",
"_rev" : "18100826",
"_key" : "17642074"
}

View File

@ -1,15 +1,3 @@
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products8/20722266
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/25903527
{}
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "21312090"
location: /_api/document/products8/20722266
{
"error" : false,
"_id" : "products8/20722266",
"_rev" : "21312090",
"_key" : "20722266"
}

View File

@ -1,15 +1,3 @@
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products5/30618202
unix> curl -X PUT --data @- --dump - http://localhost:8529/_api/document/products/35799463
{}
HTTP/1.1 202 Accepted
content-type: application/json; charset=utf-8
etag: "31208026"
location: /_api/document/products5/30618202
{
"error" : false,
"_id" : "products5/30618202",
"_rev" : "31208026",
"_key" : "30618202"
}

View File

@ -15,3 +15,5 @@ db.demo.save({
]
});
db._drop("animals");
db._create("animals");

View File

@ -216,6 +216,7 @@ for filename in argv:
def generateArangoshOutput():
print "var internal = require('internal');"
print "var fs = require('fs');"
print "var ArangoshOutput = {};"
print "internal.startPrettyPrint(true);"
print "internal.stopColorPrint(true);"
@ -242,7 +243,7 @@ def generateArangoshOutput():
print "}());"
for key in ArangoshOutput:
print "internal.write('%s/%s.generated', ArangoshOutput['%s']);" % (OutputDir, key, key)
print "fs.write('%s/%s.generated', ArangoshOutput['%s']);" % (OutputDir, key, key)
################################################################################
### @brief generate arangosh run
@ -250,6 +251,7 @@ def generateArangoshOutput():
def generateArangoshRun():
print "var internal = require('internal');"
print "var fs = require('fs');"
print "var ArangoshRun = {};"
print "internal.startPrettyPrint(true);"
print "internal.stopColorPrint(true);"
@ -267,21 +269,21 @@ def generateArangoshRun():
value = ArangoshRun[key]
print "(function() {"
print "internal.output('\\n%s\\nRUN STARTING: %s\\n%s\\n');" % ('#' * 80, key, '#' * 80)
print "internal.output('RUN STARTING: %s\\n');" % key
print "var output = '';"
print "var appender = function(text) { output += text; };"
print "var logCurlRequestRaw = require('internal').appendCurlRequest(appender);"
print "var logCurlRequest = function () { var r = logCurlRequestRaw.apply(logCurlRequestRaw, arguments); db._collections(); return r; };"
print "var logJsonResponse = require('internal').appendJsonResponse(appender);"
print "var assert = function(a) { if (! a) { internal.output('%s\\nASSERTION FAILED: %s\\n%s\\n'); } };" % ('#' * 80, key, '#' * 80)
print "try { %s internal.output('\\n%s\\nRUN SUCCEEDED: %s\\n%s\\n'); } catch (err) { print('%s\\nRUN FAILED: %s, ', err, '\\n%s\\n'); }" % (value, '#' * 80, key, '#' * 80, '#' * 80, key, '#' * 80)
print "var assert = function(a) { if (! a) { internal.output('%s\\nASSERTION FAILED: %s\\n%s\\n'); throw new Error('assertion failed'); } };" % ('#' * 80, key, '#' * 80)
print "try { %s internal.output('RUN SUCCEEDED: %s'); } catch (err) { print('%s\\nRUN FAILED: %s, ', err, '\\n%s\\n'); }" % (value, key, '#' * 80, key, '#' * 80)
print "ArangoshRun['%s'] = output;" % key
if JS_DEBUG:
print "internal.output('%s', ':\\n', output, '\\n%s\\n');" % (key, '-' * 80)
print "}());"
for key in ArangoshRun:
print "internal.write('%s/%s.generated', ArangoshRun['%s']);" % (OutputDir, key, key)
print "fs.write('%s/%s.generated', ArangoshRun['%s']);" % (OutputDir, key, key)
################################################################################
### @brief main

View File

@ -235,7 +235,7 @@ nobase_pkgdata_DATA = \
if ENABLE_MRUBY
nobase_pkgdata_DATA += \
$(shell find @srcdir@/mr/actions/system -name "*.rb" -print)
$(shell find @srcdir@/mr/actions -name "*.rb" -print)
endif

View File

@ -330,7 +330,6 @@ static bool ParseDocumentHandle (v8::Handle<v8::Value> arg,
}
// string handle
TRI_Utf8ValueNFC str(TRI_UNKNOWN_MEM_ZONE, arg);
char const* s = *str;
@ -338,7 +337,6 @@ static bool ParseDocumentHandle (v8::Handle<v8::Value> arg,
return false;
}
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
regmatch_t matches[3];
@ -358,6 +356,37 @@ static bool ParseDocumentHandle (v8::Handle<v8::Value> arg,
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief extracts a document key from a document
////////////////////////////////////////////////////////////////////////////////
static int ExtractDocumentKey (v8::Handle<v8::Value> arg,
TRI_voc_key_t& key) {
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
if (arg->IsObject()) {
v8::Handle<v8::Object> obj = arg->ToObject();
if (obj->Has(v8g->KeyKey)) {
v8::Handle<v8::Value> v = obj->Get(v8g->KeyKey);
if (v->IsString()) {
// string key
TRI_Utf8ValueNFC str(TRI_CORE_MEM_ZONE, v);
key = TRI_DuplicateString2(*str, str.length());
}
else {
return TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD;
}
}
}
else {
return TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING;
}
return TRI_ERROR_NO_ERROR;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief checks if argument is an index identifier
////////////////////////////////////////////////////////////////////////////////
@ -458,11 +487,11 @@ static v8::Handle<v8::Value> IndexRep (TRI_collection_t* col, TRI_json_t* idx) {
/// @brief converts argument strings to TRI_vector_pointer_t
////////////////////////////////////////////////////////////////////////////////
int AttributeNamesFromArguments (v8::Arguments const& argv,
TRI_vector_pointer_t* result,
size_t start,
size_t end,
string& error) {
static int AttributeNamesFromArguments (v8::Arguments const& argv,
TRI_vector_pointer_t* result,
size_t start,
size_t end,
string& error) {
// ...........................................................................
// convert the arguments into a "C" string and stuff them into a vector
@ -985,13 +1014,21 @@ static v8::Handle<v8::Value> ReplaceVocbaseCol (const bool useCollection,
/// @brief saves a document
////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Value> SaveVocbaseCol (SingleCollectionWriteTransaction<EmbeddableTransaction<V8TransactionContext>, 1>* trx,
TRI_vocbase_col_t* col,
v8::Arguments const& argv) {
static v8::Handle<v8::Value> SaveVocbaseCol (
SingleCollectionWriteTransaction<EmbeddableTransaction<V8TransactionContext>, 1>* trx,
TRI_vocbase_col_t* col,
v8::Arguments const& argv,
bool replace,
bool lock) {
v8::HandleScope scope;
if (argv.Length() < 1 || argv.Length() > 2) {
TRI_V8_EXCEPTION_USAGE(scope, "save(<data>, <waitForSync>)");
if (replace) {
TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(<data>, [<waitForSync>])");
}
else {
TRI_V8_EXCEPTION_USAGE(scope, "save(<data>, [<waitForSync>])");
}
}
CollectionNameResolver resolver(col->_vocbase);
@ -1000,20 +1037,16 @@ static v8::Handle<v8::Value> SaveVocbaseCol (SingleCollectionWriteTransaction<Em
// set document key
TRI_voc_key_t key = 0;
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
int res;
if (argv[0]->IsObject()) {
v8::Handle<v8::Object> obj = argv[0]->ToObject();
if (obj->Has(v8g->KeyKey)) {
v8::Handle<v8::Value> v = obj->Get(v8g->KeyKey);
if (v->IsString()) {
// string key
TRI_Utf8ValueNFC str(TRI_CORE_MEM_ZONE, v);
key = TRI_DuplicateString2(*str, str.length());
holder.registerString(TRI_CORE_MEM_ZONE, key);
}
else {
TRI_V8_EXCEPTION(scope, TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD);
}
res = ExtractDocumentKey(argv[0]->ToObject(), key);
if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING) {
TRI_V8_EXCEPTION(scope, res);
}
else if (key != 0) {
holder.registerString(TRI_CORE_MEM_ZONE, key);
}
}
@ -1027,7 +1060,7 @@ static v8::Handle<v8::Value> SaveVocbaseCol (SingleCollectionWriteTransaction<Em
const bool forceSync = ExtractForceSync(argv, 2);
TRI_doc_mptr_t document;
int res = trx->createDocument(key, &document, shaped, forceSync, true);
res = trx->createDocument(key, &document, shaped, forceSync, lock);
res = trx->finish(res);
@ -1047,38 +1080,24 @@ static v8::Handle<v8::Value> SaveVocbaseCol (SingleCollectionWriteTransaction<Em
////////////////////////////////////////////////////////////////////////////////
/// @brief saves a new edge document
///
/// @FUN{@FA{edge-collection}.save(@FA{from}, @FA{to}, @FA{document})}
///
/// Saves a new edge and returns the document-handle. @FA{from} and @FA{to}
/// must be documents or document references.
///
/// @FUN{@FA{edge-collection}.save(@FA{from}, @FA{to}, @FA{document}, @FA{waitForSync})}
///
/// The optional @FA{waitForSync} parameter can be used to force
/// synchronisation of the document creation operation to disk even in case
/// that the @LIT{waitForSync} flag had been disabled for the entire collection.
/// Thus, the @FA{waitForSync} parameter can be used to force synchronisation
/// of just specific operations. To use this, set the @FA{waitForSync} parameter
/// to @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value
/// of @LIT{true}.
///
/// @EXAMPLES
///
/// @TINYEXAMPLE{shell_create-edge,create an edge}
////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Value> SaveEdgeCol (SingleCollectionWriteTransaction<EmbeddableTransaction<V8TransactionContext>, 1>* trx,
TRI_vocbase_col_t* col,
v8::Arguments const& argv) {
static v8::Handle<v8::Value> SaveEdgeCol (
SingleCollectionWriteTransaction<EmbeddableTransaction<V8TransactionContext>, 1>* trx,
TRI_vocbase_col_t* col,
v8::Arguments const& argv,
bool replace,
bool lock) {
v8::HandleScope scope;
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
if (argv.Length() < 3 || argv.Length() > 4) {
TRI_V8_EXCEPTION_USAGE(scope, "save(<from>, <to>, <data>, <waitForSync>)");
if (replace) {
TRI_V8_EXCEPTION_USAGE(scope, "saveOrReplace(<from>, <to>, <data>, [<waitForSync>])");
}
else {
TRI_V8_EXCEPTION_USAGE(scope, "save(<from>, <to>, <data>, [<waitForSync>])");
}
}
CollectionNameResolver resolver(col->_vocbase);
@ -1086,19 +1105,16 @@ static v8::Handle<v8::Value> SaveEdgeCol (SingleCollectionWriteTransaction<Embed
// set document key
TRI_voc_key_t key = 0;
int res;
if (argv[2]->IsObject()) {
v8::Handle<v8::Object> obj = argv[2]->ToObject();
if (obj->Has(v8g->KeyKey)) {
v8::Handle<v8::Value> v = obj->Get(v8g->KeyKey);
if (v->IsString()) {
TRI_Utf8ValueNFC str(TRI_CORE_MEM_ZONE, v);
key = TRI_DuplicateString2(*str, str.length());
holder.registerString(TRI_CORE_MEM_ZONE, key);
}
else {
TRI_V8_EXCEPTION(scope, TRI_ERROR_ARANGO_DOCUMENT_KEY_BAD);
}
res = ExtractDocumentKey(argv[2]->ToObject(), key);
if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING) {
TRI_V8_EXCEPTION(scope, res);
}
else if (key != 0) {
holder.registerString(TRI_CORE_MEM_ZONE, key);
}
}
@ -1150,7 +1166,7 @@ static v8::Handle<v8::Value> SaveEdgeCol (SingleCollectionWriteTransaction<Embed
TRI_doc_mptr_t document;
int res = trx->createEdge(key, &document, shaped, forceSync, &edge, true);
res = trx->createEdge(key, &document, shaped, forceSync, &edge, lock);
res = trx->finish(res);
if (res != TRI_ERROR_NO_ERROR) {
@ -5030,7 +5046,6 @@ static v8::Handle<v8::Value> JS_UpdateVocbaseCol (v8::Arguments const& argv) {
/// @verbinclude shell_create-document
////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Value> JS_SaveVocbaseCol (v8::Arguments const& argv) {
v8::HandleScope scope;
@ -5052,15 +5067,158 @@ static v8::Handle<v8::Value> JS_SaveVocbaseCol (v8::Arguments const& argv) {
v8::Handle<v8::Value> result;
if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_DOCUMENT) {
result = SaveVocbaseCol(&trx, col, argv);
result = SaveVocbaseCol(&trx, col, argv, false, true);
}
else if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_EDGE) {
result = SaveEdgeCol(&trx, col, argv);
result = SaveEdgeCol(&trx, col, argv, false, true);
}
return scope.Close(result);
}
////////////////////////////////////////////////////////////////////////////////
/// @fn SaveEdgeCol
/// @brief saves a new edge document
///
/// @FUN{@FA{edge-collection}.save(@FA{from}, @FA{to}, @FA{document})}
///
/// Saves a new edge and returns the document-handle. @FA{from} and @FA{to}
/// must be documents or document references.
///
/// @FUN{@FA{edge-collection}.save(@FA{from}, @FA{to}, @FA{document}, @FA{waitForSync})}
///
/// The optional @FA{waitForSync} parameter can be used to force
/// synchronisation of the document creation operation to disk even in case
/// that the @LIT{waitForSync} flag had been disabled for the entire collection.
/// Thus, the @FA{waitForSync} parameter can be used to force synchronisation
/// of just specific operations. To use this, set the @FA{waitForSync} parameter
/// to @LIT{true}. If the @FA{waitForSync} parameter is not specified or set to
/// @LIT{false}, then the collection's default @LIT{waitForSync} behavior is
/// applied. The @FA{waitForSync} parameter cannot be used to disable
/// synchronisation for collections that have a default @LIT{waitForSync} value
/// of @LIT{true}.
///
/// @EXAMPLES
///
/// @TINYEXAMPLE{shell_create-edge,create an edge}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief saves or replaces a document
///
/// @FUN{@FA{collection}.saveOrReplace(@FA{data})}
///
/// Creates a new document with in the @FA{collection} from the given @FA{data}
/// or replaces an existing document. The @FA{data} must be a hash array. It
/// must not contain attributes starting with `_`, expect the document key
/// stored in `_key`. If there already exists a document with the given key it
/// is replaced.
///
/// The method returns a document with the attributes `_key`, `_id` and `_rev`.
/// The attribute `_id` contains the document handle of the newly created or
/// replaced document; the attribute `_key` contains the document key; the
/// attribute `_rev` contains the document revision.
///
/// @FUN{@FA{collection}.saveOrReplace(@FA{data}, @FA{waitForSync})}
///
/// The optional @FA{waitForSync} parameter can be used to force synchronisation
/// of the document creation operation to disk even in case that the
/// `waitForSync` flag had been disabled for the entire collection. Thus, the
/// `waitForSync` parameter can be used to force synchronisation of just
/// specific operations. To use this, set the `waitForSync` parameter to
/// `true`. If the `waitForSync` parameter is not specified or set to `false`,
/// then the collection's default `waitForSync` behavior is applied. The
/// `waitForSync` parameter cannot be used to disable synchronisation for
/// collections that have a default `waitForSync` value of `true`.
///
/// @EXAMPLES
///
/// @EXAMPLE_ARANGOSH_OUTPUT{ShellSaveOrReplace1}
/// doc = db.saveOrReplace("aardvark", { german: "Erdferkell" });
/// doc = db.saveOrReplace("aardvark", { german: "Erdferkel" });
/// @END_EXAMPLE_ARANGOSH_OUTPUT
////////////////////////////////////////////////////////////////////////////////
#if 0
static v8::Handle<v8::Value> JS_SaveOrReplaceVocbaseCol (v8::Arguments const& argv) {
v8::HandleScope scope;
TRI_vocbase_col_t* col = TRI_UnwrapClass<TRI_vocbase_col_t>(argv.Holder(), WRP_VOCBASE_COL_TYPE);
if (col == 0) {
TRI_V8_EXCEPTION_INTERNAL(scope, "cannot extract collection");
}
size_t pos;
if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_DOCUMENT) {
if (argv.length < 1) {
TRI_V8_EXCEPTION_USAGE("saveOrReplace(<data>, <waitForSync>");
}
pos = 0;
}
else if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_EDGE) {
if (argv.length < 1) {
TRI_V8_EXCEPTION_USAGE("saveOrReplace(<from>, <to>, <data>, <waitForSync>");
}
pos = 2;
}
else {
TRI_V8_EXCEPTION_INTERNAL(scope, "unknown collection type");
}
ResourceHolder holder;
TRI_voc_key_t key;
int res = ExtractDocumentKey(argv[pos], key);
if (res != TRI_ERROR_NO_ERROR && res != TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING) {
TRI_V8_EXCEPTION(scope, res);
}
else if (key != 0) {
holder.registerString(TRI_CORE_MEM_ZONE, key);
}
CollectionNameResolver resolver(col->_vocbase);
SingleCollectionWriteTransaction<EmbeddableTransaction<V8TransactionContext>, 1> trx(col->_vocbase, resolver, col->_cid);
res = trx.begin();
if (res != TRI_ERROR_NO_ERROR) {
TRI_V8_EXCEPTION_MESSAGE(scope, res, "cannot save document: trx.begin failed");
}
res = trx.lockWrite();
if (res != TRI_ERROR_NO_ERROR) {
TRI_V8_EXCEPTION_MESSAGE(scope, res, "cannot save document: trx.lockWrite failed");
}
TRI_doc_mptr_t document;
res = trx.read(&document, key, false);
v8::Handle<v8::Value> result;
if (res == TRI_ERROR_NO_ERROR) {
}
else if (res == TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND) {
if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_DOCUMENT) {
result = SaveVocbaseCol(&trx, col, argv, true, false);
}
else if ((TRI_col_type_e) col->_type == TRI_COL_TYPE_EDGE) {
result = SaveEdgeCol(&trx, col, argv, true, false);
}
}
else {
TRI_V8_EXCEPTION_MESSAGE(scope, res, "cannot save document: trx.read failed");
}
return scope.Close(result);
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief sets a parameter attribute of a collection
///
@ -6647,6 +6805,9 @@ TRI_v8_global_t* TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
TRI_AddMethodVocbase(rt, "replace", JS_ReplaceVocbaseCol);
TRI_AddMethodVocbase(rt, "save", JS_SaveVocbaseCol);
#if 0
TRI_AddMethodVocbase(rt, "saveOrReplace", JS_SaveOrReplaceVocbaseCol);
#endif
TRI_AddMethodVocbase(rt, "update", JS_UpdateVocbaseCol);
v8g->VocbaseColTempl = v8::Persistent<v8::ObjectTemplate>::New(rt);
@ -6700,7 +6861,6 @@ TRI_v8_global_t* TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
// create global variables
// .............................................................................
TRI_AddGlobalVariableVocbase(context, "DATABASEPATH", v8::String::New(vocbase->_path));
TRI_AddGlobalVariableVocbase(context, "db", TRI_WrapVocBase(vocbase));
// current thread number

View File

@ -135,7 +135,6 @@ dnl ============================================================================
m4_include([m4/configure.basics])
AC_PROG_RANLIB
m4_include([m4/configure.static])
m4_include([m4/configure.logging])
m4_include([m4/configure.largefile])
m4_include([m4/configure.threads])

View File

@ -161,6 +161,7 @@
<script src="js/views/foxxInstalledView.js"></script>
<script src="js/views/foxxInstalledListView.js"></script>
<script src="js/views/foxxEditView.js"></script>
<script src="js/views/foxxMountView.js"></script>
<script src="js/views/appDocumentationView.js"></script>
<!-- router -->

View File

@ -83,6 +83,7 @@
"ERROR_ARANGO_INDEX_NEEDS_RESIZE" : { "code" : 1223, "message" : "index needs resizing" },
"ERROR_ARANGO_DATADIR_NOT_WRITABLE" : { "code" : 1224, "message" : "database directory not writable" },
"ERROR_ARANGO_OUT_OF_KEYS" : { "code" : 1225, "message" : "out of keys" },
"ERROR_ARANGO_DOCUMENT_KEY_MISSING" : { "code" : 1226, "message" : "missing document key" },
"ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" },
"ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" },
"ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" },

View File

@ -332,7 +332,7 @@ Edge.prototype.properties = function () {
////////////////////////////////////////////////////////////////////////////////
Edge.prototype._PRINT = function (context) {
if (!this._id) {
if (!this._properties._id) {
context.output += "[deleted Edge]";
}
else if (this._properties._key !== undefined) {
@ -508,7 +508,7 @@ Vertex.prototype.properties = function () {
////////////////////////////////////////////////////////////////////////////////
Vertex.prototype._PRINT = function (context) {
if (! this._id) {
if (! this._properties._id) {
context.output += "[deleted Vertex]";
}
else if (this._properties._key !== undefined) {

View File

@ -39,7 +39,7 @@ var arangosh = require("org/arangodb/arangosh");
var ArangoError = require("org/arangodb/arango-error").ArangoError;
var arango = internal.arango;
var db = internal.db;
var db = arangodb.db;
// -----------------------------------------------------------------------------
// --SECTION-- private functions
@ -58,6 +58,14 @@ function getStorage () {
return db._collection('_aal');
}
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the fishbow repository
////////////////////////////////////////////////////////////////////////////////
function getFishbowl (version) {
return "triAGENS/ArangoDB-Apps";
}
////////////////////////////////////////////////////////////////////////////////
/// @brief builds a github repository URL
////////////////////////////////////////////////////////////////////////////////
@ -75,7 +83,7 @@ function buildGithubUrl (repository, version) {
////////////////////////////////////////////////////////////////////////////////
function buildGithubFishbowlUrl (name) {
return "https://raw.github.com/triAGENS/ArangoDB-Apps/master/Fishbowl/" + name + ".json";
return "https://raw.github.com/" + getFishbowl() + "/master/Fishbowl/" + name + ".json";
}
////////////////////////////////////////////////////////////////////////////////
@ -341,6 +349,54 @@ function processSource (src) {
return response.filename;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief downloads the fishbowl repository
////////////////////////////////////////////////////////////////////////////////
function updateFishbowl () {
var i;
var url = buildGithubUrl(getFishbowl());
var filename = fs.getTempFile("downloads", false);
var path = fs.getTempFile("zip", false);
try {
var result = internal.download(url, "get", filename);
if (result.code < 200 || result.code > 299) {
throw "github download failed";
}
fs.unzipFile(filename, path, false, true);
fs.remove(filename);
filename = undefined;
}
catch (err) {
if (filename !== undefined) {
fs.remove(filename);
}
fs.removeDirectoryRecursive(path);
throw new Error("could not download from repository '" + url + "':" + String(err));
}
var files = fs.list(fs.join(path, "ArangoDB-Apps-master/Fishbowl"));
for (i = 0; i < files.length; ++i) {
var file = files[i];
if (/\.json$/.test(file)) {
console.log(file);
}
}
fs.removeDirectoryRecursive(path);
}
exports.updateFishbowl = updateFishbowl;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////

View File

@ -83,6 +83,7 @@
"ERROR_ARANGO_INDEX_NEEDS_RESIZE" : { "code" : 1223, "message" : "index needs resizing" },
"ERROR_ARANGO_DATADIR_NOT_WRITABLE" : { "code" : 1224, "message" : "database directory not writable" },
"ERROR_ARANGO_OUT_OF_KEYS" : { "code" : 1225, "message" : "out of keys" },
"ERROR_ARANGO_DOCUMENT_KEY_MISSING" : { "code" : 1226, "message" : "missing document key" },
"ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" },
"ERROR_QUERY_KILLED" : { "code" : 1500, "message" : "query killed" },
"ERROR_QUERY_PARSE" : { "code" : 1501, "message" : "%s" },

View File

@ -331,7 +331,7 @@ Edge.prototype.properties = function () {
////////////////////////////////////////////////////////////////////////////////
Edge.prototype._PRINT = function (context) {
if (!this._id) {
if (!this._properties._id) {
context.output += "[deleted Edge]";
}
else if (this._properties._key !== undefined) {
@ -507,7 +507,7 @@ Vertex.prototype.properties = function () {
////////////////////////////////////////////////////////////////////////////////
Vertex.prototype._PRINT = function (context) {
if (! this._id) {
if (! this._properties._id) {
context.output += "[deleted Vertex]";
}
else if (this._properties._key !== undefined) {

View File

@ -1,7 +1,7 @@
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true, white: true, plusplus: true, nonpropdel: true */
/*global require, db, ArangoCollection, ArangoDatabase, ArangoError, ArangoCursor,
ShapedJson, RELOAD_AUTH, SYS_DEFINE_ACTION, SYS_EXECUTE_GLOBAL_CONTEXT_FUNCTION,
DATABASEPATH, AHUACATL_RUN, AHUACATL_PARSE, AHUACATL_EXPLAIN */
AHUACATL_RUN, AHUACATL_PARSE, AHUACATL_EXPLAIN */
////////////////////////////////////////////////////////////////////////////////
/// @brief module "internal"
@ -78,13 +78,6 @@
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief database path
////////////////////////////////////////////////////////////////////////////////
internal.DATABASEPATH = DATABASEPATH;
delete DATABASEPATH;
////////////////////////////////////////////////////////////////////////////////
/// @brief execute an AQL query
////////////////////////////////////////////////////////////////////////////////

View File

@ -90,7 +90,7 @@ function buildAssetContent (app, assets) {
match = reAll.exec(asset);
if (match !== null) {
throw "not implemented";
throw new Error("not implemented");
}
else {
files.push(fs.join(rootDir, asset));
@ -104,7 +104,7 @@ function buildAssetContent (app, assets) {
try {
var c = fs.read(files[i]);
content += c;
content += c + "\n";
}
catch (err) {
console.error("cannot read asset '%s'", files[i]);
@ -126,8 +126,9 @@ function installAssets (app, routes) {
var route;
desc = app._manifest;
if (! desc) {
throw "invalid application manifest";
throw new Error("invalid application manifest");
}
if (desc.hasOwnProperty('assets')) {
@ -195,31 +196,44 @@ function executeAppScript (app, name, mount, prefix) {
desc = app._manifest;
if (! desc) {
throw "invalid application manifest";
throw new Error("invalid application manifest, app " + internal.inspect(app));
}
var root;
if (app._id.substr(0,4) === "app:") {
root = module.appPath();
}
else if (app._id.substr(0,4) === "dev:") {
root = module.devAppPath();
}
else {
throw new Error("cannot extract root path for app '" + app._id + "', unknown type");
}
if (desc.hasOwnProperty(name)) {
var cp = appContext.collectionPrefix;
var context = {};
var cname = "";
if (cp !== "") {
context.appCollectionName = function (name) {
return cp + "_" + name;
};
context.appCollection = function (name) {
return internal.db._collection(cp + "_" + name);
};
cname = cp + "_";
}
else {
context.appCollectionName = function (name) {
return name;
};
context.appCollection = function (name) {
return internal.db._collection(name);
};
}
var context = {};
context.app = {
collectionName: function (name) {
return cname + name;
},
path: function (name) {
return fs.join(root, app._path, name);
}
};
context.appCollectionName = function (name) {
return name;
};
app.loadAppScript(app.createAppModule(), desc[name], appContext, context);
}
@ -288,8 +302,8 @@ function installAalApp (app, mount, prefix, development) {
find = aal.firstExample({ type: "mount", mount: mount, active: true });
if (find !== null) {
throw "cannot use mount path '" + mount + "', already used by '"
+ find.app + "' (" + find._key + ")";
throw new Error("cannot use mount path '" + mount + "', already used by '"
+ find.app + "' (" + find._key + ")");
}
// .............................................................................
@ -339,7 +353,7 @@ function routingAalApp (app, mount, prefix) {
}
if (mount[0] !== "/") {
throw "mount point must be absolute";
throw new Error("mount point must be absolute");
}
// compute the collection prefix
@ -548,7 +562,7 @@ exports.installApp = function (appId, mount, options) {
app = module.createApp(appId);
if (app === null) {
throw "cannot find application '" + appId + "'";
throw new Error("cannot find application '" + appId + "'");
}
// .............................................................................
@ -559,8 +573,8 @@ exports.installApp = function (appId, mount, options) {
routes = routingAalApp(app, mount, prefix);
if (routes === null) {
throw "cannot compute the routing table for fox application '"
+ app._id + "', check the log file for errors!";
throw new Error("cannot compute the routing table for fox application '"
+ app._id + "', check the log file for errors!");
}
// .............................................................................
@ -604,7 +618,6 @@ exports.installDevApp = function (name, mount, options) {
'use strict';
var aal;
var app;
var desc;
var doc;
var prefix;
@ -619,7 +632,7 @@ exports.installDevApp = function (name, mount, options) {
var path = module.devAppPath();
if (typeof path === "undefined" || path === "") {
throw "dev-app-path is not set, cannot install development app '" + name + "'";
throw new Error("dev-app-path is not set, cannot install development app '" + name + "'");
}
var appId = null;
@ -628,11 +641,18 @@ exports.installDevApp = function (name, mount, options) {
if (fs.exists(filename)) {
appId = "dev:" + name + ":" + name;
}
else {
throw new Error("not manifest found at '" + filename + "'");
}
app = appId !== null && module.createApp(appId);
var app = null;
if (appId !== null) {
app = module.createApp(appId);
}
if (app === null) {
throw "cannot find development application '" + name + "'";
throw new Error("cannot find development application '" + appId + "'");
}
// .............................................................................
@ -680,7 +700,7 @@ exports.uninstallApp = function (key) {
}
if (doc === null) {
throw "key '" + key + "' is neither a mount id nor a mount point";
throw new Error("key '" + key + "' is neither a mount id nor a mount point");
}
var appId = doc.app;
@ -690,7 +710,7 @@ exports.uninstallApp = function (key) {
appDoc = aal.firstExample({ app: appId, type: "app" });
if (appDoc === null) {
throw "cannot find app '" + appId + "' in _aal collection";
throw new Error("cannot find app '" + appId + "' in _aal collection");
}
}

View File

@ -50,7 +50,7 @@
var db = internal.db;
// path to the VERSION file
var versionFile = internal.DATABASEPATH + "/VERSION";
var versionFile = internal.db._path + "/VERSION";
function runUpgrade (currentVersion) {
var allTasks = [ ];
@ -327,7 +327,7 @@
// set up the collection _aal
addTask("setupAal", "setup _aal collection", function () {
return createSystemCollection("_aal", { waitForSync : false });
return createSystemCollection("_aal", { waitForSync : true });
});
// create a unique index on collection attribute in _aal
@ -350,6 +350,26 @@
return createSystemCollection("_aqlfunctions", { waitForSync : false });
});
// set up the collection _aalFishbowl
addTask("setupAalFishbowl", "setup _aalFishbowl collection", function () {
return createSystemCollection("_aalFishbowl", { waitForSync : true });
});
// create a unique index on collection attribute in _aal
addTask("createAalFisbowlIndex",
"create indexes on collection attribute in _aalFishbowl collection",
function () {
var aal = getCollection("_aal");
if (! aal) {
return false;
}
aal.ensureUniqueConstraint("name");
return true;
});
// loop through all tasks and execute them
console.log("Found " + allTasks.length + " defined task(s), "
+ activeTasks.length + " task(s) to run");

View File

@ -239,9 +239,9 @@ namespace triagens {
namespace basics {
namespace StringUtils {
// -----------------------------------------------------------------------------
// .............................................................................
// STRING AND STRING POINTER
// -----------------------------------------------------------------------------
// .............................................................................
blob_t duplicateBlob (const blob_t& source) {
blob_t result = {0,0};
@ -392,9 +392,9 @@ namespace triagens {
}
}
// -----------------------------------------------------------------------------
// .............................................................................
// STRING CONVERSION
// -----------------------------------------------------------------------------
// .............................................................................
string capitalize (string const& name, bool first) {
size_t len = name.length();
@ -1633,9 +1633,9 @@ namespace triagens {
return result;
}
// -----------------------------------------------------------------------------
// .............................................................................
// CONVERT TO STRING
// -----------------------------------------------------------------------------
// .............................................................................
string itoa (int16_t attr) {
char buffer[7];
@ -1815,9 +1815,9 @@ namespace triagens {
return result;
}
// -----------------------------------------------------------------------------
// .............................................................................
// CONVERT FROM STRING
// -----------------------------------------------------------------------------
// .............................................................................
bool boolean (string const& str) {
string lower = tolower(trim(str));
@ -2914,9 +2914,9 @@ namespace triagens {
}
// -----------------------------------------------------------------------------
// .............................................................................
// UTF8
// -----------------------------------------------------------------------------
// .............................................................................
// this function takes a sequence of hexadecimal characters (inputStr) of a particular
// length (len) and output 1,2,3 or 4 characters which represents the utf8 encoding
@ -2943,9 +2943,9 @@ namespace triagens {
}
// -----------------------------------------------------------------------------
// .............................................................................
// UTF16
// -----------------------------------------------------------------------------
// .............................................................................
// this function converts unicode symbols whose code points lies in U+10000 to U+10FFFF
//
@ -2976,9 +2976,9 @@ namespace triagens {
return ok;
}
// -----------------------------------------------------------------------------
// .............................................................................
// BASE64
// -----------------------------------------------------------------------------
// .............................................................................
string encodeBase64 (string const& in) {
unsigned char charArray3[3];
@ -3198,9 +3198,9 @@ namespace triagens {
return ret;
}
// -----------------------------------------------------------------------------
// .............................................................................
// ADDITIONAL STRING UTILITIES
// -----------------------------------------------------------------------------
// .............................................................................
string correctPath(const string& incorrectPath) {
#ifdef _WIN32
@ -3210,8 +3210,8 @@ namespace triagens {
#endif
}
/// In a list str = "xx,yy,zz ...", entry(n,str,',') returns the nth entry of the list delimited
/// by ','. E.g entry(2,str,',') = 'yy'
// In a list str = "xx,yy,zz ...", entry(n,str,',') returns the nth entry of the list delimited
// by ','. E.g entry(2,str,',') = 'yy'
string entry (const size_t pos, string const& sourceStr, string const& delimiter) {
size_t delLength = delimiter.length();

View File

@ -101,6 +101,7 @@ ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED,1222,"unexpected document key","Will be rai
ERROR_ARANGO_INDEX_NEEDS_RESIZE,1223,"index needs resizing","Will be raised when an index is full and should be resized to contain more data."
ERROR_ARANGO_DATADIR_NOT_WRITABLE,1224,"database directory not writable","Will be raised when the database directory is not writable for the current user."
ERROR_ARANGO_OUT_OF_KEYS,1225,"out of keys","Will be raised when a key generator runs out of keys."
ERROR_ARANGO_DOCUMENT_KEY_MISSING,1226,"missing document key","Will be raised when a document key is missing."
################################################################################
## ArangoDB storage errors

View File

@ -79,6 +79,7 @@ void TRI_InitialiseErrorMessages (void) {
REG_ERROR(ERROR_ARANGO_INDEX_NEEDS_RESIZE, "index needs resizing");
REG_ERROR(ERROR_ARANGO_DATADIR_NOT_WRITABLE, "database directory not writable");
REG_ERROR(ERROR_ARANGO_OUT_OF_KEYS, "out of keys");
REG_ERROR(ERROR_ARANGO_DOCUMENT_KEY_MISSING, "missing document key");
REG_ERROR(ERROR_ARANGO_DATAFILE_FULL, "datafile full");
REG_ERROR(ERROR_QUERY_KILLED, "query killed");
REG_ERROR(ERROR_QUERY_PARSE, "%s");

View File

@ -162,6 +162,8 @@ extern "C" {
/// current user.
/// - 1225: @LIT{out of keys}
/// Will be raised when a key generator runs out of keys.
/// - 1226: @LIT{missing document key}
/// Will be raised when a document key is missing.
/// - 1300: @LIT{datafile full}
/// Will be raised when the datafile reaches its limit.
/// - 1500: @LIT{query killed}
@ -1105,6 +1107,16 @@ void TRI_InitialiseErrorMessages (void);
#define TRI_ERROR_ARANGO_OUT_OF_KEYS (1225)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1226: ERROR_ARANGO_DOCUMENT_KEY_MISSING
///
/// missing document key
///
/// Will be raised when a document key is missing.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_ARANGO_DOCUMENT_KEY_MISSING (1226)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1300: ERROR_ARANGO_DATAFILE_FULL
///

View File

@ -1676,6 +1676,10 @@ void TRI_InitV8Conversions (v8::Handle<v8::Context> context) {
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"

View File

@ -595,6 +595,10 @@ void TRI_AddGlobalVariableVocbase (v8::Handle<v8::Context> context,
#endif
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"

View File

@ -26,7 +26,7 @@
/// @author Copyright 2011, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include <BasicsC/common.h>
#include "BasicsC/common.h"
#include "V8/v8-globals.h"
@ -2249,15 +2249,18 @@ static v8::Handle<v8::Value> ParseObject (yyscan_t scanner, int c) {
else {
// string is not empty
ptr = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, yyleng - 2, &outLength);
}
if (ptr == NULL) {
yyextra._message = "out-of-memory";
return scope.Close(v8::Undefined());
if (ptr == NULL || outLength == 0) {
yyextra._message = "out-of-memory";
return scope.Close(v8::Undefined());
}
}
str = v8::String::New(ptr, outLength);
TRI_FreeString(yyextra._memoryZone, ptr);
if (0 < outLength) {
TRI_FreeString(yyextra._memoryZone, ptr);
}
return scope.Close(str);
@ -2321,6 +2324,7 @@ v8::Handle<v8::Value> TRI_FromJsonString (char const* text, char** error) {
tri_v8_lex_init(&scanner);
yyg = (struct yyguts_t*) scanner;
yyextra._memoryZone = TRI_CORE_MEM_ZONE;
buf = tri_v8__scan_string(text,scanner);
c = tri_v8_lex(scanner);

View File

@ -360,15 +360,18 @@ static v8::Handle<v8::Value> ParseObject (yyscan_t scanner, int c) {
else {
// string is not empty
ptr = TRI_UnescapeUtf8StringZ(yyextra._memoryZone, yytext + 1, yyleng - 2, &outLength);
}
if (ptr == NULL) {
yyextra._message = "out-of-memory";
return scope.Close(v8::Undefined());
if (ptr == NULL || outLength == 0) {
yyextra._message = "out-of-memory";
return scope.Close(v8::Undefined());
}
}
str = v8::String::New(ptr, outLength);
TRI_FreeString(yyextra._memoryZone, ptr);
if (0 < outLength) {
TRI_FreeString(yyextra._memoryZone, ptr);
}
return scope.Close(str);
@ -432,6 +435,7 @@ v8::Handle<v8::Value> TRI_FromJsonString (char const* text, char** error) {
yylex_init(&scanner);
yyg = (struct yyguts_t*) scanner;
yyextra._memoryZone = TRI_CORE_MEM_ZONE;
buf = yy_scan_string(text, scanner);
c = yylex(scanner);

View File

@ -29,10 +29,10 @@
#include "BasicsC/win-utils.h"
#endif
#include "build.h"
#include "v8-utils.h"
#include "build.h"
#include <fstream>
#include <locale>
@ -86,11 +86,6 @@ namespace {
// --SECTION-- public classes
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup V8Utils
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief Converts an object to a UTF-8-encoded and normalized character array.
////////////////////////////////////////////////////////////////////////////////
@ -110,19 +105,10 @@ TRI_Utf8ValueNFC::~TRI_Utf8ValueNFC () {
}
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup V8Utils
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief create a Javascript error object
////////////////////////////////////////////////////////////////////////////////
@ -133,9 +119,9 @@ static v8::Handle<v8::Object> CreateErrorObject (int errorNumber, string const&
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
v8::Handle<v8::String> errorMessage = v8::String::New(message.c_str(), message.size());
v8::Handle<v8::Object> errorObject = v8::Exception::Error(errorMessage)->ToObject();
errorObject->Set(v8::String::New("errorNum"), v8::Number::New(errorNumber));
errorObject->Set(v8::String::New("errorMessage"), errorMessage);
@ -289,19 +275,10 @@ static void FillDistribution (v8::Handle<v8::Object> list,
list->Set(TRI_V8_SYMBOL(name), result);
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- JS functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup V8Utils
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief parse a Javascript snippet, but do not execute it
///
@ -356,13 +333,13 @@ static v8::Handle<v8::Value> JS_Parse (v8::Arguments const& argv) {
///
/// @FUN{internal.download(@FA{url}, @FA{method}, @FA{outfile}, @FA{timeout})}
///
/// Downloads the data from the URL specified by @FA{url} and saves the
/// Downloads the data from the URL specified by @FA{url} and saves the
/// response body to @FA{outfile}.
////////////////////////////////////////////////////////////////////////////////
static v8::Handle<v8::Value> JS_Download (v8::Arguments const& argv) {
v8::HandleScope scope;
if (argv.Length() < 3) {
TRI_V8_EXCEPTION_USAGE(scope, "download(<url>, <method>, <outfile>, <timeout>)");
}
@ -423,7 +400,7 @@ static v8::Handle<v8::Value> JS_Download (v8::Arguments const& argv) {
else {
TRI_V8_SYNTAX_ERROR(scope, "unsupported URL specified");
}
LOGGER_TRACE("downloading file. endpoint: " << endpoint << ", relative URL: " << url);
GeneralClientConnection* connection = GeneralClientConnection::factory(Endpoint::clientFactory(endpoint), timeout, timeout, 3);
@ -491,7 +468,7 @@ static v8::Handle<v8::Value> JS_Download (v8::Arguments const& argv) {
}
}
}
result->Set(v8::String::New("code"), v8::Number::New(returnCode));
result->Set(v8::String::New("message"), v8::String::New(returnMessage.c_str()));
@ -502,7 +479,7 @@ static v8::Handle<v8::Value> JS_Download (v8::Arguments const& argv) {
delete connection;
return scope.Close(result);
}
TRI_V8_EXCEPTION_INTERNAL(scope, "too many redirects");
}
@ -732,8 +709,8 @@ static v8::Handle<v8::Value> JS_GetTempPath (v8::Arguments const& argv) {
///
/// @FUN{fs.getTempFile(@FA{directory}, @FA{createFile})}
///
/// Returns the name for a new temporary file in directory @FA{directory}.
/// If @FA{createFile} is @LIT{true}, an empty file will be created so no other
/// Returns the name for a new temporary file in directory @FA{directory}.
/// If @FA{createFile} is @LIT{true}, an empty file will be created so no other
/// process can create a file of the same name.
///
/// Note that the directory @FA{directory} must exist.
@ -857,7 +834,7 @@ static v8::Handle<v8::Value> JS_List (v8::Arguments const& argv) {
uint32_t j = 0;
for (size_t i = 0; i < list._length; ++i) {
const char* f = list._buffer[i];
const char* f = list._buffer[i];
result->Set(j++, v8::String::New(f));
}
@ -900,7 +877,7 @@ static v8::Handle<v8::Value> JS_ListTree (v8::Arguments const& argv) {
uint32_t j = 0;
for (size_t i = 0; i < list._length; ++i) {
const char* f = list._buffer[i];
const char* f = list._buffer[i];
result->Set(j++, v8::String::New(f));
}
@ -920,7 +897,7 @@ static v8::Handle<v8::Value> JS_ListTree (v8::Arguments const& argv) {
static v8::Handle<v8::Value> JS_MakeDirectory (v8::Arguments const& argv) {
v8::HandleScope scope;
// 2nd argument (permissions) are ignored for now
// extract arguments
@ -1021,8 +998,8 @@ static v8::Handle<v8::Value> JS_ZipFile (v8::Arguments const& argv) {
}
v8::Handle<v8::Array> files = v8::Handle<v8::Array>::Cast(argv[2]);
int res = TRI_ERROR_NO_ERROR;
int res = TRI_ERROR_NO_ERROR;
TRI_vector_string_t filenames;
TRI_InitVectorString(&filenames, TRI_UNKNOWN_MEM_ZONE);
@ -1043,8 +1020,8 @@ static v8::Handle<v8::Value> JS_ZipFile (v8::Arguments const& argv) {
TRI_V8_EXCEPTION_USAGE(scope, "zip(<filename>, <files>, <password>)");
}
const char* p;
const char* p;
string password;
if (argv.Length() == 4) {
password = TRI_ObjectToString(argv[3]);
@ -1638,7 +1615,7 @@ static v8::Handle<v8::Value> JS_Remove (v8::Arguments const& argv) {
if (argv.Length() != 1) {
TRI_V8_EXCEPTION_USAGE(scope, "remove(<filename>)");
}
TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]);
if (*name == 0) {
@ -1670,7 +1647,7 @@ static v8::Handle<v8::Value> JS_RemoveDirectory (v8::Arguments const& argv) {
if (argv.Length() != 1) {
TRI_V8_EXCEPTION_USAGE(scope, "removeDirectory(<path>)");
}
TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]);
if (*name == 0) {
@ -1695,7 +1672,7 @@ static v8::Handle<v8::Value> JS_RemoveDirectory (v8::Arguments const& argv) {
///
/// @FUN{fs.removeDirectoryRecursive(@FA{path})}
///
/// Removes a directory with all subelements. Throws an exception if the path
/// Removes a directory with all subelements. Throws an exception if the path
/// is not a directory.
////////////////////////////////////////////////////////////////////////////////
@ -1706,7 +1683,7 @@ static v8::Handle<v8::Value> JS_RemoveRecursiveDirectory (v8::Arguments const& a
if (argv.Length() != 1) {
TRI_V8_EXCEPTION_USAGE(scope, "removeDirectoryRecursive(<path>)");
}
TRI_Utf8ValueNFC name(TRI_UNKNOWN_MEM_ZONE, argv[0]);
if (*name == 0) {
@ -1716,7 +1693,7 @@ static v8::Handle<v8::Value> JS_RemoveRecursiveDirectory (v8::Arguments const& a
if (! TRI_IsDirectory(*name)) {
TRI_V8_EXCEPTION_PARAMETER(scope, "<path> must be a valid directory name");
}
if (TempPath.size() < 8) {
// some security measure so we don't accidently delete all our files
TRI_V8_EXCEPTION_PARAMETER(scope, "temporary directory name is too short. will not remove directory");
@ -1979,19 +1956,10 @@ static v8::Handle<v8::Value> JS_RequestStatistics (v8::Arguments const& argv) {
return scope.Close(result);
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup V8Utils
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief adds attributes to array
////////////////////////////////////////////////////////////////////////////////
@ -2386,7 +2354,7 @@ void TRI_InitV8Utils (v8::Handle<v8::Context> context,
// .............................................................................
// generate the general error template
// .............................................................................
ft = v8::FunctionTemplate::New();
ft->SetClassName(TRI_V8_SYMBOL("ArangoError"));
@ -2459,9 +2427,9 @@ void TRI_InitV8Utils (v8::Handle<v8::Context> context,
TRI_AddGlobalVariableVocbase(context, "SYS_PLATFORM", v8::String::New(TRI_PLATFORM));
}
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor

View File

@ -9,7 +9,7 @@ MRUBY_LDLAGS=""
MRUBY_LIBSLAGS=""
AC_ARG_ENABLE(mruby,
AS_HELP_STRING([--enable-mruby], [enable MRUBY]),
AS_HELP_STRING([--enable-mruby], [enable MRUBY (default: no)]),
[tr_MRUBY="${enableval:-yes}"],
[tr_MRUBY=no]
)

View File

@ -196,26 +196,6 @@ if test "x$tr_ISYSTEM" = "xno"; then
INCPREFIX="-I"
fi
dnl ----------------------------------------------------------------------------
dnl checks for linker settings
dnl ----------------------------------------------------------------------------
case $target in
*-apple-darwin*)
ABS_STATIC_LIBS="yes"
STATIC_LIBS=""
DYNAMIC_LIBS=""
LIBTOOL_LIBS=""
USE_DYLD="yes"
;;
*)
STATIC_LIBS="-Wl,-Bstatic"
DYNAMIC_LIBS="-Wl,-Bdynamic"
LIBTOOL_LIBS="-Wl,"
;;
esac
dnl ----------------------------------------------------------------------------
dnl generate correct include, either -I oder -isystem
dnl ----------------------------------------------------------------------------
@ -250,180 +230,3 @@ AC_DEFUN([TR_LIBRARY],[
esac
done
])
dnl ----------------------------------------------------------------------------
dnl static enable library
dnl
dnl usage: TR_STATIC_ENABLE(static-if-name)
dnl ----------------------------------------------------------------------------
AC_DEFUN([TR_STATIC_ENABLE],[
if test "x$STATIC_LIBS" != x -o "x$ABS_STATIC_LIBS" = xyes; then
AC_ARG_ENABLE(static-$1,
AS_HELP_STRING([--enable-static-$1], [using static library '$1' (default: no)]),
[tr_static_$1="$enableval"],
[tr_static_$1="no"]
)
else
tr_static_$1="no"
fi
])
dnl ----------------------------------------------------------------------------
dnl find static or shared C library
dnl
dnl usage: TR_FIND_C_LIBRARY(static-if-name,
dnl library,
dnl lib environment,
dnl function to check)
dnl
dnl returns: tr_library_found
dnl ----------------------------------------------------------------------------
AC_DEFUN([TR_FIND_C_LIBRARY],[
if test "x$ABS_STATIC_LIBS" = xyes -a "x$tr_static_$1" = xyes; then
tr_library_found=no
AC_MSG_CHECKING([$2])
TR_LIBRARY($2)
if test "x$tr_library" != x; then
$3="$tr_library $$3"
AC_MSG_RESULT([$tr_library])
tr_library_found=yes
else
AC_MSG_RESULT([no])
fi
else
tr_library_found=yes
AC_CHECK_LIB([$2],
[$4],
[$3="-l$2 $$3"],
[tr_library_found=no])
fi
])
dnl ----------------------------------------------------------------------------
dnl find static or shared C++ library
dnl
dnl usage: TR_FIND_CXX_LIBRARY(static-if-name,
dnl library,
dnl lib environment,
dnl include header,
dnl body source code)
dnl
dnl returns: tr_library_found
dnl ----------------------------------------------------------------------------
AC_DEFUN([TR_FIND_CXX_LIBRARY],[
if test "x$ABS_STATIC_LIBS" = xyes -a "x$tr_static_$1" = xyes; then
tr_library_found=no
AC_MSG_CHECKING([$2])
TR_LIBRARY($2)
if test "x$tr_library" != x; then
$3="$tr_library $$3"
AC_MSG_RESULT([$tr_library])
tr_library_found=yes
else
AC_MSG_RESULT([no])
fi
else
tr_library_found=yes
AX_CXX_CHECK_LIB([$2],
[$4],
[$5],
[$3="-l$2 $$3"],
[tr_library_found=no])
fi
])
dnl ----------------------------------------------------------------------------
dnl find absolute path for libraries
dnl
dnl usage: TR_ABSOLUTE_LIBRARIES(lib environment)
dnl
dnl returns: tr_libraries_found
dnl ----------------------------------------------------------------------------
AC_DEFUN([TR_ABSOLUTE_LIBRARIES],
[if test "x$tr_static_$1" = xyes -a "x$ABS_STATIC_LIBS" = xyes; then
tr_libraries_found=no
tr_missing=""
tr_result=""
tr_special=""
for tr_lib in $$2; do
case $tr_lib in
-lpthread|-lm|-lrt)
tr_special="$tr_special $tr_lib"
;;
-l*)
lib=`echo $tr_lib | sed -e 's:^-l::'`
tr_missing="$tr_missing $lib"
;;
esac
done
for tr_path in $$2; do
case $tr_path in
-L*)
path=`echo $tr_path | sed -e 's:^-L::'`
tr_still_missing=""
for tr_lib in $tr_missing; do
AC_MSG_CHECKING([for the static library $tr_lib in $path])
if test -f "$path/lib$tr_lib.a"; then
AC_MSG_RESULT([$path/lib$tr_lib.a])
tr_result="$tr_result $path/lib$tr_lib.a"
else
AC_MSG_RESULT()
tr_still_missing="$tr_sill_missing $tr_lib"
fi
done
tr_missing="$tr_still_missing"
;;
esac
done
for tr_path in $LDFLAGS; do
case $tr_path in
-L*)
path=`echo $tr_path | sed -e 's:^-L::'`
tr_still_missing=""
for tr_lib in $tr_missing; do
AC_MSG_CHECKING([for the static library $tr_lib in $path])
if test -f "$path/lib$tr_lib.a"; then
AC_MSG_RESULT([$path/lib$tr_lib.a])
tr_result="$tr_result $path/lib$tr_lib.a"
else
AC_MSG_RESULT()
tr_still_missing="$tr_sill_missing $tr_lib"
fi
done
tr_missing="$tr_still_missing"
;;
esac
done
if test "x$tr_missing" = x; then
tr_libraries_found=yes
$2="$tr_result $tr_special"
else
tr_libraries_found=no
fi
else
tr_libraries_found=yes
fi
])

View File

@ -4,23 +4,19 @@ dnl ----------------------------------------------------------------------------
dnl --SECTION-- MAINTAINER MODE
dnl ----------------------------------------------------------------------------
AC_ARG_ENABLE(maintainer-mode,
AS_HELP_STRING([--enable-maintainer-mode], [enable maintainer mode (default: no)]),
[tr_MAINTAINER_MODE="${enableval:-yes}"],
[tr_MAINTAINER_MODE=no]
)
AM_MAINTAINER_MODE
if test "x$tr_MAINTAINER_MODE" = "xyes"; then
if test "x$USE_MAINTAINER_MODE" = "xyes"; then
AC_DEFINE_UNQUOTED(TRI_ENABLE_MAINTAINER_MODE, 1, [true if maintainer mode is enabled])
fi
AM_CONDITIONAL(ENABLE_MAINTAINER_MODE, test "x$tr_MAINTAINER_MODE" = xyes)
AM_CONDITIONAL(ENABLE_MAINTAINER_MODE, test "x$USE_MAINTAINER_MODE" = xyes)
dnl ----------------------------------------------------------------------------
dnl check for bison
dnl ----------------------------------------------------------------------------
if test "x$tr_MAINTAINER_MODE" = xyes; then
if test "x$USE_MAINTAINER_MODE" = xyes; then
AC_MSG_NOTICE([................................................................................])
AC_MSG_NOTICE([CHECKING BISON])
AC_MSG_NOTICE([................................................................................])
@ -58,7 +54,7 @@ dnl ----------------------------------------------------------------------------
dnl check for flex
dnl ----------------------------------------------------------------------------
if test "x$tr_MAINTAINER_MODE" = xyes; then
if test "x$USE_MAINTAINER_MODE" = xyes; then
AC_MSG_NOTICE([................................................................................])
AC_MSG_NOTICE([CHECKING FLEX])
AC_MSG_NOTICE([................................................................................])

View File

@ -1,63 +0,0 @@
dnl -*- mode: Autoconf; -*-
dnl -----------------------------------------------------------------------------------------
dnl option for static programs
dnl
dnl Note that you need static system libraries
dnl -----------------------------------------------------------------------------------------
AC_ARG_ENABLE(static-programs,
AS_HELP_STRING([--enable-static-programs], [do not use shared libraries (default: no)]),
tr_STATIC_PROGRAMS="$enableval",
tr_STATIC_PROGRAMS="no"
)
dnl -----------------------------------------------------------------------------------------
dnl enable static programs if possible
dnl -----------------------------------------------------------------------------------------
if test "x$tr_STATIC_PROGRAMS" = xyes; then
LDFLAGS="$LDFLAGS -static"
fi
dnl -----------------------------------------------------------------------------------------
dnl static library
dnl
dnl usage: TR_STATIC_LIBRARY(static-if-name,
dnl library environment)
dnl -----------------------------------------------------------------------------------------
AC_DEFUN([TR_STATIC_LIBRARY],[
if test "x$tr_static_$1" = xyes -a "x$2" != x; then
tr_libs=""
tr_special=""
for tr_lib in $$2; do
case $tr_lib in
-lpthread|-lm|-lrt)
tr_special="$tr_special $tr_lib"
;;
-l*)
tr_libs="$tr_libs $tr_lib"
;;
*)
tr_libs="$tr_libs $tr_lib"
;;
esac
done
$2="$STATIC_LIBS $tr_libs $DYNAMIC_LIBS $tr_special"
fi
])
dnl -----------------------------------------------------------------------------------------
dnl informational output
dnl -----------------------------------------------------------------------------------------
if test "x$tr_STATIC_PROGRAMS" = xyes; then
BASIC_INFO="$BASIC_INFO|STATIC PROGRAMS: enabled"
else
BASIC_INFO="$BASIC_INFO|STATIC PROGRAMS: disabled"
fi

View File

@ -13,8 +13,6 @@ AC_ARG_WITH(icu-config,
[ICU_CONFIG="$withval"]
)
dnl TR_STATIC_ENABLE([ICU])
if test "x$tr_ICU" = xyes; then
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
AC_MSG_NOTICE([CHECKING FOR ICU])

View File

@ -16,8 +16,6 @@ AC_ARG_WITH(libev-lib,
[LIBEV_LDFLAGS="-L$withval"]
)
TR_STATIC_ENABLE([libev])
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
AC_MSG_NOTICE([CHECKING FOR LIBEV])
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
@ -55,15 +53,11 @@ ch_LIBEV="$tr_LIBEV"
AC_CHECK_HEADERS(ev.h, [tr_LIBEV="yes"], [tr_LIBEV="no"])
if test "x$tr_LIBEV" = xyes; then
AC_CHECK_LIB([rt], [clock_gettime], [LIBEV_LIBS="-lrt $LIBEV_LIBS" LIBS="-lrt $LIBS"], )
TR_FIND_C_LIBRARY([libev], [ev], [LIBEV_LIBS], [ev_now])
tr_LIBEV=$tr_library_found
AC_CHECK_LIB([rt], [clock_gettime], [LIBEV_LIBS="-lrt" LIBS="-lrt $LIBS"], )
AC_CHECK_LIB([libev], [ev_now], [LIBEV_LIBS="-lev $LIBEV_LIBS" tr_LIBEV="yes"], )
fi
if test "x$tr_LIBEV" = xyes; then
TR_STATIC_LIBRARY([libev], [LIBEV_LIBS])
else
if test "x$tr_LIBEV" != xyes; then
AC_MSG_ERROR([Please install libev from http://software.schmorp.de/pkg/libev.html])
fi

View File

@ -14,8 +14,6 @@ AC_ARG_WITH(openssl-lib,
OPENSSL_LDFLAGS="-L$withval"
)
TR_STATIC_ENABLE([ssl])
dnl -----------------------------------------------------------------------------------------
dnl check for OpenSSL
dnl -----------------------------------------------------------------------------------------
@ -72,43 +70,11 @@ else
AC_MSG_RESULT([SSL_METHOD*])
fi
dnl check if openssl was compiled using zlib
if test "x$tr_STATIC_PROGRAMS" = xyes; then
LDFLAGS="$LDFLAGS $lt_prog_compiler_static"
AC_MSG_CHECKING([if OpenSSL requires static zlib])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#include <openssl/ssl.h>
]],
[[
SSL_library_init();
]])],
[tr_OPENSSL_NEEDS_ZLIB=no],
[tr_OPENSSL_NEEDS_ZLIB=yes])
AC_MSG_RESULT($tr_OPENSSL_NEEDS_ZLIB)
if test "x$tr_OPENSSL_NEEDS_ZLIB" = "xyes"; then
AC_CHECK_LIB([z], [zError],
OPENSSL_LIBS="$OPENSSL_LIBS -lz",
AC_MSG_ERROR([please install the static zlib library]))
fi
fi
TR_ABSOLUTE_LIBRARIES([ssl], [OPENSSL_LIBS])
if test "x$tr_libraries_found" != xyes; then
AC_MSG_ERROR([Please install the OpenSSL library])
fi
dnl -----------------------------------------------------------------------------------------
dnl fix include and static libraries
dnl -----------------------------------------------------------------------------------------
TR_INCLUDE([OPENSSL_CPPFLAGS])
TR_STATIC_LIBRARY([ssl], [OPENSSL_LIBS])
dnl -----------------------------------------------------------------------------------------
dnl add substitutions

View File

@ -28,8 +28,6 @@ AC_ARG_WITH(readline-lib,
[READLINE_LDFLAGS="-L$withval"]
)
TR_STATIC_ENABLE([readline])
dnl ----------------------------------------------------------------------------
dnl checks for the READLINE library
dnl ----------------------------------------------------------------------------
@ -60,13 +58,10 @@ if test "x$tr_READLINE" = xyes -o "x$tr_READLINE" = xmaybe; then
AC_CHECK_HEADERS(readline/readline.h, [tr_READLINE="yes"], [tr_READLINE="no"])
if test "x$tr_READLINE" = xyes; then
TR_FIND_C_LIBRARY([readline], [readline], [READLINE_LIBS], [readline])
tr_READLINE=$tr_library_found
AC_CHECK_LIB([readline], [readline], [READLINE_LIBS="-lreadline" tr_READLINE="yes"], [tr_READLINE="no"])
fi
if test "x$tr_READLINE" = xyes; then
TR_STATIC_LIBRARY([readline], [READLINE_LIBS])
else
if test "x$tr_READLINE" != xyes; then
if test "x$ch_READLINE" = xyes; then
AC_MSG_ERROR([Please install readline support])
fi

View File

@ -22,8 +22,6 @@ AC_ARG_WITH(v8-lib,
V8_LIB_PATH="$withval"]
)
TR_STATIC_ENABLE([v8])
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
AC_MSG_NOTICE([CHECKING FOR GOOGLE V8])
AC_MSG_NOTICE([--------------------------------------------------------------------------------])

View File

@ -166,6 +166,9 @@ sub formatFile ($$$) {
|| die "cannot open output file '$file.new'";
}
my $lastLine = undef;
my $skipGroup = 0;
while (<IN>) {
chomp;
@ -175,11 +178,51 @@ sub formatFile ($$$) {
my $line = $_;
$breakLine = 0;
if ($line =~ /^\/\/\/ \@addtogroup/) {
$lastLine = undef;
$skipGroup = 1;
print STDERR "skip group 1\n";
next;
}
if ($line =~ /^\/\/\/ @}/) {
$lastLine = undef;
$skipGroup = 1;
print STDERR "skip group 1a\n";
next;
}
if ($skipGroup == 1) {
if ($line =~ /^\/\/\/\/\/\//) {
$skipGroup = 2;
print STDERR "skip group 2\n";
print STDERR "$line\n";
}
next;
}
if ($skipGroup == 2) {
if ($line !~ /^[\t ]*$/) {
$skipGroup = 0;
print STDERR "skip group 0\n";
print STDERR "$line\n";
}
else {
next;
}
}
if (defined $lastLine) {
print $out "$lastLine\n";
$lastLine = undef;
}
if ($line eq '/// @author Dr. O') {
$line = '/// @author Dr. Oreste Costa-Panaia';
}
if ($line =~ /\/\/ outline-regexp:/) {
if ($line =~ /^\/\/ outline-regexp:/) {
if ($isJavaScript == 1) {
$line = '// outline-regexp: "/// @brief\\\\|/// @addtogroup\\\\|/// @page\\\\|// --SECTION--\\\\|/// @\\\\}\\\\|/\\\\*jslint"';
}
@ -297,10 +340,15 @@ sub formatFile ($$$) {
}
if (! $dryRun || ! $preambleDone) {
print $out "$line\n";
$lastLine = $line;
}
}
if (defined $lastLine) {
print $out "$lastLine\n";
$lastLine = undef;
}
if (! $dryRun) {
close($out)
|| die "cannot close output file '$file.new'";