Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/pkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ using libsemigroups::Blocks;
using libsemigroups::word_type;

namespace {
void LIBSEMIGROUPS_REPORTING_ENABLED(bool const val) {
void enable_libsemigroups_reporting(bool val) {
static std::unique_ptr<libsemigroups::ReportGuard> rg;
// Reset first so that reporting is disabled, then set the new value. Just
// doing the assignment has this the other way around, and results in
// reporting always being disabled.
rg.reset();
rg = std::make_unique<libsemigroups::ReportGuard>(val);
}
} // namespace
Expand All @@ -76,7 +80,7 @@ GAPBIND14_MODULE(libsemigroups) {
////////////////////////////////////////////////////////////////////////

gapbind14::InstallGlobalFunction("set_report",
&LIBSEMIGROUPS_REPORTING_ENABLED);
&enable_libsemigroups_reporting);
gapbind14::InstallGlobalFunction("reporting_enabled",
&libsemigroups::reporting_enabled);
gapbind14::InstallGlobalFunction("hardware_concurrency",
Expand Down Expand Up @@ -487,6 +491,8 @@ static Int InitKernel(StructInitInfo* module) {
}

static Int PostRestore(StructInitInfo* module) {
// Disable reporting by default, including after loading a workspace.
enable_libsemigroups_reporting(false);
return 0;
}

Expand Down
10 changes: 10 additions & 0 deletions tst/standard/libsemigroups/froidure-pin.tst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ gap> LoadPackage("semigroups", false);;
#
gap> SEMIGROUPS.StartTest();

# libsemigroups reporting can be re-enabled after being disabled by default
gap> libsemigroups.reporting_enabled();
false
gap> libsemigroups.set_report(true);;
gap> libsemigroups.reporting_enabled();
true
gap> libsemigroups.set_report(false);;
gap> libsemigroups.reporting_enabled();
false

# FroidurePinMemFnRec
gap> FroidurePinMemFnRec(FullTransformationSemigroup(1));
rec( add_generator := function( arg1, arg2 ) ... end,
Expand Down
2 changes: 2 additions & 0 deletions tst/workspaces/load-workspace.tst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

# Set up testing environment
gap> START_TEST("Semigroups package: workspaces/load-workspace.tst");
gap> libsemigroups.reporting_enabled();
false
gap> SEMIGROUPS.StartTest();

#############################################################################
Expand Down
Loading