Skip to content

Commit

Permalink
Added IsLIBGAP constant
Browse files Browse the repository at this point in the history
This constant can be set to true in the initialize_libgap function (future work)
to stop GAP from starting an interactive session
  • Loading branch information
sebasguts committed Jun 11, 2018
1 parent 8f47553 commit 863c24b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/init.g
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,18 @@ BindGlobal ("ShowSystemInformation", function ()
ShowPackageInformation();
end );


#############################################################################
##
## Initialize the IsLIBGAP variable (if not done before). If this variable
## is false, an interactive session will be started.
## Otherwise no interactive session is started.
## This should be done before the system GVAR list is created.
##
if not IsBound( IsLIBGAP ) then
BIND_CONSTANT( "IsLIBGAP", false );
fi;

#############################################################################
##
## Finally, deal with the lists of global variables.
Expand Down Expand Up @@ -1016,7 +1028,9 @@ InstallAndCallPostRestore( function()
od;
end );

if IsHPCGAP and THREAD_UI() then
if IsLIBGAP then
# GAP is used as a library, do not start an interactive session
elif IsHPCGAP and THREAD_UI() then
ReadLib("hpc/consoleui.g");
MULTI_SESSION();
else
Expand Down
12 changes: 12 additions & 0 deletions tst/testinstall/IsLIBGAP.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#############################################################################
##
#W IsLIBGAP.tst GAP library Sebastian Gutsche
##
##
#Y Copyright (C) 2018, GAP Group
##
gap> START_TEST("IsLIBGAP.tst");
gap> IsBound( IsLIBGAP );
true
gap> STOP_TEST( "IsLIBGAP.tst", 1);

0 comments on commit 863c24b

Please sign in to comment.