Fixed build without python/ruby.

This commit is contained in:
Matthias Koefferlein 2017-08-27 15:22:13 +02:00
parent 082699bebb
commit bbac8fe19e
6 changed files with 37 additions and 20 deletions

View File

@ -31,14 +31,23 @@ static void fail (const char *file, int line)
throw tl::ScriptError (tl::to_string (QObject::tr ("Python support not compiled in")).c_str (), file, line, "missing_feature", std::vector<tl::BacktraceElement> ());
}
PythonInterpreter::PythonInterpreter ()
{
// .. nothing ..
static PythonInterpreter *sp_pya_interpreter = 0;
PythonInterpreter::PythonInterpreter ()
{
tl_assert (! sp_pya_interpreter);
sp_pya_interpreter = this;
}
PythonInterpreter::~PythonInterpreter ()
PythonInterpreter::~PythonInterpreter ()
{
// .. nothing ..
// This prevents reinitialization
sp_pya_interpreter = reinterpret_cast<PythonInterpreter *> (1);
}
PythonInterpreter *PythonInterpreter::instance ()
{
return sp_pya_interpreter;
}
void
@ -162,11 +171,5 @@ PythonInterpreter::eval_expr (const char *, const char *file, int line, int)
return tl::Variant ();
}
PythonInterpreter *
PythonInterpreter::instance ()
{
return 0;
}
}

View File

@ -168,10 +168,9 @@ public:
static void initialize ();
/**
* @brief Always returns 0
* @brief Returns the singleton reference
*/
static PythonInterpreter *instance ();
};
}

View File

@ -13,5 +13,6 @@ DEPENDPATH += $$TL_INC $$GSI_INC
LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi
HEADERS += \
pyaCommon.h
pyaCommon.h \
pya.h

View File

@ -30,14 +30,23 @@ static void fail (const char *file, int line)
throw tl::ScriptError (tl::to_string (QObject::tr ("Ruby support not compiled in")).c_str (), file, line, "missing_feature", std::vector<tl::BacktraceElement> ());
}
RubyInterpreter::RubyInterpreter ()
{
// .. nothing ..
static RubyInterpreter *sp_rba_interpreter = 0;
RubyInterpreter::RubyInterpreter ()
{
tl_assert (! sp_rba_interpreter);
sp_rba_interpreter = this;
}
RubyInterpreter::~RubyInterpreter ()
RubyInterpreter::~RubyInterpreter ()
{
// .. nothing ..
// This prevents reinitialization
sp_rba_interpreter = reinterpret_cast<RubyInterpreter *> (1);
}
RubyInterpreter *RubyInterpreter::instance ()
{
return sp_rba_interpreter;
}
void

View File

@ -150,6 +150,11 @@ public:
*/
std::string version () const;
/**
* @brief The instance of the Ruby interpreter
*/
static RubyInterpreter *instance ();
/**
* @brief Provide a first (basic) initialization and continue with the "main_cont" function internally
*/

View File

@ -6,7 +6,7 @@ include($$PWD/../lib.pri)
DEFINES += MAKE_RBA_LIBRARY
HEADERS = rbaCommon.h
HEADERS = rbaCommon.h rba.h
SOURCES = rba.cc