For strmxor unit tests: gsi initialization fixed

Now the gsi::initialize_expressions includes gsi::initialize.
Both can be called multiple times (the second time they are
ignored).
This commit is contained in:
Matthias Koefferlein 2017-08-21 00:01:10 +02:00
parent 1baddd3632
commit f013f1541e
2 changed files with 16 additions and 0 deletions

View File

@ -35,6 +35,13 @@ namespace gsi
void GSI_PUBLIC
initialize ()
{
// Allow duplicate initialization without any effect
static bool s_is_initialized = false;
if (s_is_initialized) {
return;
}
s_is_initialized = true;
tl::SelfTimer timer (tl::verbosity () >= 21, "Initializing script environment");
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {

View File

@ -1073,6 +1073,15 @@ private:
void GSI_PUBLIC
initialize_expressions ()
{
// Allow duplicate initialization without any effect
static bool s_is_initialized = false;
if (s_is_initialized) {
return;
}
s_is_initialized = true;
gsi::initialize ();
for (gsi::ClassBase::class_iterator c = gsi::ClassBase::begin_classes (); c != gsi::ClassBase::end_classes (); ++c) {
// install the method table: