diff --git a/doc/ref/debug.xml b/doc/ref/debug.xml
index 24f05ece488..ee5c830fc25 100644
--- a/doc/ref/debug.xml
+++ b/doc/ref/debug.xml
@@ -106,6 +106,8 @@ algorithms for the computation of a subgroup lattice.
Note that not all info classes defined in the ⪆ library are currently
documented. Many ⪆ packages define additional info classes, which are
typically documented in the corresponding package documentation.
+The function will show all info classes which
+a GAP considers during execution.
The amount of information to be displayed by each info class can be separately
specified by the user. This is done by selecting a non-negative integer
@@ -158,6 +160,35 @@ returns the info level of infoclass.
+
+
+
+
+Called with argument true, makes GAP print the InfoClass and level of
+ any executed Info statement. Call with the argument false stops this
+ printing.
+
+Each level of each InfoClass is only printed once. The list of printed
+InfoClasses and levels is reset whenever true is passed.
+
+
+ ShowUsedInfoClasses(true);
+gap> Intersection(Group((1,3,2,4,5,6)), Group((1,2,3,4,5,6)));
+#I Would print info with SetInfoLevel(InfoOptions,1)
+#I Would print info with SetInfoLevel(InfoBckt,1)
+#I Would print info with SetInfoLevel(InfoBckt,3)
+#I Would print info with SetInfoLevel(InfoBckt,5)
+Group(())
+gap> Intersection(Group((1,3,2,4,5,6)), Group((1,2,3,4,5,6)));
+Group(())
+gap> ShowUsedInfoClasses(false);
+]]>
+
+
+
+
+
diff --git a/lib/info.gd b/lib/info.gd
index 54d90422795..940daadaf1f 100644
--- a/lib/info.gd
+++ b/lib/info.gd
@@ -131,6 +131,8 @@ DeclareOperation("InfoLevel", [IsInfoClass]);
DeclareGlobalFunction("SetInfoHandler");
DeclareGlobalFunction("DefaultInfoHandler");
+
+
#############################################################################
##
##
diff --git a/lib/info.gi b/lib/info.gi
index d7349d62702..c5e592a1f39 100644
--- a/lib/info.gi
+++ b/lib/info.gi
@@ -314,6 +314,33 @@ BIND_GLOBAL( "InfoDecision", function(selectors, level)
return ret;
end );
+SHOWN_USED_INFO_CLASSES := [];
+
+if IsHPCGAP then
+ ShareInternalObj(INFO_CLASSES);
+fi;
+
+
+BIND_GLOBAL("RESET_SHOW_USED_INFO_CLASSES", function()
+ atomic readwrite SHOWN_USED_INFO_CLASSES do
+ SHOWN_USED_INFO_CLASSES := [];
+ od;
+end);
+
+BIND_GLOBAL("SHOW_USED_INFO_CLASSES", function(selectors, level)
+ local selector;
+ # Handle selectors possibly being a list
+ selectors := Flat([selectors]);
+ atomic readwrite SHOWN_USED_INFO_CLASSES do
+ for selector in selectors do
+ if not [selector, level] in SHOWN_USED_INFO_CLASSES then
+ Add(SHOWN_USED_INFO_CLASSES, [selector, level]);
+ Print("#I Would print info with SetInfoLevel(",
+ selector, ",", level, ")\n");
+ fi;
+ od;
+ od;
+end);
#############################################################################
##
@@ -436,3 +463,4 @@ end);
##
DeclareInfoClass( "InfoObsolete" );
SetInfoLevel(InfoObsolete,1);
+
diff --git a/src/gapstate.h b/src/gapstate.h
index 3b42ec6b820..0aa469b384e 100644
--- a/src/gapstate.h
+++ b/src/gapstate.h
@@ -104,6 +104,9 @@ typedef struct GAPState {
Int PrintObjIndex;
Int PrintObjDepth;
+ /* From info.c */
+ Int ShowUsedInfoClassesActive;
+
UInt1 StateSlots[STATE_SLOTS_SIZE];
/* Allocation */
diff --git a/src/info.c b/src/info.c
index 7834250cb23..2051a0d04ea 100644
--- a/src/info.c
+++ b/src/info.c
@@ -15,6 +15,8 @@
#include "bool.h"
#include "calls.h"
+#include "error.h"
+#include "gapstate.h"
#include "gvars.h"
#include "modules.h"
#include "plist.h"
@@ -34,6 +36,24 @@ enum {
static Obj InfoDecision;
static Obj IsInfoClassListRep;
static Obj DefaultInfoHandler;
+static Obj ResetShowUsedInfoClassesHandler;
+static Obj ShowUsedInfoClassesHandler;
+
+
+Obj FuncShowUsedInfoClasses(Obj self, Obj choice)
+{
+ if(choice == True) {
+ STATE(ShowUsedInfoClassesActive) = 1;
+ CALL_0ARGS(ResetShowUsedInfoClassesHandler);
+ }
+ else if(choice == False) {
+ STATE(ShowUsedInfoClassesActive) = 0;
+ }
+ else {
+ ErrorMayQuit(" should be true or false", 0, 0);
+ }
+ return 0;
+}
void InfoDoPrint(Obj cls, Obj lvl, Obj args)
{
@@ -53,6 +73,9 @@ void InfoDoPrint(Obj cls, Obj lvl, Obj args)
Obj InfoCheckLevel(Obj selectors, Obj level)
{
+ if(STATE(ShowUsedInfoClassesActive)) {
+ CALL_2ARGS(ShowUsedInfoClassesHandler, selectors, level);
+ }
// Fast-path the most common failing case.
// The fast-path only deals with the case where all arguments are of the
// correct type, and were False is returned.
@@ -77,6 +100,15 @@ Obj InfoCheckLevel(Obj selectors, Obj level)
*F * * * * * * * * * * * * * initialize module * * * * * * * * * * * * * * *
*/
+/****************************************************************************
+**
+*V GVarFuncs . . . . . . . . . . . . . . . . . . list of functions to export
+*/
+static StructGVarFunc GVarFuncs[] = {
+ GVAR_FUNC(ShowUsedInfoClasses, 1, "choice"),
+ { 0, 0, 0, 0, 0 }
+};
+
/****************************************************************************
**
@@ -85,10 +117,17 @@ Obj InfoCheckLevel(Obj selectors, Obj level)
static Int InitKernel (
StructInitInfo * module )
{
+ /* init filters and functions */
+ InitHdlrFuncsFromTable( GVarFuncs );
+
/* The work of handling Info messages is delegated to the GAP level */
ImportFuncFromLibrary("InfoDecision", &InfoDecision);
ImportFuncFromLibrary("DefaultInfoHandler", &DefaultInfoHandler);
ImportFuncFromLibrary("IsInfoClassListRep", &IsInfoClassListRep);
+ ImportFuncFromLibrary("RESET_SHOW_USED_INFO_CLASSES",
+ &ResetShowUsedInfoClassesHandler);
+ ImportFuncFromLibrary("SHOW_USED_INFO_CLASSES",
+ &ShowUsedInfoClassesHandler);
/* return success */
return 0;
@@ -102,6 +141,9 @@ static Int InitKernel (
static Int InitLibrary (
StructInitInfo * module )
{
+
+ InitGVarFuncsFromTable( GVarFuncs );
+
ExportAsConstantGVar(INFODATA_CURRENTLEVEL);
ExportAsConstantGVar(INFODATA_CLASSNAME);
ExportAsConstantGVar(INFODATA_HANDLER);
diff --git a/tst/testinstall/info.tst b/tst/testinstall/info.tst
index d62f65acf75..461550bc382 100644
--- a/tst/testinstall/info.tst
+++ b/tst/testinstall/info.tst
@@ -53,6 +53,20 @@ gap> Info(InfoTest1 + InfoTest2, 0);
Error, level 0 Info messages are not allowed
gap> Info(InfoTest1 + InfoTest2, "apple");
Error, usage : Info(, , ...)
+gap> ShowUsedInfoClasses(true);
+gap> Info(InfoTest2, 2, "apple");
+#I Would print info with SetInfoLevel(InfoTest2,2)
+#I Would print info with SetInfoLevel(InfoGlobal,3)
+#I apple
+gap> Info(InfoTest1 + InfoTest2, 2, "apple");
+#I Would print info with SetInfoLevel(InfoTest1,2)
+#I apple
+gap> Info(InfoTest1 + InfoTest2, 2, "apple");
+#I apple
+gap> Info(InfoTest1 + InfoTest2, 3, "apple");
+#I Would print info with SetInfoLevel(InfoTest1,3)
+#I Would print info with SetInfoLevel(InfoTest2,3)
+gap> ShowUsedInfoClasses(false);
gap> str := "";;
gap> str2 := "";;
gap> SetDefaultInfoOutput(OutputTextString(str, false));