mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
a41ad2e902
|
@ -49,6 +49,7 @@
|
|||
#include "VocBase/general-cursor.h"
|
||||
#include "VocBase/document-collection.h"
|
||||
#include "VocBase/voc-shaper.h"
|
||||
#include "Basics/Utf8Helper.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace triagens::basics;
|
||||
|
@ -1616,13 +1617,34 @@ static void* UnwrapGeneralCursor (v8::Handle<v8::Object> cursorObject) {
|
|||
static v8::Handle<v8::Value> JS_normalize_string (v8::Arguments const& argv) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TRI_Utf8ValueNFC x(TRI_UNKNOWN_MEM_ZONE, argv[0]);
|
||||
|
||||
if (x.length() == 0) {
|
||||
return scope.Close(v8::Null());
|
||||
if (argv.Length() != 1) {
|
||||
return scope.Close(v8::ThrowException(
|
||||
TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION,
|
||||
"usage: NORMALIZE_STRING(<string>)")));
|
||||
}
|
||||
|
||||
return scope.Close(Utf8Helper::DefaultUtf8Helper.normalize(argv[0]));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief compare two UTF 16 strings
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static v8::Handle<v8::Value> JS_compare_string (v8::Arguments const& argv) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
if (argv.Length() != 2) {
|
||||
return scope.Close(v8::ThrowException(
|
||||
TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION,
|
||||
"usage: COMPARE_STRING(<left string>, <right string>)")));
|
||||
}
|
||||
|
||||
v8::String::Value left(argv[0]);
|
||||
v8::String::Value right(argv[1]);
|
||||
|
||||
return scope.Close(v8::String::New(*x, x.length()));
|
||||
int result = Utf8Helper::DefaultUtf8Helper.compareUtf16(*left, left.length(), *right, right.length());
|
||||
|
||||
return scope.Close(v8::Integer::New(result));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -5664,6 +5686,10 @@ TRI_v8_global_t* TRI_InitV8VocBridge (v8::Handle<v8::Context> context, TRI_vocba
|
|||
v8::FunctionTemplate::New(JS_normalize_string)->GetFunction(),
|
||||
v8::ReadOnly);
|
||||
|
||||
context->Global()->Set(v8::String::New("COMPARE_STRING"),
|
||||
v8::FunctionTemplate::New(JS_compare_string)->GetFunction(),
|
||||
v8::ReadOnly);
|
||||
|
||||
// .............................................................................
|
||||
// create the global variables
|
||||
// .............................................................................
|
||||
|
|
|
@ -1922,6 +1922,11 @@ void TRI_InitialiseVocBase () {
|
|||
#ifdef TRI_V8_VERSION
|
||||
LOG_TRACE("%s", "$Revision: V8 " TRI_V8_VERSION " $");
|
||||
#endif
|
||||
|
||||
#ifdef TRI_ICU_VERSION
|
||||
LOG_TRACE("%s", "$Revision: ICU " TRI_ICU_VERSION " $");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -356,43 +356,33 @@ static v8::Handle<v8::Value> JS_normalize_string (v8::Arguments const& argv) {
|
|||
v8::HandleScope scope;
|
||||
|
||||
if (argv.Length() != 1) {
|
||||
return scope.Close(v8::ThrowException(v8::String::New("usage: NORMALIZE_STRING(<string>)")));
|
||||
return scope.Close(v8::ThrowException(
|
||||
TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION,
|
||||
"usage: NORMALIZE_STRING(<string>)")));
|
||||
}
|
||||
|
||||
TRI_Utf8ValueNFC x(TRI_UNKNOWN_MEM_ZONE, argv[0]);
|
||||
|
||||
if (x.length() == 0) {
|
||||
return scope.Close(v8::Null());
|
||||
}
|
||||
|
||||
return scope.Close(v8::String::New(*x, x.length()));
|
||||
return scope.Close(Utf8Helper::DefaultUtf8Helper.normalize(argv[0]));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief compare two UTF 16 strings
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static v8::Handle<v8::Value> JS_compare_strings (v8::Arguments const& argv) {
|
||||
static v8::Handle<v8::Value> JS_compare_string (v8::Arguments const& argv) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
if (argv.Length() != 2) {
|
||||
return scope.Close(v8::ThrowException(v8::String::New("usage: COMPARE_STRINGS(<left string>, <right string>)")));
|
||||
return scope.Close(v8::ThrowException(
|
||||
TRI_CreateErrorObject(TRI_ERROR_ILLEGAL_OPTION,
|
||||
"usage: COMPARE_STRING(<left string>, <right string>)")));
|
||||
}
|
||||
|
||||
v8::String::Value left(argv[0]);
|
||||
if (!*left) {
|
||||
return scope.Close(v8::Integer::New(1));
|
||||
}
|
||||
|
||||
v8::String::Value right(argv[1]);
|
||||
if (!*right) {
|
||||
return scope.Close(v8::Integer::New(-1));
|
||||
}
|
||||
|
||||
Utf8Helper uh("");
|
||||
int result = uh.compareUtf16(*left, left.length(), *right, right.length());
|
||||
int result = Utf8Helper::DefaultUtf8Helper.compareUtf16(*left, left.length(), *right, right.length());
|
||||
|
||||
return scope.Close(v8::Integer::New(result));
|
||||
return scope.Close(v8::Integer::New(result));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -1155,8 +1145,8 @@ int main (int argc, char* argv[]) {
|
|||
context->Global()->Set(v8::String::New("NORMALIZE_STRING"),
|
||||
v8::FunctionTemplate::New(JS_normalize_string)->GetFunction(),
|
||||
v8::ReadOnly);
|
||||
context->Global()->Set(v8::String::New("COMPARE_STRINGS"),
|
||||
v8::FunctionTemplate::New(JS_compare_strings)->GetFunction(),
|
||||
context->Global()->Set(v8::String::New("COMPARE_STRING"),
|
||||
v8::FunctionTemplate::New(JS_compare_string)->GetFunction(),
|
||||
v8::ReadOnly);
|
||||
|
||||
// .............................................................................
|
||||
|
@ -1193,9 +1183,13 @@ int main (int argc, char* argv[]) {
|
|||
#endif
|
||||
|
||||
#ifdef TRI_READLINE_VERSION
|
||||
cout << "Using READLINE " << TRI_READLINE_VERSION << endl;
|
||||
cout << "Using READLINE " << TRI_READLINE_VERSION << "." << endl;
|
||||
#endif
|
||||
|
||||
#ifdef TRI_ICU_VERSION
|
||||
cout << "Using ICU " << TRI_ICU_VERSION << " - International Components for Unicode." << endl;
|
||||
#endif
|
||||
|
||||
cout << endl;
|
||||
|
||||
BaseClient.printWelcomeInfo();
|
||||
|
|
|
@ -671,6 +671,10 @@ function AHUACATL_RELATIONAL_EQUAL (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs) == 0;
|
||||
}
|
||||
|
||||
return (lhs === rhs);
|
||||
}
|
||||
|
||||
|
@ -713,6 +717,10 @@ function AHUACATL_RELATIONAL_UNEQUAL (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs) != 0;
|
||||
}
|
||||
|
||||
return (lhs !== rhs);
|
||||
}
|
||||
|
||||
|
@ -756,6 +764,10 @@ function AHUACATL_RELATIONAL_GREATER_REC (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs) > 0;
|
||||
}
|
||||
|
||||
if (lhs === rhs) {
|
||||
return null;
|
||||
}
|
||||
|
@ -819,6 +831,10 @@ function AHUACATL_RELATIONAL_GREATEREQUAL_REC (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs) >= 0;
|
||||
}
|
||||
|
||||
if (lhs === rhs) {
|
||||
return null;
|
||||
}
|
||||
|
@ -882,6 +898,10 @@ function AHUACATL_RELATIONAL_LESS_REC (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs) < 0;
|
||||
}
|
||||
|
||||
if (lhs === rhs) {
|
||||
return null;
|
||||
}
|
||||
|
@ -945,6 +965,10 @@ function AHUACATL_RELATIONAL_LESSEQUAL_REC (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs) <= 0;
|
||||
}
|
||||
|
||||
if (lhs === rhs) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1011,6 +1035,10 @@ function AHUACATL_RELATIONAL_CMP (lhs, rhs) {
|
|||
rhs = null;
|
||||
}
|
||||
|
||||
if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {
|
||||
return COMPARE_STRING(lhs, rhs);
|
||||
}
|
||||
|
||||
if (lhs < rhs) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -672,6 +672,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs) == 0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" return (lhs === rhs);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
@ -714,6 +718,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs) != 0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" return (lhs !== rhs);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
|
@ -757,6 +765,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs) > 0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (lhs === rhs) {\n"
|
||||
" return null;\n"
|
||||
" }\n"
|
||||
|
@ -820,6 +832,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs) >= 0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (lhs === rhs) {\n"
|
||||
" return null;\n"
|
||||
" }\n"
|
||||
|
@ -883,6 +899,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs) < 0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (lhs === rhs) {\n"
|
||||
" return null;\n"
|
||||
" }\n"
|
||||
|
@ -946,6 +966,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs) <= 0;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" if (lhs === rhs) {\n"
|
||||
" return null;\n"
|
||||
" }\n"
|
||||
|
@ -1012,6 +1036,10 @@ static string JS_server_ahuacatl =
|
|||
" rhs = null;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (leftWeight === AHUACATL_TYPEWEIGHT_STRING) {\n"
|
||||
" return COMPARE_STRING(lhs, rhs);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" if (lhs < rhs) {\n"
|
||||
" return -1;\n"
|
||||
" }\n"
|
||||
|
|
|
@ -34,9 +34,14 @@
|
|||
#include "string.h"
|
||||
#endif
|
||||
|
||||
#include "Logger/Logger.h"
|
||||
|
||||
using namespace triagens::basics;
|
||||
using namespace std;
|
||||
|
||||
|
||||
Utf8Helper Utf8Helper::DefaultUtf8Helper;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -46,32 +51,12 @@ using namespace std;
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Utf8Helper::Utf8Helper (const string& lang) : _coll(0) {
|
||||
#ifdef TRI_HAVE_ICU
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
if (lang == "") {
|
||||
_coll = Collator::createInstance(status);
|
||||
}
|
||||
else {
|
||||
Locale locale(lang.c_str());
|
||||
_coll = Collator::createInstance(locale, status);
|
||||
}
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
cerr << "error in Collator::createInstance(): " << u_errorName(status) << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// set the default attributes for sorting:
|
||||
_coll->setAttribute(UCOL_CASE_FIRST, UCOL_UPPER_FIRST, status); // A < a
|
||||
_coll->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
|
||||
_coll->setAttribute(UCOL_STRENGTH, UCOL_IDENTICAL, status); // UCOL_IDENTICAL, UCOL_PRIMARY, UCOL_SECONDARY, UCOL_TERTIARY
|
||||
Utf8Helper::Utf8Helper () : _coll(0) {
|
||||
setCollatorLanguage("");
|
||||
}
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
cerr << "error in Collator::setAttribute(...): " << u_errorName(status) << endl;
|
||||
}
|
||||
#endif
|
||||
Utf8Helper::Utf8Helper (const string& lang) : _coll(0) {
|
||||
setCollatorLanguage(lang);
|
||||
}
|
||||
|
||||
Utf8Helper::~Utf8Helper () {
|
||||
|
@ -83,14 +68,14 @@ Utf8Helper::~Utf8Helper () {
|
|||
int Utf8Helper::compareUtf8 (const char* left, size_t leftLength, const char* right, size_t rightLength) {
|
||||
#ifdef TRI_HAVE_ICU
|
||||
if (!_coll) {
|
||||
cerr << "no Collator!" << endl;
|
||||
LOGGER_ERROR << "no Collator in Utf8Helper::compareUtf8()!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
int result = _coll->compareUTF8(StringPiece(left, leftLength), StringPiece(right, rightLength), status);
|
||||
if(U_FAILURE(status)) {
|
||||
cerr << "error in Collator::compareUTF8(...): " << u_errorName(status) << endl;
|
||||
LOGGER_ERROR << "error in Collator::compareUTF8(...): " << u_errorName(status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -127,7 +112,7 @@ int Utf8Helper::compareUtf8 (const char* left, size_t leftLength, const char* ri
|
|||
int Utf8Helper::compareUtf16 (const uint16_t* left, size_t leftLength, const uint16_t* right, size_t rightLength) {
|
||||
#ifdef TRI_HAVE_ICU
|
||||
if (!_coll) {
|
||||
cerr << "no Collator!" << endl;
|
||||
LOGGER_ERROR << "no Collator in Utf8Helper::compareUtf16()!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -163,17 +148,74 @@ int Utf8Helper::compareUtf16 (const uint16_t* left, size_t leftLength, const uin
|
|||
#endif
|
||||
}
|
||||
|
||||
v8::Handle<v8::Value> Utf8Helper::normalize (v8::Handle<v8::Value> obj) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::String::Value str(obj);
|
||||
size_t str_len = str.length();
|
||||
if (str_len > 0) {
|
||||
#ifdef TRI_HAVE_ICU
|
||||
UErrorCode erroCode = U_ZERO_ERROR;
|
||||
const Normalizer2* normalizer = Normalizer2::getNFCInstance(erroCode);
|
||||
|
||||
if (U_FAILURE(erroCode)) {
|
||||
LOGGER_ERROR << "error in Normalizer2::getNFCInstance(erroCode): " << u_errorName(erroCode);
|
||||
return scope.Close(v8::Null());
|
||||
}
|
||||
|
||||
UnicodeString result = normalizer->normalize(UnicodeString(*str, str_len), erroCode);
|
||||
|
||||
char * normalizeUtf8 (TRI_memory_zone_t* zone, const char* utf8, size_t inLength, size_t* outLength) {
|
||||
return TR_normalize_utf8_to_NFC(zone, utf8, inLength, outLength);
|
||||
}
|
||||
|
||||
char * normalizeUtf16 (TRI_memory_zone_t* zone, const uint16_t* utf16, size_t inLength, size_t* outLength) {
|
||||
return TR_normalize_utf16_to_NFC(zone, utf16, inLength, outLength);
|
||||
}
|
||||
|
||||
if (U_FAILURE(erroCode)) {
|
||||
LOGGER_ERROR << "error in normalizer->normalize(UnicodeString(*str, str_len), erroCode): " << u_errorName(erroCode);
|
||||
return scope.Close(v8::Null());
|
||||
}
|
||||
|
||||
return scope.Close(v8::String::New(result.getBuffer(), result.length()));
|
||||
#else
|
||||
return scope.Close(v8::String::New(*str, str_len));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
return scope.Close(v8::String::New(""));
|
||||
}
|
||||
}
|
||||
|
||||
void Utf8Helper::setCollatorLanguage (const string& lang) {
|
||||
#ifdef TRI_HAVE_ICU
|
||||
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Collator* coll;
|
||||
if (lang == "") {
|
||||
coll = Collator::createInstance(status);
|
||||
}
|
||||
else {
|
||||
Locale locale(lang.c_str());
|
||||
coll = Collator::createInstance(locale, status);
|
||||
}
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
LOGGER_ERROR << "error in Collator::createInstance(): " << u_errorName(status);
|
||||
return;
|
||||
}
|
||||
|
||||
// set the default attributes for sorting:
|
||||
coll->setAttribute(UCOL_CASE_FIRST, UCOL_UPPER_FIRST, status); // A < a
|
||||
coll->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
|
||||
coll->setAttribute(UCOL_STRENGTH, UCOL_IDENTICAL, status); // UCOL_IDENTICAL, UCOL_PRIMARY, UCOL_SECONDARY, UCOL_TERTIARY
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
LOGGER_ERROR << "error in Collator::setAttribute(...): " << u_errorName(status);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_coll) {
|
||||
delete _coll;
|
||||
}
|
||||
|
||||
_coll = coll;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define TRIAGENS_BASICS_UTF8_HELPER_H 1
|
||||
|
||||
#include "Basics/Common.h"
|
||||
#include "v8.h"
|
||||
|
||||
#ifdef TRI_HAVE_ICU
|
||||
#include "unicode/coll.h"
|
||||
|
@ -51,29 +52,20 @@ namespace triagens {
|
|||
Utf8Helper& operator= (Utf8Helper const&);
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// static functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef TRI_HAVE_ICU
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief normalize an utf8 string (NFC)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static char * normalizeUtf8 (TRI_memory_zone_t* zone, const char* utf8, size_t inLength, size_t* outLength);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief normalize an utf16 string (NFC) and export it to utf8
|
||||
/// @brief a default helper
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static char * normalizeUtf16 (TRI_memory_zone_t* zone, const uint16_t* utf16, size_t inLength, size_t* outLength);
|
||||
|
||||
#endif
|
||||
static Utf8Helper DefaultUtf8Helper;
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Utf8Helper();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
/// @param string lang Use "de_DE", "en_US" or "" (default)
|
||||
|
@ -81,7 +73,7 @@ namespace triagens {
|
|||
|
||||
Utf8Helper(const string& lang);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief destructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -111,7 +103,19 @@ namespace triagens {
|
|||
|
||||
int compareUtf16 (const uint16_t* left, size_t leftLength, const uint16_t* right, size_t rightLength);
|
||||
|
||||
private:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief normalize a v8 object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
v8::Handle<v8::Value> normalize (v8::Handle<v8::Value> obj);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set collator by language
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setCollatorLanguage (const string& lang);
|
||||
|
||||
private:
|
||||
#ifdef TRI_HAVE_ICU
|
||||
Collator* _coll;
|
||||
#else
|
||||
|
|
|
@ -1610,7 +1610,7 @@ TRI_Utf8ValueNFC::TRI_Utf8ValueNFC(TRI_memory_zone_t* memoryZone, v8::Handle<v8:
|
|||
|
||||
v8::String::Value str(obj);
|
||||
size_t str_len = str.length();
|
||||
|
||||
|
||||
if (str_len > 0) {
|
||||
_str = TR_normalize_utf16_to_NFC(_memoryZone, *str, str_len, &_length);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ dnl -*- mode: Autoconf; -*-
|
|||
dnl ----------------------------------------------------------------------------
|
||||
dnl --SECTION-- V8
|
||||
dnl ----------------------------------------------------------------------------
|
||||
# -ffunction-sections -fdata-sections -D_REENTRANT
|
||||
ICU_CPPFLAGS="-I${srcdir}/3rdParty/icu/BUILD/include"
|
||||
# -ffunction-sections -fdata-sections
|
||||
ICU_CPPFLAGS="-D_REENTRANT -I${srcdir}/3rdParty/icu/BUILD/include"
|
||||
ICU_LDFLAGS=""
|
||||
ICU_LIBS=" -lpthread -ldl -lm ${srcdir}/3rdParty/icu/BUILD/libs/libicui18n.a ${srcdir}/3rdParty/icu/BUILD/libs/libicuuc.a ${srcdir}/3rdParty/icu/BUILD/libs/libicudata.a ${srcdir}/3rdParty/icu/BUILD/libs/libicuio.a ${srcdir}/3rdParty/icu/BUILD/libs/libicule.a ${srcdir}/3rdParty/icu/BUILD/libs/libiculx.a"
|
||||
|
||||
|
|
|
@ -30,15 +30,31 @@ AC_ARG_WITH(ICU-lib,
|
|||
|
||||
TR_STATIC_ENABLE([ICU])
|
||||
|
||||
|
||||
################################################################################
|
||||
### @brief TODO: create m4/external.icu
|
||||
################################################################################
|
||||
|
||||
if test "x$tr_ICU" = xyes; then
|
||||
ICU_CPPFLAGS="$ICU_CPPFLAGS -DTRI_HAVE_ICU=1"
|
||||
ICU_LDFLAGS="$ICU_LDFLAGS"
|
||||
ICU_LIBS="-licui18n -licuuc -licudata -licuio -licule -liculx"
|
||||
|
||||
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
|
||||
AC_MSG_NOTICE([CHECKING FOR ICU])
|
||||
AC_MSG_NOTICE([--------------------------------------------------------------------------------])
|
||||
|
||||
dnl ----------------------------------------------------------------------------
|
||||
dnl checks for the icu-config
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
||||
ICU_CONFIG="icu-config"
|
||||
|
||||
if $ICU_CONFIG --version > /dev/null 2>&1; then
|
||||
ICU_CPPFLAGS="$($ICU_CONFIG --cppflags)"
|
||||
ICU_LDFLAGS="$($ICU_CONFIG --ldflags)"
|
||||
ICU_LIBS=""
|
||||
TRI_ICU_VERSION="$($ICU_CONFIG --version)"
|
||||
else
|
||||
ICU_CPPFLAGS="$ICU_CPPFLAGS"
|
||||
ICU_LDFLAGS="$ICU_LDFLAGS"
|
||||
ICU_LIBS="-licui18n -licuuc -licudata -licuio -licule -liculx"
|
||||
TRI_ICU_VERSION="unknown"
|
||||
fi
|
||||
|
||||
ICU_CPPFLAGS="${ICU_CPPFLAGS} -DTRI_ICU_VERSION='\"${TRI_ICU_VERSION}\"' -DTRI_HAVE_ICU=1"
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------------------
|
||||
|
@ -58,7 +74,7 @@ if test "x$tr_ICU" = xyes; then
|
|||
LIB_INFO="$LIB_INFO|ICU VERSION: ${TRI_ICU_VERSION}"
|
||||
|
||||
LIB_INFO="$LIB_INFO|ICU_CPPFLAGS: ${ICU_CPPFLAGS}"
|
||||
LIB_INFO="$LIB_INFO|ICU_LDLIBS: ${ICU_LDLIBS}"
|
||||
LIB_INFO="$LIB_INFO|ICU_LDFLAGS: ${ICU_LDFLAGS}"
|
||||
LIB_INFO="$LIB_INFO|ICU_LIBS: ${ICU_LIBS}"
|
||||
else
|
||||
LIB_INFO="$LIB_INFO|ICU: disabled"
|
||||
|
|
Loading…
Reference in New Issue