diff --git a/.gitignore b/.gitignore index 07a87a05c6..be21014a21 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ build.h build.info commit.sh config/config.h +config/config.guess +config/config.sub config.h config.log config/revision.sh diff --git a/3rdParty/mruby/Makefile b/3rdParty/mruby/Makefile index 55988683b6..bd4464f565 100644 --- a/3rdParty/mruby/Makefile +++ b/3rdParty/mruby/Makefile @@ -49,11 +49,11 @@ IOSDEVCC := xcrun -sdk iphoneos llvm-gcc-4.2 -arch armv7 -isysroot "/Developer/P CC = gcc LL = gcc YACC = bison -DEBUG_MODE = 1 +DEBUG_MODE = 0 ifeq ($(DEBUG_MODE),1) CFLAGS = -g else -CFLAGS = -O3 +CFLAGS = -O2 -g endif ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL) diff --git a/3rdParty/mruby/mrblib/Makefile b/3rdParty/mruby/mrblib/Makefile index ef60654fdc..b03b6639ec 100644 --- a/3rdParty/mruby/mrblib/Makefile +++ b/3rdParty/mruby/mrblib/Makefile @@ -16,11 +16,11 @@ MRBS := $(MRB1) # C compiler (gcc) CC = gcc LL = gcc -DEBUG_MODE = 1 +DEBUG_MODE = 0 ifeq ($(DEBUG_MODE),1) CFLAGS = -g else -CFLAGS = -O3 +CFLAGS = -O2 endif INCLUDES = -I../src -I../include ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) diff --git a/3rdParty/mruby/src/Makefile b/3rdParty/mruby/src/Makefile index fb5483a72b..a4d6a6ecc3 100644 --- a/3rdParty/mruby/src/Makefile +++ b/3rdParty/mruby/src/Makefile @@ -38,11 +38,11 @@ LL = gcc AR = ar YACC = bison -DEBUG_MODE = 1 +DEBUG_MODE = 0 ifeq ($(DEBUG_MODE),1) -CFLAGS = -g -O3 +CFLAGS = -g else -CFLAGS = -O3 +CFLAGS = -O2 -g endif ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL) diff --git a/3rdParty/mruby/tools/mrbc/Makefile b/3rdParty/mruby/tools/mrbc/Makefile index 7271a2fed6..5bcc9ee5d3 100644 --- a/3rdParty/mruby/tools/mrbc/Makefile +++ b/3rdParty/mruby/tools/mrbc/Makefile @@ -30,11 +30,11 @@ INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include CC = gcc LL = gcc YACC = bison -DEBUG_MODE = 1 +DEBUG_MODE = 0 ifeq ($(DEBUG_MODE),1) CFLAGS = -g else -CFLAGS = -O3 +CFLAGS = -O2 -g endif ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL) diff --git a/3rdParty/mruby/tools/mruby/Makefile b/3rdParty/mruby/tools/mruby/Makefile index 62d7cdd3f3..88761f8301 100644 --- a/3rdParty/mruby/tools/mruby/Makefile +++ b/3rdParty/mruby/tools/mruby/Makefile @@ -38,11 +38,11 @@ INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include CC = gcc LL = gcc YACC = bison -DEBUG_MODE = 1 +DEBUG_MODE = 0 ifeq ($(DEBUG_MODE),1) CFLAGS = -g else -CFLAGS = -O3 +CFLAGS = -O2 -g endif ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS) MAKE_FLAGS = --no-print-directory CC=$(CC) LL=$(LL) diff --git a/MRClient/avocirb.cpp b/MRClient/avocirb.cpp index 988f2e0053..80022ba061 100644 --- a/MRClient/avocirb.cpp +++ b/MRClient/avocirb.cpp @@ -43,6 +43,7 @@ #include "BasicsC/strings.h" #include "Logger/Logger.h" #include "MRuby/MRLineEditor.h" +#include "MRuby/mr-utils.h" #include "SimpleHttpClient/SimpleHttpClient.h" #include "SimpleHttpClient/SimpleHttpResult.h" @@ -50,8 +51,8 @@ extern "C" { #include "mruby.h" #include "mruby/proc.h" #include "mruby/data.h" +#include "mruby/variable.h" #include "compile.h" -#include "variable.h" } using namespace std; @@ -452,6 +453,8 @@ int main (int argc, char* argv[]) { // create a new ruby shell mrb_state* mrb = mrb_open(); + TRI_InitMRUtils(mrb); + RunShell(mrb); // calling dispose in V8 3.10.x causes a segfault. the v8 docs says its not necessary to call it upon program termination diff --git a/MRuby/mr-utils.c b/MRuby/mr-utils.c new file mode 100644 index 0000000000..6240cb31f7 --- /dev/null +++ b/MRuby/mr-utils.c @@ -0,0 +1,85 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief mruby utilities +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2004-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +#include "mr-utils.h" + +#include "mruby.h" +#include "mruby/data.h" +#include "mruby/proc.h" +#include "mruby/variable.h" + +// ----------------------------------------------------------------------------- +// --SECTION-- private functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup AvocadoDB +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief returns the time in seconds +//////////////////////////////////////////////////////////////////////////////// + +static mrb_value MR_Time (mrb_state* mrb, mrb_value self) { + return mrb_float_value(TRI_microtime()); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- private functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup AvocadoDB +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief init utilities +//////////////////////////////////////////////////////////////////////////////// + +void TRI_InitMRUtils (mrb_state* mrb) { + struct RClass *krn; + + krn = mrb->kernel_module; + + // timing function + mrb_define_method(mrb, krn, "time", MR_Time, ARGS_NONE()); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)" +// End: diff --git a/MRuby/mr-utils.h b/MRuby/mr-utils.h new file mode 100644 index 0000000000..dad3032358 --- /dev/null +++ b/MRuby/mr-utils.h @@ -0,0 +1,84 @@ +//////////////////////////////////////////////////////////////////////////////// +/// @brief mruby utilities +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2004-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Dr. Frank Celler +/// @author Copyright 2011-2012, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +#ifndef TRIAGENS_MRUBY_MR_UTILS_H +#define TRIAGENS_MRUBY_MR_UTILS_H 1 + +#include "BasicsC/common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// ----------------------------------------------------------------------------- +// --SECTION-- forward declarations +// ----------------------------------------------------------------------------- + +struct mrb_state; + +// ----------------------------------------------------------------------------- +// --SECTION-- private variables +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup AvocadoDB +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- private functions +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup AvocadoDB +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +/// @brief init utilities +//////////////////////////////////////////////////////////////////////////////// + +void TRI_InitMRUtils (struct mrb_state* mrb); + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +} +#endif + +#endif + +// Local Variables: +// mode: outline-minor +// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)" +// End: diff --git a/Makefile.am b/Makefile.am index 8a960fdb6a..6bac3746c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,11 +12,6 @@ AM_CPPFLAGS = \ @READLINE_CPPFLAGS@ \ @V8_CPPFLAGS@ -if ENABLE_MRUBY -AM_CPPFLAGS += \ - @MRUBY_CPPFLAGS@ -endif - AM_LDFLAGS = \ @BOOST_LDFLAGS@ \ @LIBEV_LDFLAGS@ \ @@ -26,11 +21,6 @@ AM_LDFLAGS = \ @READLINE_LDFLAGS@ \ @V8_LDFLAGS@ -if ENABLE_MRUBY -AM_CPPFLAGS += \ - @MRUBY_LDFLAGS@ -endif - LIBS = \ @BOOST_LIBS@ \ @LIBEV_LIBS@ \ @@ -40,17 +30,19 @@ LIBS = \ @READLINE_LIBS@ \ @V8_LIBS@ -if ENABLE_MRUBY -LIBS += \ - @MRUBY_LIBS@ -endif - BUILT_SOURCES = build.h CLEANUP = noinst_LIBRARIES = libavocado.a sbin_PROGRAMS = avocado -bin_PROGRAMS = avocsh avocirb avocimp +bin_PROGRAMS = avocsh avocimp + +if ENABLE_MRUBY +AM_CPPFLAGS += @MRUBY_CPPFLAGS@ +AM_CPPFLAGS += @MRUBY_LDFLAGS@ +LIBS += @MRUBY_LIBS@ +bin_PROGRAMS += avocirb +endif nobase_pkgdata_DATA = \ $(shell find @srcdir@/js/actions/system -name "*.js" -print) \ diff --git a/Makefile.files b/Makefile.files index 1623696589..f5e7d75f05 100644 --- a/Makefile.files +++ b/Makefile.files @@ -58,7 +58,6 @@ libavocado_a_SOURCES = \ Logger/LoggerInfo.cpp \ Logger/LoggerStream.cpp \ Logger/LoggerTiming.cpp \ - MRuby/MRLineEditor.cpp \ ProgramOptions/program-options.c \ Rest/AddressPort.cpp \ Rest/AnyServer.cpp \ @@ -106,6 +105,12 @@ libavocado_a_SOURCES = \ Variant/VariantUInt8.cpp \ Variant/VariantVector.cpp +if ENABLE_MRUBY +libavocado_a_SOURCES += \ + MRuby/MRLineEditor.cpp \ + MRuby/mr-utils.cpp +endif + ################################################################################ ## avocado server ################################################################################ @@ -240,11 +245,15 @@ avocsh_SOURCES = \ ## avocado ruby shell ################################################################################ +if ENABLE_MRUBY + avocirb_LDADD = libavocado.a $(LIBS) avocirb_SOURCES = \ MRClient/avocirb.cpp +endif + ################################################################################ ## avocado importer ################################################################################ diff --git a/Makefile.in b/Makefile.in index 6cf8f9ab57..9ed744b203 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,12 +79,11 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@ENABLE_MRUBY_TRUE@am__append_1 = @MRUBY_CPPFLAGS@ @MRUBY_LDFLAGS@ -@ENABLE_MRUBY_TRUE@am__append_2 = \ -@ENABLE_MRUBY_TRUE@ @MRUBY_LIBS@ - sbin_PROGRAMS = avocado$(EXEEXT) -bin_PROGRAMS = avocsh$(EXEEXT) avocirb$(EXEEXT) avocimp$(EXEEXT) +bin_PROGRAMS = avocsh$(EXEEXT) avocimp$(EXEEXT) $(am__EXEEXT_1) +@ENABLE_MRUBY_TRUE@am__append_1 = @MRUBY_CPPFLAGS@ @MRUBY_LDFLAGS@ +@ENABLE_MRUBY_TRUE@am__append_2 = @MRUBY_LIBS@ +@ENABLE_MRUBY_TRUE@am__append_3 = avocirb DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.bison $(srcdir)/Makefile.doxygen \ $(srcdir)/Makefile.files $(srcdir)/Makefile.flex \ @@ -98,22 +97,26 @@ DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(top_srcdir)/config/config.h.in $(top_srcdir)/configure \ config/compile config/config.guess config/config.sub \ config/depcomp config/install-sh config/missing +@ENABLE_MRUBY_TRUE@am__append_4 = \ +@ENABLE_MRUBY_TRUE@ MRuby/MRLineEditor.cpp \ +@ENABLE_MRUBY_TRUE@ MRuby/mr-utils.cpp + @ENABLE_BOOST_TEST_TRUE@noinst_PROGRAMS = \ @ENABLE_BOOST_TEST_TRUE@ UnitTests/test_suite$(EXEEXT) @ENABLE_BOOST_TEST_FALSE@UnitTests_test_suite_DEPENDENCIES = ################################################################################ ################################################################################ -@ENABLE_FLEX_TRUE@am__append_3 = $(FLEX_FILES) $(FLEXXX_FILES) +@ENABLE_FLEX_TRUE@am__append_5 = $(FLEX_FILES) $(FLEXXX_FILES) ################################################################################ ################################################################################ -@ENABLE_BISON_TRUE@am__append_4 = $(BISON_FILES) $(BISONXX_FILES) -@ENABLE_ERRORS_DEPENDENCY_TRUE@am__append_5 = \ +@ENABLE_BISON_TRUE@am__append_6 = $(BISON_FILES) $(BISONXX_FILES) +@ENABLE_ERRORS_DEPENDENCY_TRUE@am__append_7 = \ @ENABLE_ERRORS_DEPENDENCY_TRUE@ errorfiles -@ENABLE_ALL_IN_ONE_TRUE@am__append_6 = @LIBEV_LIBS@ @V8_LIBS@ -@ENABLE_MRUBY_TRUE@am__append_7 = @MRUBY_LIBS@ +@ENABLE_ALL_IN_ONE_TRUE@am__append_8 = @LIBEV_LIBS@ @V8_LIBS@ +@ENABLE_MRUBY_TRUE@am__append_9 = @MRUBY_LIBS@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ @@ -160,7 +163,54 @@ am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ libavocado_a_AR = $(AR) $(ARFLAGS) libavocado_a_LIBADD = +am__libavocado_a_SOURCES_DIST = Basics/ConditionLocker.cpp \ + Basics/ConditionVariable.cpp Basics/FileUtils.cpp \ + Basics/Initialise.cpp Basics/LibraryLoader.cpp \ + Basics/Mutex.cpp Basics/MutexLocker.cpp \ + Basics/ProgramOptions.cpp Basics/ProgramOptionsDescription.cpp \ + Basics/Random.cpp Basics/ReadLocker.cpp \ + Basics/ReadUnlocker.cpp Basics/ReadWriteLock.cpp \ + Basics/StringUtils.cpp Basics/Thread.cpp Basics/Timing.cpp \ + Basics/WriteLocker.cpp Basics/WriteUnlocker.cpp \ + BasicsC/associative-multi.c BasicsC/associative.c \ + BasicsC/conversions.c BasicsC/csv.c BasicsC/error.c \ + BasicsC/files.c BasicsC/hashes.c BasicsC/init.c BasicsC/json.c \ + BasicsC/locks-macos.c BasicsC/locks-posix.c BasicsC/logging.c \ + BasicsC/memory.c BasicsC/process-utils.c BasicsC/random.c \ + BasicsC/socket-utils.c BasicsC/string-buffer.c \ + BasicsC/strings.c BasicsC/structures.c \ + BasicsC/system-functions.c BasicsC/terminal-utils-ncurses.c \ + BasicsC/terminal-utils.c BasicsC/threads-posix.c \ + BasicsC/vector.c BasicsC/voc-errors.c JsonParser/json-parser.c \ + JsonParserX/InputParser.cpp JsonParserX/JsonParserX.cpp \ + JsonParserX/JsonParserXDriver.cpp JsonParserX/JsonScannerX.cpp \ + Logger/Logger.cpp Logger/LoggerData.cpp Logger/LoggerInfo.cpp \ + Logger/LoggerStream.cpp Logger/LoggerTiming.cpp \ + ProgramOptions/program-options.c Rest/AddressPort.cpp \ + Rest/AnyServer.cpp Rest/HttpRequest.cpp Rest/HttpResponse.cpp \ + Rest/Initialise.cpp Rest/JsonContainer.cpp \ + Rest/SslInterface.cpp Rest/Url.cpp ShapedJson/json-shaper.c \ + ShapedJson/shape-accessor.c ShapedJson/shaped-json.c \ + UserManager/ApplicationUserManager.cpp UserManager/Role.cpp \ + UserManager/Session.cpp UserManager/SessionHandler.cpp \ + UserManager/User.cpp UserManager/UserHandler.cpp \ + UserManager/UsersHandler.cpp Utilities/LineEditor.cpp \ + V8/JSLoader.cpp V8/v8-conv.cpp V8/v8-json.cpp \ + V8/V8LineEditor.cpp V8/v8-shell.cpp V8/v8-utils.cpp \ + Variant/VariantArray.cpp Variant/VariantBlob.cpp \ + Variant/VariantBoolean.cpp Variant/VariantDate.cpp \ + Variant/VariantDatetime.cpp Variant/VariantDouble.cpp \ + Variant/VariantFloat.cpp Variant/VariantInt16.cpp \ + Variant/VariantInt32.cpp Variant/VariantInt64.cpp \ + Variant/VariantInt8.cpp Variant/VariantMatrix2.cpp \ + Variant/VariantNull.cpp Variant/VariantObject.cpp \ + Variant/VariantString.cpp Variant/VariantUInt16.cpp \ + Variant/VariantUInt32.cpp Variant/VariantUInt64.cpp \ + Variant/VariantUInt8.cpp Variant/VariantVector.cpp \ + MRuby/MRLineEditor.cpp MRuby/mr-utils.cpp am__dirstamp = $(am__leading_dot)dirstamp +@ENABLE_MRUBY_TRUE@am__objects_1 = MRuby/MRLineEditor.$(OBJEXT) \ +@ENABLE_MRUBY_TRUE@ MRuby/mr-utils.$(OBJEXT) am_libavocado_a_OBJECTS = Basics/ConditionLocker.$(OBJEXT) \ Basics/ConditionVariable.$(OBJEXT) Basics/FileUtils.$(OBJEXT) \ Basics/Initialise.$(OBJEXT) Basics/LibraryLoader.$(OBJEXT) \ @@ -193,7 +243,6 @@ am_libavocado_a_OBJECTS = Basics/ConditionLocker.$(OBJEXT) \ JsonParserX/JsonScannerX.$(OBJEXT) Logger/Logger.$(OBJEXT) \ Logger/LoggerData.$(OBJEXT) Logger/LoggerInfo.$(OBJEXT) \ Logger/LoggerStream.$(OBJEXT) Logger/LoggerTiming.$(OBJEXT) \ - MRuby/MRLineEditor.$(OBJEXT) \ ProgramOptions/program-options.$(OBJEXT) \ Rest/AddressPort.$(OBJEXT) Rest/AnyServer.$(OBJEXT) \ Rest/HttpRequest.$(OBJEXT) Rest/HttpResponse.$(OBJEXT) \ @@ -223,8 +272,9 @@ am_libavocado_a_OBJECTS = Basics/ConditionLocker.$(OBJEXT) \ Variant/VariantUInt16.$(OBJEXT) \ Variant/VariantUInt32.$(OBJEXT) \ Variant/VariantUInt64.$(OBJEXT) Variant/VariantUInt8.$(OBJEXT) \ - Variant/VariantVector.$(OBJEXT) + Variant/VariantVector.$(OBJEXT) $(am__objects_1) libavocado_a_OBJECTS = $(am_libavocado_a_OBJECTS) +@ENABLE_MRUBY_TRUE@am__EXEEXT_1 = avocirb$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(pkgdatadir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) $(sbin_PROGRAMS) @@ -345,9 +395,11 @@ am_avocimp_OBJECTS = SimpleHttpClient/SimpleHttpClient.$(OBJEXT) \ V8Client/avocimp.$(OBJEXT) avocimp_OBJECTS = $(am_avocimp_OBJECTS) avocimp_DEPENDENCIES = libavocado.a $(am__DEPENDENCIES_2) -am_avocirb_OBJECTS = MRClient/avocirb.$(OBJEXT) +am__avocirb_SOURCES_DIST = MRClient/avocirb.cpp +@ENABLE_MRUBY_TRUE@am_avocirb_OBJECTS = MRClient/avocirb.$(OBJEXT) avocirb_OBJECTS = $(am_avocirb_OBJECTS) -avocirb_DEPENDENCIES = libavocado.a $(am__DEPENDENCIES_2) +@ENABLE_MRUBY_TRUE@avocirb_DEPENDENCIES = libavocado.a \ +@ENABLE_MRUBY_TRUE@ $(am__DEPENDENCIES_2) am_avocsh_OBJECTS = SimpleHttpClient/SimpleHttpClient.$(OBJEXT) \ SimpleHttpClient/SimpleHttpResult.$(OBJEXT) \ V8Client/ImportHelper.$(OBJEXT) \ @@ -386,9 +438,10 @@ am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libavocado_a_SOURCES) $(UnitTests_test_suite_SOURCES) \ $(avocado_SOURCES) $(avocimp_SOURCES) $(avocirb_SOURCES) \ $(avocsh_SOURCES) -DIST_SOURCES = $(libavocado_a_SOURCES) \ +DIST_SOURCES = $(am__libavocado_a_SOURCES_DIST) \ $(am__UnitTests_test_suite_SOURCES_DIST) $(avocado_SOURCES) \ - $(avocimp_SOURCES) $(avocirb_SOURCES) $(avocsh_SOURCES) + $(avocimp_SOURCES) $(am__avocirb_SOURCES_DIST) \ + $(avocsh_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -591,8 +644,8 @@ AM_LDFLAGS = \ BUILT_SOURCES = build.h $(JAVASCRIPT_HEADER) $(FLEX_FILES) \ $(FLEXXX_FILES) $(BISON_FILES) $(BISONXX_FILES) \ - Doxygen/.setup-directories .setup-directories $(am__append_5) \ - $(am__append_6) $(am__append_7) + Doxygen/.setup-directories .setup-directories $(am__append_7) \ + $(am__append_8) $(am__append_9) ################################################################################ ################################################################################ @@ -601,8 +654,8 @@ BUILT_SOURCES = build.h $(JAVASCRIPT_HEADER) $(FLEX_FILES) \ ################################################################################ CLEANUP = $(DOXYGEN) $(addsuffix .md,$(addprefix \ Doxygen/xml/,$(WIKI))) $(addsuffix .md,$(addprefix \ - Doxygen/wiki/,$(WIKI))) $(JAVASCRIPT_HEADER) $(am__append_3) \ - $(am__append_4) + Doxygen/wiki/,$(WIKI))) $(JAVASCRIPT_HEADER) $(am__append_5) \ + $(am__append_6) noinst_LIBRARIES = libavocado.a nobase_pkgdata_DATA = \ $(shell find @srcdir@/js/actions/system -name "*.js" -print) \ @@ -616,108 +669,51 @@ nobase_pkgdata_DATA = \ $(shell find @srcdir@/html -name "*.js" -print) \ $(shell find @srcdir@/html -name "*.png" -print) -libavocado_a_SOURCES = \ - Basics/ConditionLocker.cpp \ - Basics/ConditionVariable.cpp \ - Basics/FileUtils.cpp \ - Basics/Initialise.cpp \ - Basics/LibraryLoader.cpp \ - Basics/Mutex.cpp \ - Basics/MutexLocker.cpp \ - Basics/ProgramOptions.cpp \ - Basics/ProgramOptionsDescription.cpp \ - Basics/Random.cpp \ - Basics/ReadLocker.cpp \ - Basics/ReadUnlocker.cpp \ - Basics/ReadWriteLock.cpp \ - Basics/StringUtils.cpp \ - Basics/Thread.cpp \ - Basics/Timing.cpp \ - Basics/WriteLocker.cpp \ - Basics/WriteUnlocker.cpp \ - BasicsC/associative-multi.c \ - BasicsC/associative.c \ - BasicsC/conversions.c \ - BasicsC/csv.c \ - BasicsC/error.c \ - BasicsC/files.c \ - BasicsC/hashes.c \ - BasicsC/init.c \ - BasicsC/json.c \ - BasicsC/locks-macos.c \ - BasicsC/locks-posix.c \ - BasicsC/logging.c \ - BasicsC/memory.c \ - BasicsC/process-utils.c \ - BasicsC/random.c \ - BasicsC/socket-utils.c \ - BasicsC/string-buffer.c \ - BasicsC/strings.c \ - BasicsC/structures.c \ - BasicsC/system-functions.c \ - BasicsC/terminal-utils-ncurses.c \ - BasicsC/terminal-utils.c \ - BasicsC/threads-posix.c \ - BasicsC/vector.c \ - BasicsC/voc-errors.c \ - JsonParser/json-parser.c \ - JsonParserX/InputParser.cpp \ - JsonParserX/JsonParserX.cpp \ - JsonParserX/JsonParserXDriver.cpp \ - JsonParserX/JsonScannerX.cpp \ - Logger/Logger.cpp \ - Logger/LoggerData.cpp \ - Logger/LoggerInfo.cpp \ - Logger/LoggerStream.cpp \ - Logger/LoggerTiming.cpp \ - MRuby/MRLineEditor.cpp \ - ProgramOptions/program-options.c \ - Rest/AddressPort.cpp \ - Rest/AnyServer.cpp \ - Rest/HttpRequest.cpp \ - Rest/HttpResponse.cpp \ - Rest/Initialise.cpp \ - Rest/JsonContainer.cpp \ - Rest/SslInterface.cpp \ - Rest/Url.cpp \ - ShapedJson/json-shaper.c \ - ShapedJson/shape-accessor.c \ - ShapedJson/shaped-json.c \ - UserManager/ApplicationUserManager.cpp \ - UserManager/Role.cpp \ - UserManager/Session.cpp \ - UserManager/SessionHandler.cpp \ - UserManager/User.cpp \ - UserManager/UserHandler.cpp \ - UserManager/UsersHandler.cpp \ - Utilities/LineEditor.cpp \ - V8/JSLoader.cpp \ - V8/v8-conv.cpp \ - V8/v8-json.cpp \ - V8/V8LineEditor.cpp \ - V8/v8-shell.cpp \ - V8/v8-utils.cpp \ - Variant/VariantArray.cpp \ - Variant/VariantBlob.cpp \ - Variant/VariantBoolean.cpp \ - Variant/VariantDate.cpp \ - Variant/VariantDatetime.cpp \ - Variant/VariantDouble.cpp \ - Variant/VariantFloat.cpp \ - Variant/VariantInt16.cpp \ - Variant/VariantInt32.cpp \ - Variant/VariantInt64.cpp \ - Variant/VariantInt8.cpp \ - Variant/VariantMatrix2.cpp \ - Variant/VariantNull.cpp \ - Variant/VariantObject.cpp \ - Variant/VariantString.cpp \ - Variant/VariantUInt16.cpp \ - Variant/VariantUInt32.cpp \ - Variant/VariantUInt64.cpp \ - Variant/VariantUInt8.cpp \ - Variant/VariantVector.cpp - +libavocado_a_SOURCES = Basics/ConditionLocker.cpp \ + Basics/ConditionVariable.cpp Basics/FileUtils.cpp \ + Basics/Initialise.cpp Basics/LibraryLoader.cpp \ + Basics/Mutex.cpp Basics/MutexLocker.cpp \ + Basics/ProgramOptions.cpp Basics/ProgramOptionsDescription.cpp \ + Basics/Random.cpp Basics/ReadLocker.cpp \ + Basics/ReadUnlocker.cpp Basics/ReadWriteLock.cpp \ + Basics/StringUtils.cpp Basics/Thread.cpp Basics/Timing.cpp \ + Basics/WriteLocker.cpp Basics/WriteUnlocker.cpp \ + BasicsC/associative-multi.c BasicsC/associative.c \ + BasicsC/conversions.c BasicsC/csv.c BasicsC/error.c \ + BasicsC/files.c BasicsC/hashes.c BasicsC/init.c BasicsC/json.c \ + BasicsC/locks-macos.c BasicsC/locks-posix.c BasicsC/logging.c \ + BasicsC/memory.c BasicsC/process-utils.c BasicsC/random.c \ + BasicsC/socket-utils.c BasicsC/string-buffer.c \ + BasicsC/strings.c BasicsC/structures.c \ + BasicsC/system-functions.c BasicsC/terminal-utils-ncurses.c \ + BasicsC/terminal-utils.c BasicsC/threads-posix.c \ + BasicsC/vector.c BasicsC/voc-errors.c JsonParser/json-parser.c \ + JsonParserX/InputParser.cpp JsonParserX/JsonParserX.cpp \ + JsonParserX/JsonParserXDriver.cpp JsonParserX/JsonScannerX.cpp \ + Logger/Logger.cpp Logger/LoggerData.cpp Logger/LoggerInfo.cpp \ + Logger/LoggerStream.cpp Logger/LoggerTiming.cpp \ + ProgramOptions/program-options.c Rest/AddressPort.cpp \ + Rest/AnyServer.cpp Rest/HttpRequest.cpp Rest/HttpResponse.cpp \ + Rest/Initialise.cpp Rest/JsonContainer.cpp \ + Rest/SslInterface.cpp Rest/Url.cpp ShapedJson/json-shaper.c \ + ShapedJson/shape-accessor.c ShapedJson/shaped-json.c \ + UserManager/ApplicationUserManager.cpp UserManager/Role.cpp \ + UserManager/Session.cpp UserManager/SessionHandler.cpp \ + UserManager/User.cpp UserManager/UserHandler.cpp \ + UserManager/UsersHandler.cpp Utilities/LineEditor.cpp \ + V8/JSLoader.cpp V8/v8-conv.cpp V8/v8-json.cpp \ + V8/V8LineEditor.cpp V8/v8-shell.cpp V8/v8-utils.cpp \ + Variant/VariantArray.cpp Variant/VariantBlob.cpp \ + Variant/VariantBoolean.cpp Variant/VariantDate.cpp \ + Variant/VariantDatetime.cpp Variant/VariantDouble.cpp \ + Variant/VariantFloat.cpp Variant/VariantInt16.cpp \ + Variant/VariantInt32.cpp Variant/VariantInt64.cpp \ + Variant/VariantInt8.cpp Variant/VariantMatrix2.cpp \ + Variant/VariantNull.cpp Variant/VariantObject.cpp \ + Variant/VariantString.cpp Variant/VariantUInt16.cpp \ + Variant/VariantUInt32.cpp Variant/VariantUInt64.cpp \ + Variant/VariantUInt8.cpp Variant/VariantVector.cpp \ + $(am__append_4) ################################################################################ ################################################################################ @@ -847,9 +843,9 @@ avocsh_SOURCES = \ ################################################################################ ################################################################################ -avocirb_LDADD = libavocado.a $(LIBS) -avocirb_SOURCES = \ - MRClient/avocirb.cpp +@ENABLE_MRUBY_TRUE@avocirb_LDADD = libavocado.a $(LIBS) +@ENABLE_MRUBY_TRUE@avocirb_SOURCES = \ +@ENABLE_MRUBY_TRUE@ MRClient/avocirb.cpp ################################################################################ @@ -1255,14 +1251,6 @@ Logger/LoggerStream.$(OBJEXT): Logger/$(am__dirstamp) \ Logger/$(DEPDIR)/$(am__dirstamp) Logger/LoggerTiming.$(OBJEXT): Logger/$(am__dirstamp) \ Logger/$(DEPDIR)/$(am__dirstamp) -MRuby/$(am__dirstamp): - @$(MKDIR_P) MRuby - @: > MRuby/$(am__dirstamp) -MRuby/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) MRuby/$(DEPDIR) - @: > MRuby/$(DEPDIR)/$(am__dirstamp) -MRuby/MRLineEditor.$(OBJEXT): MRuby/$(am__dirstamp) \ - MRuby/$(DEPDIR)/$(am__dirstamp) ProgramOptions/$(am__dirstamp): @$(MKDIR_P) ProgramOptions @: > ProgramOptions/$(am__dirstamp) @@ -1394,6 +1382,16 @@ Variant/VariantUInt8.$(OBJEXT): Variant/$(am__dirstamp) \ Variant/$(DEPDIR)/$(am__dirstamp) Variant/VariantVector.$(OBJEXT): Variant/$(am__dirstamp) \ Variant/$(DEPDIR)/$(am__dirstamp) +MRuby/$(am__dirstamp): + @$(MKDIR_P) MRuby + @: > MRuby/$(am__dirstamp) +MRuby/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) MRuby/$(DEPDIR) + @: > MRuby/$(DEPDIR)/$(am__dirstamp) +MRuby/MRLineEditor.$(OBJEXT): MRuby/$(am__dirstamp) \ + MRuby/$(DEPDIR)/$(am__dirstamp) +MRuby/mr-utils.$(OBJEXT): MRuby/$(am__dirstamp) \ + MRuby/$(DEPDIR)/$(am__dirstamp) libavocado.a: $(libavocado_a_OBJECTS) $(libavocado_a_DEPENDENCIES) $(AM_V_at)-rm -f libavocado.a $(AM_V_AR)$(libavocado_a_AR) libavocado.a $(libavocado_a_OBJECTS) $(libavocado_a_LIBADD) @@ -2000,6 +1998,7 @@ mostlyclean-compile: -rm -f Logger/LoggerTiming.$(OBJEXT) -rm -f MRClient/avocirb.$(OBJEXT) -rm -f MRuby/MRLineEditor.$(OBJEXT) + -rm -f MRuby/mr-utils.$(OBJEXT) -rm -f PriorityQueue/pqueueindex.$(OBJEXT) -rm -f PriorityQueue/priorityqueue.$(OBJEXT) -rm -f ProgramOptions/program-options.$(OBJEXT) @@ -2228,6 +2227,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@Logger/$(DEPDIR)/LoggerTiming.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@MRClient/$(DEPDIR)/avocirb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@MRuby/$(DEPDIR)/MRLineEditor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@MRuby/$(DEPDIR)/mr-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@PriorityQueue/$(DEPDIR)/pqueueindex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@PriorityQueue/$(DEPDIR)/priorityqueue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ProgramOptions/$(DEPDIR)/program-options.Po@am__quote@ diff --git a/RestServer/AvocadoServer.cpp b/RestServer/AvocadoServer.cpp index 41996cfb25..1430e05ae3 100644 --- a/RestServer/AvocadoServer.cpp +++ b/RestServer/AvocadoServer.cpp @@ -84,11 +84,11 @@ using namespace triagens::avocado; #ifdef TRI_ENABLE_MRUBY extern "C" { -#include "mruby.h" -#include "mruby/proc.h" -#include "mruby/data.h" #include "compile.h" -#include "variable.h" +#include "mruby.h" +#include "mruby/data.h" +#include "mruby/proc.h" +#include "mruby/variable.h" } #endif diff --git a/V8/JSLoader.cpp b/V8/JSLoader.cpp index a2b169750b..415a25c47a 100644 --- a/V8/JSLoader.cpp +++ b/V8/JSLoader.cpp @@ -117,11 +117,6 @@ string const& JSLoader::findScript (string const& name) { for (size_t i = 0; i < parts.size(); i++) { char* filename = TRI_Concatenate2File(parts.at(i).c_str(), name.c_str()); - if (!filename) { - LOGGER_ERROR << "out-of-memory"; - return empty; - } - char* result = TRI_SlurpFile(filename); if (result == 0 && (i == parts.size() - 1)) { @@ -154,6 +149,7 @@ bool JSLoader::loadScript (v8::Persistent context, string const& na map::iterator i = _scripts.find(name); if (i == _scripts.end()) { + LOGGER_ERROR << "unknown script '" << name << "'"; return false; } diff --git a/V8/v8-vocbase.cpp b/V8/v8-vocbase.cpp index 95ec9924ff..6ace80f4ec 100644 --- a/V8/v8-vocbase.cpp +++ b/V8/v8-vocbase.cpp @@ -2279,6 +2279,8 @@ static v8::Handle JS_RunAhuacatl (v8::Arguments const& argv) { } string queryString = TRI_ObjectToString(queryArg); + /* currently unused, causes compile warnings + // return number of total records in cursor? bool doCount = false; if (argv.Length() > 0) { @@ -2293,6 +2295,8 @@ static v8::Handle JS_RunAhuacatl (v8::Arguments const& argv) { max = (uint32_t) maxValue; } } + + */ v8::Handle result; diff --git a/V8Client/avocsh.cpp b/V8Client/avocsh.cpp index 5602233719..60a7aae91d 100644 --- a/V8Client/avocsh.cpp +++ b/V8Client/avocsh.cpp @@ -1165,41 +1165,52 @@ int main (int argc, char* argv[]) { TRI_InitV8Shell(context); - // processComandLineArguments(argc, argv); - if (! splitServerAdress(ServerAddress, DEFAULT_SERVER_NAME, DEFAULT_SERVER_PORT)) { - if (ServerAddress.length()) { - printf("Could not split %s.\n", ServerAddress.c_str()); + // check if we want to connect to a server + bool useServer = (ServerAddress != "none"); + + if (useServer) { + if (! splitServerAdress(ServerAddress, DEFAULT_SERVER_NAME, DEFAULT_SERVER_PORT)) { + if (ServerAddress.length()) { + printf("Could not split %s.\n", ServerAddress.c_str()); + } } - } - - clientConnection = new V8ClientConnection( - DEFAULT_SERVER_NAME, - DEFAULT_SERVER_PORT, - DEFAULT_REQUEST_TIMEOUT, - DEFAULT_RETRIES, - DEFAULT_CONNECTION_TIMEOUT); + + clientConnection = new V8ClientConnection( + DEFAULT_SERVER_NAME, + DEFAULT_SERVER_PORT, + DEFAULT_REQUEST_TIMEOUT, + DEFAULT_RETRIES, + DEFAULT_CONNECTION_TIMEOUT); + } // ............................................................................. // define AvocadoConnection class // ............................................................................. - v8::Handle connection_templ = v8::FunctionTemplate::New(); - connection_templ->SetClassName(v8::String::New("AvocadoConnection")); - v8::Handle connection_proto = connection_templ->PrototypeTemplate(); - connection_proto->Set("GET", v8::FunctionTemplate::New(ClientConnection_httpGet)); - connection_proto->Set("POST", v8::FunctionTemplate::New(ClientConnection_httpPost)); - connection_proto->Set("DELETE", v8::FunctionTemplate::New(ClientConnection_httpDelete)); - connection_proto->Set("PUT", v8::FunctionTemplate::New(ClientConnection_httpPut)); - connection_proto->Set("lastHttpReturnCode", v8::FunctionTemplate::New(ClientConnection_lastHttpReturnCode)); - connection_proto->Set("lastErrorMessage", v8::FunctionTemplate::New(ClientConnection_lastErrorMessage)); - connection_proto->Set("isConnected", v8::FunctionTemplate::New(ClientConnection_isConnected)); - connection_proto->Set("toString", v8::FunctionTemplate::New(ClientConnection_toString)); - connection_proto->Set("getVersion", v8::FunctionTemplate::New(ClientConnection_getVersion)); - connection_proto->SetCallAsFunctionHandler(ClientConnection_ConstructorCallback); - v8::Handle connection_inst = connection_templ->InstanceTemplate(); - connection_inst->SetInternalFieldCount(2); - context->Global()->Set(v8::String::New("AvocadoConnection"), connection_proto->NewInstance()); - ConnectionTempl = v8::Persistent::New(connection_inst); + + if (useServer) { + v8::Handle connection_templ = v8::FunctionTemplate::New(); + connection_templ->SetClassName(v8::String::New("AvocadoConnection")); + + v8::Handle connection_proto = connection_templ->PrototypeTemplate(); + + connection_proto->Set("GET", v8::FunctionTemplate::New(ClientConnection_httpGet)); + connection_proto->Set("POST", v8::FunctionTemplate::New(ClientConnection_httpPost)); + connection_proto->Set("DELETE", v8::FunctionTemplate::New(ClientConnection_httpDelete)); + connection_proto->Set("PUT", v8::FunctionTemplate::New(ClientConnection_httpPut)); + connection_proto->Set("lastHttpReturnCode", v8::FunctionTemplate::New(ClientConnection_lastHttpReturnCode)); + connection_proto->Set("lastErrorMessage", v8::FunctionTemplate::New(ClientConnection_lastErrorMessage)); + connection_proto->Set("isConnected", v8::FunctionTemplate::New(ClientConnection_isConnected)); + connection_proto->Set("toString", v8::FunctionTemplate::New(ClientConnection_toString)); + connection_proto->Set("getVersion", v8::FunctionTemplate::New(ClientConnection_getVersion)); + connection_proto->SetCallAsFunctionHandler(ClientConnection_ConstructorCallback); + + v8::Handle connection_inst = connection_templ->InstanceTemplate(); + connection_inst->SetInternalFieldCount(2); + + context->Global()->Set(v8::String::New("AvocadoConnection"), connection_proto->NewInstance()); + ConnectionTempl = v8::Persistent::New(connection_inst); + } context->Global()->Set(v8::String::New("SYS_START_PAGER"), v8::FunctionTemplate::New(JS_StartOutputPager)->GetFunction(), @@ -1245,77 +1256,81 @@ int main (int argc, char* argv[]) { printf("\n"); - if (clientConnection->isConnected()) { - printf("Connected to Avocado DB %s:%d Version %s\n", - clientConnection->getHostname().c_str(), - clientConnection->getPort(), - clientConnection->getVersion().c_str()); - - if (usePager) { - printf("Using pager '%s' for output buffering.\n", OutputPager.c_str()); - } - - // add the client connection to the context: - context->Global()->Set(v8::String::New("avocado"), - wrapV8ClientConnection(clientConnection), - v8::ReadOnly); - - if (prettyPrint) { - printf("Pretty print values.\n"); - } + // set up output + if (usePager) { + printf("Using pager '%s' for output buffering.\n", OutputPager.c_str()); + } - // set pretty print default: (used in print.js) - context->Global()->Set(v8::String::New("PRETTY_PRINT"), v8::Boolean::New(prettyPrint)); + if (prettyPrint) { + printf("Pretty print values.\n"); + } - // add colors for print.js - addColors(context); - - // load java script from js/bootstrap/*.h files - if (StartupPath.empty()) { - StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); - StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); - StartupLoader.defineScript("common/bootstrap/errors.js", JS_common_bootstrap_errors); - StartupLoader.defineScript("client/client.js", JS_client_client); + // set pretty print default: (used in print.js) + context->Global()->Set(v8::String::New("PRETTY_PRINT"), v8::Boolean::New(prettyPrint)); + + // add colors for print.js + addColors(context); + + // set up connection + if (useServer) { + if (clientConnection->isConnected()) { + printf("Connected to Avocado DB %s:%d Version %s\n", + clientConnection->getHostname().c_str(), + clientConnection->getPort(), + clientConnection->getVersion().c_str()); + + // add the client connection to the context: + context->Global()->Set(v8::String::New("avocado"), + wrapV8ClientConnection(clientConnection), + v8::ReadOnly); } else { - LOGGER_DEBUG << "using JavaScript startup files at '" << StartupPath << "'"; - StartupLoader.setDirectory(StartupPath); - } - - // load all init files - char const* files[] = { - "common/bootstrap/modules.js", - "common/bootstrap/print.js", - "common/bootstrap/errors.js", - "client/client.js" - }; - - for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); ++i) { - bool ok = StartupLoader.loadScript(context, files[i]); - - if (ok) { - LOGGER_TRACE << "loaded json file '" << files[i] << "'"; - } - else { - LOGGER_ERROR << "cannot load json file '" << files[i] << "'"; - exit(EXIT_FAILURE); - } - } - - if (UnitTests.empty()) { - RunShell(context); - } - else { - bool ok = RunUnitTests(context); - - if (! ok) { - ret = EXIT_FAILURE; - } + printf("Could not connect to server %s:%d\n", DEFAULT_SERVER_NAME.c_str(), DEFAULT_SERVER_PORT); + printf("Error message '%s'\n", clientConnection->getErrorMessage().c_str()); } } + + // load java script from js/bootstrap/*.h files + if (StartupPath.empty()) { + StartupLoader.defineScript("common/bootstrap/modules.js", JS_common_bootstrap_modules); + StartupLoader.defineScript("common/bootstrap/print.js", JS_common_bootstrap_print); + StartupLoader.defineScript("common/bootstrap/errors.js", JS_common_bootstrap_errors); + StartupLoader.defineScript("client/client.js", JS_client_client); + } else { - printf("Could not connect to server %s:%d\n", DEFAULT_SERVER_NAME.c_str(), DEFAULT_SERVER_PORT); - printf("Error message '%s'\n", clientConnection->getErrorMessage().c_str()); + LOGGER_DEBUG << "using JavaScript startup files at '" << StartupPath << "'"; + StartupLoader.setDirectory(StartupPath); + } + + // load all init files + char const* files[] = { + "common/bootstrap/modules.js", + "common/bootstrap/print.js", + "common/bootstrap/errors.js", + "client/client.js" + }; + + for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); ++i) { + bool ok = StartupLoader.loadScript(context, files[i]); + + if (ok) { + LOGGER_TRACE << "loaded json file '" << files[i] << "'"; + } + else { + LOGGER_ERROR << "cannot load json file '" << files[i] << "'"; + exit(EXIT_FAILURE); + } + } + + if (UnitTests.empty()) { + RunShell(context); + } + else { + bool ok = RunUnitTests(context); + + if (! ok) { + ret = EXIT_FAILURE; + } } context->Exit(); diff --git a/configure b/configure index 651d8c0f52..b2f0688e1f 100755 --- a/configure +++ b/configure @@ -833,6 +833,7 @@ enable_static_libev with_v8 with_v8_lib enable_static_v8 +enable_mruby with_boost with_boost_libdir ' @@ -1508,6 +1509,7 @@ Optional Features: --enable-libev enable libev support (default: yes) --enable-static-libev using static library 'libev' (default: no) --enable-static-v8 using static library 'v8' (default: no) + --enable-mruby enable MRUBY Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -8954,15 +8956,30 @@ fi -ENABLE_MRUBY="yes" +# Check whether --enable-mruby was given. +if test "${enable_mruby+set}" = set; then : + enableval=$enable_mruby; tr_MRUBY="${enableval:-yes}" +else + tr_MRUBY=yes -MRUBY_CPPFLAGS="-I${srcdir}/3rdParty/mruby/include" -MRUBY_LDFLAGS="" -MRUBY_LIBS="${srcdir}/3rdParty/mruby/lib/ritevm.a" +fi -TRI_MRUBY_VERSION="0.0.0" - if true; then +if test "x$tr_MRUBY" = "xyes"; then + MRUBY_CPPFLAGS="-I${srcdir}/3rdParty/mruby/include" + MRUBY_LDFLAGS="" + MRUBY_LIBS="${srcdir}/3rdParty/mruby/lib/ritevm.a" + + TRI_MRUBY_VERSION="0.0.0" + + +cat >>confdefs.h <<_ACEOF +#define TRI_ENABLE_MRUBY 1 +_ACEOF + +fi + + if test "x$tr_MRUBY" = "xyes"; then ENABLE_MRUBY_TRUE= ENABLE_MRUBY_FALSE='#' else @@ -8971,11 +8988,6 @@ else fi -cat >>confdefs.h <<_ACEOF -#define TRI_ENABLE_MRUBY 1 -_ACEOF - - @@ -8984,14 +8996,18 @@ _ACEOF MRUBY_CPPFLAGS="${MRUBY_CPPFLAGS} -DTRI_MRUBY_VERSION='\"${TRI_MRUBY_VERSION}\"'" -BASIC_INFO="$BASIC_INFO|MRUBY: disabled" +if test "x$tr_MRUBY" = "xyes"; then + BASIC_INFO="$BASIC_INFO|MRUBY: enabled" -LIB_INFO="$LIB_INFO|MRUBY VERSION: ${TRI_MRUBY_VERSION}" + LIB_INFO="$LIB_INFO|MRUBY VERSION: ${TRI_MRUBY_VERSION}" -FLAG_INFO="$FLAG_INFO|MRUBY_CPPFLAGS: ${MRUBY_CPPFLAGS}" -FLAG_INFO="$FLAG_INFO|MRUBY_LDFLAGS: ${MRUBY_LDFLAGS}" -FLAG_INFO="$FLAG_INFO|MRUBY_LIBS: ${MRUBY_LIBS}" -FLAG_INFO="$FLAG_INFO|." + FLAG_INFO="$FLAG_INFO|MRUBY_CPPFLAGS: ${MRUBY_CPPFLAGS}" + FLAG_INFO="$FLAG_INFO|MRUBY_LDFLAGS: ${MRUBY_LDFLAGS}" + FLAG_INFO="$FLAG_INFO|MRUBY_LIBS: ${MRUBY_LIBS}" + FLAG_INFO="$FLAG_INFO|." +else + BASIC_INFO="$BASIC_INFO|MRUBY: disabled" +fi diff --git a/html/admin/css/layout.css b/html/admin/css/layout.css index ed96a8836c..e2434b9e56 100644 --- a/html/admin/css/layout.css +++ b/html/admin/css/layout.css @@ -1,12 +1,27 @@ +#logView .fg-toolbar{display: none;} + html { font-family: Verdana,Arial,sans-serif; font-size: 1em; + min-width: 1024px; } tr { font-size: 0.9em; } th { - font-size: 1.3em; + font-size: 1.1em; +} + +#logToolbar { + height:24px; + border: 1px solid #AAAAAA; + padding-left: 3px; + padding-top: 4px; + border-top-left-radius: 2px; + border-top-right-radius: 2px; + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; + background: url("images/ui-bg_flat_75_e6e6e6_40x100.png") repeat-x scroll 50% 50% #E6E6E6; } .dataTables_info{ @@ -35,20 +50,18 @@ th { } #menue { - height:48px; - line-height: 30px; + height:55px; vertical-align: middle; text-align: center; background-color: white; - text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white; } #brotkruemelnavi { - font-size: 1.2em; + font-size: 1.1em; height:30px; line-height: 30px; vertical-align: middle; - padding-left: 10px; + padding-left: 5px; //background-color: #7E9246; background-color: #F3F1EE; color: #9EAF5A; @@ -93,7 +106,7 @@ th { #avocshWindow { background-color: white; - height: 400px; + height: 300px; overflow-y: auto; width:100%; } @@ -148,7 +161,7 @@ th { box-shadow: 0 0 5px rgba(81, 203, 238, 0); -webkit-box-shadow: 0 0 5px rgba(81, 203, 238, 0); -moz-box-shadow: 0 0 5px rgba(81, 203, 238, 0); - height: 400px; + height: 300px; } .editBox:focus { @@ -162,17 +175,19 @@ th { } #menue-left { + margin-top: 3px; + margin-left: 10px; height:48px; - width:500px; + width:auto; float:left; text-align:left; } #menue-right { - padding-top:8px; - padding-right:4px; + padding-top:11px; + padding-right:10px; height:40px; - width:100% - 400px; + width:auto; float:right; text-align:right; } @@ -295,7 +310,8 @@ th { } .fg-toolbar { - font-size: 0.8em; + font-size: 0.7em; + border: 1px solid #D3D3D3 !important; } /* @@ -313,12 +329,12 @@ th { -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; box-shadow: inset 0 0 1px 1px #f6f6f6; color: #333; - font: 0.9em "helvetica neue", helvetica, arial, sans-serif; + font: 0.7em Verdana,Arial,sans-serif; line-height: 1; padding: 8px 0 9px; text-align: center; text-shadow: 0 1px 0 #fff; - width: 90px; + width: 80px; } #menue button.minimal:hover { background: #d9d9d9; @@ -375,7 +391,7 @@ th { ############################################################################## */ -#avocshView button, #queryView button, #tab_right button, #logTableID_info button, #footerSlideContent button, form.jediTextarea > button { +#avocshView button, #queryView button, #tab_right button, #footerSlideContent button, form.jediTextarea > button, #logToolbar button { background: #e3e3e3; border: 1px solid #bbb; -webkit-border-radius: 3px; @@ -393,14 +409,14 @@ th { text-align: center; } -#avocshView button:hover, #queryView button:hover, #tab_right button:hover, #logTableID_info button:hover, #footerSlideContent button:hover, form.jediTextarea > button:hover { +#avocshView button:hover, #queryView button:hover, #tab_right button:hover, #footerSlideContent button:hover, form.jediTextarea > button:hover { background: #d9d9d9; -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; -moz-box-shadow: inset 0 0 1px 1px #eaeaea; box-shadow: inset 0 0 1px 1px #eaeaea; color: #222; cursor: pointer; } -#avocshView button:active, #queryView button:active, #tab_right button:active, #logTable_ID_info button:active, #footerSlideContent button:active, form.jediTextarea > button:active { +#avocshView button:active, #queryView button:active, #tab_right button:active, #footerSlideContent button:active, form.jediTextarea > button:active { background: #d0d0d0; -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3; -moz-box-shadow: inset 0 0 1px 1px #e3e3e3; diff --git a/html/admin/index.html b/html/admin/index.html index 54d8fb64a9..8043510c03 100644 --- a/html/admin/index.html +++ b/html/admin/index.html @@ -35,19 +35,19 @@ @@ -90,7 +90,10 @@ Save Collection - + @@ -207,10 +210,10 @@
@@ -222,6 +225,10 @@
+
+ + +
@@ -233,6 +240,10 @@ +
+ + +
@@ -244,6 +255,10 @@ +
+ + +
@@ -255,6 +270,10 @@ +
+ + +
@@ -266,6 +285,10 @@ +
+ + +
diff --git a/html/admin/js/master.js b/html/admin/js/master.js index 579840af6c..d81e7a63c8 100644 --- a/html/admin/js/master.js +++ b/html/admin/js/master.js @@ -5,27 +5,52 @@ $(document).ready(function() { +showCursor(); /////////////////////////////////////////////////////////////////////////////// /// global variables /////////////////////////////////////////////////////////////////////////////// - var userScreenSize = $(window).width(); var open = false; var tableView = true; var sid = ($.cookie("sid")); var currentUser; +//logtable vars +var currentPage = 1; +var currentAmount; +var currentTableID = "#logTableID"; +var currentLoglevel = 5; +//live click for all log tables +var tables = ["#logTableID", "#critLogTableID", "#warnLogTableID", "#infoLogTableID", "#debugLogTableID"]; + +$.each(tables, function(v, i ) { + $(i + '_next').live('click', function () { + createNextPagination(); + }); + $(i + '_prev').live('click', function () { + createPrevPagination(); + }); +}); /////////////////////////////////////////////////////////////////////////////// /// html customizations /////////////////////////////////////////////////////////////////////////////// - $('#logView ul').append('
'); /////////////////////////////////////////////////////////////////////////////// /// initialize jquery tabs /////////////////////////////////////////////////////////////////////////////// -$("#tabs").tabs(); +$("#tabs").tabs({ + select: function(event, ui) { + if (ui.index == 0) { + createLogTable(5); + } + else { + createLogTable(ui.index); + } + } +}); + /////////////////////////////////////////////////////////////////////////////// /// checks for a login user cookie, creates new sessions if null @@ -70,7 +95,7 @@ var collectionTable = $('#collectionsTableID').dataTable({ "bFilter": false, "bLengthChange": false, "bDeferRender": true, - "bAutoWidth": true, + "bAutoWidth": false, "iDisplayLength": -1, "bJQueryUI": true, "aoColumns": [{"sWidth":"150px", "bSortable":false}, null, null, null, null, null ], @@ -533,7 +558,7 @@ var logTable = $('#logTableID').dataTable({ /////////////////////////////////////////////////////////////////////////////// else if (location.hash == "#logs") { - refreshLogTables(); + createLogTable(5); hideAllSubDivs(); $('#collectionsView').hide(); $('#logView').show(); @@ -723,7 +748,6 @@ var logTable = $('#logTableID').dataTable({ /////////////////////////////////////////////////////////////////////////////// $('#refreshLogButton').live('click', function () { - refreshLogTables(); }); /////////////////////////////////////////////////////////////////////////////// @@ -827,7 +851,6 @@ var logTable = $('#logTableID').dataTable({ for (row in content) { var row_data = content[row]; result[row_data[1]] = row_data[3]; - //console.log(row_data[0] + ":" + row_data[1] + ":" + row_data[2] + ":" + row_data[3]); } $('#documentEditSourceBox').val(JSON.stringify(result)); $('#documentEditTableView').toggle(); @@ -1270,6 +1293,9 @@ var logTable = $('#logTableID').dataTable({ }); } + + + /////////////////////////////////////////////////////////////////////////////// /// jump to edit collection view /////////////////////////////////////////////////////////////////////////////// @@ -1358,74 +1384,34 @@ function drawCollectionsTable () { if (tempStatus == 1) { tempStatus = "new born collection"; } - if (tempStatus == 2) { + else if (tempStatus == 2) { tempStatus = "unloaded"; - items.push(['', + items.push(['', val.id, val.name, tempStatus, "", ""]); } - if (tempStatus == 3) { + else if (tempStatus == 3) { tempStatus = "loaded"; - items.push(['', + items.push(['', val.id, val.name, tempStatus, "", ""]); } - if (tempStatus == 4) { + else if (tempStatus == 4) { tempStatus = "in the process of being unloaded"; items.push(["", val.id, val.name, tempStatus, "", ""]); } - if (tempStatus == 5) { + else if (tempStatus == 5) { tempStatus = "deleted"; items.push(["", val.id, val.name, tempStatus, "", ""]); } +/* else { + tempStatus = "corrupted"; + items.push(["", ""+ val.id + "", ""+ val.name + "", "" + tempStatus + "", "", ""]); + }*/ }); $('#collectionsTableID').dataTable().fnAddData(items); + showCursor(); }); } -/////////////////////////////////////////////////////////////////////////////// -/// draw and fill logtable -/////////////////////////////////////////////////////////////////////////////// - -function refreshLogTables () { - - $('#logTableID').dataTable().fnClearTable(); - $.getJSON("/_admin/log?upto=5&size=10", function(data) { - var items=[]; - var i=0; - var totalAmount = data.totalAmount; - - $.each(data.lid, function () { - $('#logTableID').dataTable().fnAddData([data.level[i], data.text[i]]); - $('#debugLogTableID').dataTable().fnAddData([data.level[i], data.text[i]]); - i++; - }); - createLogPagination("#logTableID", totalAmount, 1); - - }); -} - -$('#submitLogSearch').live('click', function () { - var content = $('#logSearchField').val(); - - if (content == '' || content == null) { - return false; - } - else { - $('#logTableID').dataTable().fnClearTable(); - $.getJSON("/_admin/log?search=" + content, function(data) { - var totalAmount = data.totalAmount; - var items=[]; - var i=0; - - $.each(data.lid, function () { - $('#logTableID').dataTable().fnAddData([data.level[i], data.text[i]]); - i++; - }); - deleteLogPagination("#logTableID", content); - }); - } - return false; -}); - /////////////////////////////////////////////////////////////////////////////// /// short function to enable edit mode for a table /////////////////////////////////////////////////////////////////////////////// @@ -1590,108 +1576,107 @@ function createnav (menue) { $(function() { var open = false; - $('#footerSlideButton').click(function() { - if(open === false) { - $('#footerSlideContent').animate({ height: '120px' }); - $(this).css('backgroundPosition', 'bottom left'); - open = true; - $('#movetologinButton').text("Hide"); - } else { - $('#footerSlideContent').animate({ height: '25px' }); - $(this).css('backgroundPosition', 'top left'); - open = false; - $('#movetologinButton').text("Login"); - } - }); - $('#movetologinButton').click(function() { - if(open === false) { - $('#movetologinButton').text("Hide"); - $('#footerSlideContent').animate({ height: '120px' }); - $('#footerSlideButton').css('backgroundPosition', 'bottom left'); - open = true; - } else { - $('#movetologinButton').text("Login"); - $('#footerSlideContent').animate({ height: '25px' }); - $('#footerSlideButton').css('backgroundPosition', 'top left'); - open = false; - } - }); + $('#footerSlideButton').click(function() { + if(open === false) { + $('#footerSlideContent').animate({ height: '120px' }); + $(this).css('backgroundPosition', 'bottom left'); + open = true; + $('#movetologinButton').text("Hide"); + } + else { + $('#footerSlideContent').animate({ height: '25px' }); + $(this).css('backgroundPosition', 'top left'); + open = false; + $('#movetologinButton').text("Login"); + } + }); + + $('#movetologinButton').click(function() { + if(open === false) { + $('#movetologinButton').text("Hide"); + $('#footerSlideContent').animate({ height: '120px' }); + $('#footerSlideButton').css('backgroundPosition', 'bottom left'); + open = true; + } + else { + $('#movetologinButton').text("Login"); + $('#footerSlideContent').animate({ height: '25px' }); + $('#footerSlideButton').css('backgroundPosition', 'top left'); + open = false; + } + }); }); /////////////////////////////////////////////////////////////////////////////// /// Log tables pagination /////////////////////////////////////////////////////////////////////////////// -function createLogPagination (tableID, totalAmount, currentPage) { - var totalPages = Math.ceil(totalAmount / 10); - - $(tableID + "_info").empty(); - $(tableID + "_info").append('Showing Page '+currentPage+' of '+totalPages+' '); - $(tableID + "_info").append(''); - $(tableID + "_info").append(''); -} - -function deleteLogPagination (tableID, content) { - $(tableID + "_info").empty(); - $(tableID + "_info").append('Showing entries containing: "' + content + '"'); -} - -function createNextPagination (tableID, currentPage, loglevel) { - - var totalPages = $('#totalPages').text(); - if (currentPage == totalPages) { - return 0; - } - - var nextPage = JSON.parse(currentPage) + 1; - - $.getJSON("/_admin/log?upto=4&size=1", function(data) { - var totalAmount = data.totalAmount; - var offset = currentPage * 10; - - $.getJSON("/_admin/log?size=10&upto="+loglevel+"&offset=" + offset, function(data) { - $('#logTableID').dataTable().fnClearTable(); - - var i = 0; - $.each(data.level, function() { - $('#logTableID').dataTable().fnAddData([data.level[i], data.text[i]]); - i++; - }); - createLogPagination (tableID, totalAmount, nextPage); - }); - }); -} - -function createPrevPagination (tableID, currentPage, loglevel) { - -if (currentPage == 1) { - return 0; -} - - var prevPage = JSON.parse(currentPage) - 1; - var offset = prevPage * 10 - 10; - - $.getJSON("/_admin/log?upto=4&size=1", function(data) { - var totalAmount = data.totalAmount; - - $.getJSON("/_admin/log?size=10&upto="+loglevel+"&offset=" + offset, function(data) { - $('#logTableID').dataTable().fnClearTable(); - - var i = 0; - $.each(data.level, function() { - $('#logTableID').dataTable().fnAddData([data.level[i], data.text[i]]); - i++; - }); - createLogPagination (tableID, totalAmount, prevPage); +function createLogTable(loglevel) { + currentPage = 1; + currentLoglevel = loglevel; +//set tableid + if (loglevel == 1) {currentTableID = "#critLogTableID";} + else if (loglevel == 2) {currentTableID = "#warnLogTableID";} + else if (loglevel == 3) {currentTableID = "#infoLogTableID";} + else if (loglevel == 4) {currentTableID = "#debugLogTableID";} + else if (loglevel == 5) {currentTableID = "#logTableID";} +//get first rows + $.getJSON("/_admin/log?level="+loglevel+"&size=10", function(data) { + var items=[]; + var i=0; + currentAmount = data.totalAmount; +//clear table + $(currentTableID).dataTable().fnClearTable(); +//draw first 10 rows + $.each(data.lid, function () { + $(currentTableID).dataTable().fnAddData([data.level[i], data.text[i]]); + i++; }); }); } -$('#prevEntries').live('click', function () { - createPrevPagination("#logTableID", $('#currentPage').text(), 4); -}); +function createPrevPagination() { + if (currentPage == 1) { + return 0; + } + + var prevPage = JSON.parse(currentPage) - 1; + var offset = prevPage * 10 - 10; -$('#nextEntries').live('click', function () { - createNextPagination("#logTableID", $('#currentPage').text(), 4); -}); + $.getJSON("/_admin/log?level="+currentLoglevel+"&size=10&offset="+offset, function(data) { + $(currentTableID).dataTable().fnClearTable(); + var i = 0; + $.each(data.level, function() { + $(currentTableID).dataTable().fnAddData([data.level[i], data.text[i]]); + i++; + }); + currentPage = JSON.parse(currentPage) - 1; + }); +} + +function createNextPagination() { + var totalPages = Math.ceil(currentAmount / 10); + var offset = currentPage * 10; + + if (currentPage == totalPages) { + return 0; + } + + $.getJSON("/_admin/log?level="+currentLoglevel+"&size=10&offset="+offset, function(data) { + $(currentTableID).dataTable().fnClearTable(); + + var i = 0; + $.each(data.level, function() { + $(currentTableID).dataTable().fnAddData([data.level[i], data.text[i]]); + i++ + }); + currentPage = JSON.parse(currentPage) + 1; + }); +} + +function showCursor() { + $(':button').mouseover(function () { + $(this).css('cursor', 'pointer'); + }); +} diff --git a/html/admin/media/icons/cancel_icon16.png b/html/admin/media/icons/cancel_icon16.png new file mode 100644 index 0000000000..4e74bb61d8 Binary files /dev/null and b/html/admin/media/icons/cancel_icon16.png differ diff --git a/html/admin/media/icons/round_minus_icon16.png b/html/admin/media/icons/round_minus_icon16.png new file mode 100644 index 0000000000..8ca738e509 Binary files /dev/null and b/html/admin/media/icons/round_minus_icon16.png differ diff --git a/html/admin/media/images/avocado.png b/html/admin/media/images/avocado.png deleted file mode 100644 index 55ddfdc258..0000000000 Binary files a/html/admin/media/images/avocado.png and /dev/null differ diff --git a/html/admin/media/images/avocadodb_logo.png b/html/admin/media/images/avocadodb_logo.png new file mode 100644 index 0000000000..9830511239 Binary files /dev/null and b/html/admin/media/images/avocadodb_logo.png differ diff --git a/js/client/client.js b/js/client/client.js index 74b74d73a2..7b99e2584c 100644 --- a/js/client/client.js +++ b/js/client/client.js @@ -2123,19 +2123,22 @@ helpExtended = TRI_CreateHelpHeadline("More help") + try { - // default databases - db = new AvocadoDatabase(avocado); - edges = new AvocadoEdges(avocado); + if (typeof avocado !== 'undefined') { - // load collection data - db._collections(); - edges._collections(); + // default databases + db = new AvocadoDatabase(avocado); + edges = new AvocadoEdges(avocado); - // export to internal - ModuleCache["/internal"].exports.db = db; - ModuleCache["/internal"].exports.edges = db; + // load collection data + db._collections(); + edges._collections(); - print(HELP); + // export to internal + ModuleCache["/internal"].exports.db = db; + ModuleCache["/internal"].exports.edges = db; + + print(HELP); + } } catch (err) { print(err); diff --git a/js/client/js-client.h b/js/client/js-client.h index 2a4aa1647e..b53541b1e0 100644 --- a/js/client/js-client.h +++ b/js/client/js-client.h @@ -2124,19 +2124,22 @@ static string JS_client_client = "\n" "try {\n" "\n" - " // default databases\n" - " db = new AvocadoDatabase(avocado);\n" - " edges = new AvocadoEdges(avocado);\n" + " if (typeof avocado !== 'undefined') {\n" "\n" - " // load collection data\n" - " db._collections();\n" - " edges._collections();\n" + " // default databases\n" + " db = new AvocadoDatabase(avocado);\n" + " edges = new AvocadoEdges(avocado);\n" "\n" - " // export to internal\n" - " ModuleCache[\"/internal\"].exports.db = db;\n" - " ModuleCache[\"/internal\"].exports.edges = db;\n" + " // load collection data\n" + " db._collections();\n" + " edges._collections();\n" "\n" - " print(HELP);\n" + " // export to internal\n" + " ModuleCache[\"/internal\"].exports.db = db;\n" + " ModuleCache[\"/internal\"].exports.edges = db;\n" + "\n" + " print(HELP);\n" + " }\n" "}\n" "catch (err) {\n" " print(err);\n" diff --git a/m4/all-in-one.mruby b/m4/all-in-one.mruby index ece6d3d38c..6f551e32f1 100644 --- a/m4/all-in-one.mruby +++ b/m4/all-in-one.mruby @@ -4,16 +4,23 @@ dnl ---------------------------------------------------------------------------- dnl option for MRUBY support dnl ----------------------------------------------------------------------------------------- -ENABLE_MRUBY="yes" +AC_ARG_ENABLE(mruby, + AS_HELP_STRING([--enable-mruby], [enable MRUBY]), + [tr_MRUBY="${enableval:-yes}"], + [tr_MRUBY=yes] +) -MRUBY_CPPFLAGS="-I${srcdir}/3rdParty/mruby/include" -MRUBY_LDFLAGS="" -MRUBY_LIBS="${srcdir}/3rdParty/mruby/lib/ritevm.a" +if test "x$tr_MRUBY" = "xyes"; then + MRUBY_CPPFLAGS="-I${srcdir}/3rdParty/mruby/include" + MRUBY_LDFLAGS="" + MRUBY_LIBS="${srcdir}/3rdParty/mruby/lib/ritevm.a" -TRI_MRUBY_VERSION="0.0.0" + TRI_MRUBY_VERSION="0.0.0" -AM_CONDITIONAL(ENABLE_MRUBY, true) -AC_DEFINE_UNQUOTED(TRI_ENABLE_MRUBY, 1, [true if mruby should be used]) + AC_DEFINE_UNQUOTED(TRI_ENABLE_MRUBY, 1, [true if mruby should be used]) +fi + +AM_CONDITIONAL(ENABLE_MRUBY, test "x$tr_MRUBY" = "xyes") dnl ----------------------------------------------------------------------------------------- dnl add substitutions @@ -29,14 +36,18 @@ dnl ---------------------------------------------------------------------------- dnl informational output dnl ----------------------------------------------------------------------------------------- -BASIC_INFO="$BASIC_INFO|MRUBY: disabled" +if test "x$tr_MRUBY" = "xyes"; then + BASIC_INFO="$BASIC_INFO|MRUBY: enabled" -LIB_INFO="$LIB_INFO|MRUBY VERSION: ${TRI_MRUBY_VERSION}" + LIB_INFO="$LIB_INFO|MRUBY VERSION: ${TRI_MRUBY_VERSION}" -FLAG_INFO="$FLAG_INFO|MRUBY_CPPFLAGS: ${MRUBY_CPPFLAGS}" -FLAG_INFO="$FLAG_INFO|MRUBY_LDFLAGS: ${MRUBY_LDFLAGS}" -FLAG_INFO="$FLAG_INFO|MRUBY_LIBS: ${MRUBY_LIBS}" -FLAG_INFO="$FLAG_INFO|." + FLAG_INFO="$FLAG_INFO|MRUBY_CPPFLAGS: ${MRUBY_CPPFLAGS}" + FLAG_INFO="$FLAG_INFO|MRUBY_LDFLAGS: ${MRUBY_LDFLAGS}" + FLAG_INFO="$FLAG_INFO|MRUBY_LIBS: ${MRUBY_LIBS}" + FLAG_INFO="$FLAG_INFO|." +else + BASIC_INFO="$BASIC_INFO|MRUBY: disabled" +fi dnl Local Variables: