Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DEBUG_LOADING, InfoRead1, and InfoRead2 #2237

Merged
merged 3 commits into from
Nov 14, 2018
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
25 changes: 14 additions & 11 deletions lib/files.gi
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,24 @@ InstallMethod( Read,
"string",
[ IsString ],
function ( name )
local readIndent, found;
local readIndent;

name := UserHomeExpand(name);

readIndent := SHALLOW_COPY_OBJ( READ_INDENT );
APPEND_LIST_INTR( READ_INDENT, " " );
InfoRead1( "#I", READ_INDENT, "Read( \"", name, "\" )\n" );
found := (IsReadableFile(name)=true) and READ(name);
READ_INDENT := readIndent;
if found and READ_INDENT = "" then
InfoRead1( "#I Read( \"", name, "\" ) done\n" );
if GAPInfo.CommandLineOptions.D then
readIndent := SHALLOW_COPY_OBJ( READ_INDENT );
APPEND_LIST_INTR( READ_INDENT, " " );
Print( "#I", READ_INDENT, "Read( \"", name, "\" )\n" );
fi;
if not found then

if not READ(UserHomeExpand(name)) then
Error( "file \"", name, "\" must exist and be readable" );
fi;

if GAPInfo.CommandLineOptions.D then
READ_INDENT := readIndent;
if READ_INDENT = "" then
Print( "#I Read( \"", name, "\" ) done\n" );
fi;
fi;
end );


Expand Down
22 changes: 3 additions & 19 deletions lib/init.g
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,6 @@ ReplacedString := function ( arg )
end;


#############################################################################
##
#V InfoRead? . . . . . . . . . . . . . . . . . . . . print what file is read
##
if DEBUG_LOADING then InfoRead1 := Print; fi;
if not IsBound(InfoRead1) then InfoRead1 := Ignore; fi;
if not IsBound(InfoRead2) then InfoRead2 := Ignore; fi;


#############################################################################
##
#V CHECK_INSTALL_METHOD . . . . . . check requirements in `INSTALL_METHOD'
Expand Down Expand Up @@ -234,20 +225,11 @@ fi;

#############################################################################
##
## - Unbind `DEBUG_LOADING', since later the `-D' option can be checked.
## - Set or disable break loop according to the `-T' option.
## - Set whether traceback may be suppressed (e.g. by `-T') according to the
## `--alwaystrace' option.
##
CallAndInstallPostRestore( function()
if DEBUG_LOADING then
InfoRead1:= Print;
else
InfoRead1:= Ignore;
fi;
MAKE_READ_WRITE_GLOBAL( "DEBUG_LOADING" );
UNBIND_GLOBAL( "DEBUG_LOADING" );

if IsHPCGAP then
# In HPC-GAP we want to decide how to handle errors on a per thread
# basis. E.g. the break loop can be disabled in a worker thread that
Expand All @@ -269,7 +251,9 @@ CallAndInstallPostRestore( function()
end);

ReadOrComplete := function(name)
InfoRead1( "#I reading ", name, "\n" );
if GAPInfo.CommandLineOptions.D then
Print( "#I reading ", name, "\n" );
fi;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly thought "hmm, why not introduce an InfoRead info class, and use that here, as Info(InfoRead, 1, "reading ", name"); but I suppose the answer for that is that at this point, we are still far away from loading lib/info.gi, so we can't really use Info yet. OK.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried introducing an InfoClass for this purpose, but as you say the infrastructure is not initialised when we'd want to use it.

One could (independently of this PR) try moving the info infrastructure as early as possible in startup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine to leave this with a Print statement, but perhaps add a comment like

We cannot use Info yet, because info.gi has not yet been read

if not READ_GAP_ROOT( name ) then
Error( "cannot read file ", name );
fi;
Expand Down
12 changes: 11 additions & 1 deletion lib/obsolete.gd
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ DeclareObsoleteSynonym( "ReadPkg", "ReadPackage" );
#BindGlobal( "VERSION", GAPInfo.Version );
BindGlobal( "GAP_ARCHITECTURE", GAPInfo.Architecture );
#BindGlobal( "GAP_ROOT_PATHS", GAPInfo.RootPaths );
BindGlobal( "DEBUG_LOADING", GAPInfo.CommandLineOptions.D );
BindGlobal( "BANNER", not GAPInfo.CommandLineOptions.b );
BindGlobal( "QUIET", GAPInfo.CommandLineOptions.q );
#BindGlobal( "LOADED_PACKAGES", GAPInfo.PackagesLoaded );
Expand Down Expand Up @@ -682,6 +681,17 @@ DeclareObsoleteSynonym( "RecFields", "RecNames" );
## Not used in any redistributed package (11/2018)
#DeclareObsoleteSynonym( "SHALLOW_SIZE", "SIZE_OBJ" );


#############################################################################
##
#V InfoRead?
##
## InfoRead used to be used to print when a file is read using `Read()`
##
if GAPInfo.CommandLineOptions.D then InfoRead1 := Print; fi;
if not IsBound(InfoRead1) then InfoRead1 := Ignore; fi;
if not IsBound(InfoRead2) then InfoRead2 := Ignore; fi;

#############################################################################
##
#E
5 changes: 0 additions & 5 deletions lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,6 @@ CallAndInstallPostRestore( function()
GAPInfo.CommandLineOptions:= CommandLineOptions;
GAPInfo.InitFiles:= InitFiles;

# Switch on debugging (`-D' option) when GAP is started with a workspace.
if GAPInfo.CommandLineOptions.D then
InfoRead1:= Print;
fi;

padspace := function(strlen, len)
local i;
for i in [strlen+1..len] do
Expand Down
8 changes: 0 additions & 8 deletions src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1635,14 +1635,6 @@ static Int InitKernel (
static Int PostRestore (
StructInitInfo * module )
{
UInt var;

/* library name and other stuff */
var = GVarName( "DEBUG_LOADING" );
MakeReadWriteGVar(var);
AssGVar( var, (SyDebugLoading ? True : False) );
MakeReadOnlyGVar(var);

/* construct the `ViewObj' variable */
ViewObjGVar = GVarName( "ViewObj" );

Expand Down