From abe6c4db686bf67e35eb393a83794342e1051273 Mon Sep 17 00:00:00 2001 From: Markus Pfeiffer Date: Tue, 21 Aug 2018 15:41:58 +0100 Subject: [PATCH 1/2] Introduce command line options --norepl and --nointeract to disable GAP shell * --norepl just disables the read-evaluate-print-loop, so GAP can still go into a break loop * --nointeract disables both the repl and the break loop --- lib/system.g | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/system.g b/lib/system.g index 7961f01746..df24746af2 100644 --- a/lib/system.g +++ b/lib/system.g @@ -111,7 +111,11 @@ BIND_GLOBAL( "GAPInfo", rec( help := [ "Run ProfileLineByLine() with recordMem := true on GAP start"] ), rec( long := "cover", default := "", arg := "", help := [ "Run CoverageLineByLine() on GAP start"] ), - rec( long := "enableMemCheck", default := false) + rec( long := "enableMemCheck", default := false), + rec( long := "norepl", default := false, + help := [ "Disable the GAP read-evaluate-print loop (REPL)" ] ), + rec( long := "nointeract", default := false, + help := [ "Start GAP in non-interactive mode (disable read-evaluate-print loop (REPL) and break loop)" ] ) ], ) ); @@ -377,6 +381,13 @@ CallAndInstallPostRestore( function() CommandLineOptions.g:= CommandLineOptions.g mod 3; # use the same as the kernel CommandLineOptions.E:= GAPInfo.KernelInfo.HAVE_LIBREADLINE; + + # --nointeract implies no break loop and no repl + if CommandLineOptions.nointeract then + CommandLineOptions.T := true; + CommandLineOptions.norepl := true; + fi; + MakeImmutable( CommandLineOptions ); MakeImmutable( InitFiles ); From 5857c9720d09d082b5c90ccb6d6c258d06c0d836 Mon Sep 17 00:00:00 2001 From: Markus Pfeiffer Date: Tue, 21 Aug 2018 15:42:33 +0100 Subject: [PATCH 2/2] Remove IsLIBGAP constant The presence of the `--norepl` command line option makes the `IsLIBGAP` constant obsolete, so we remove it. --- lib/init.g | 15 +++------------ tst/testinstall/IsLIBGAP.tst | 11 ----------- 2 files changed, 3 insertions(+), 23 deletions(-) delete mode 100644 tst/testinstall/IsLIBGAP.tst diff --git a/lib/init.g b/lib/init.g index bb5f570b20..ecbb1ed552 100644 --- a/lib/init.g +++ b/lib/init.g @@ -938,16 +938,6 @@ BindGlobal ("ShowSystemInformation", function () 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. -## -if not IsBound( IsLIBGAP ) then - BIND_CONSTANT( "IsLIBGAP", false ); -fi; - ############################################################################# ## ## Finally, deal with the lists of global variables. @@ -1037,8 +1027,9 @@ InstallAndCallPostRestore( function() od; end ); -if IsLIBGAP then - # GAP is used as a library, do not start an interactive session + +if GAPInfo.CommandLineOptions.norepl then + # do not start an interactive session elif IsHPCGAP and THREAD_UI() then ReadLib("hpc/consoleui.g"); MULTI_SESSION(); diff --git a/tst/testinstall/IsLIBGAP.tst b/tst/testinstall/IsLIBGAP.tst deleted file mode 100644 index a728214a11..0000000000 --- a/tst/testinstall/IsLIBGAP.tst +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################# -## -#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);