diff --git a/src/gap.c b/src/gap.c index 45551159d7..3505055fac 100644 --- a/src/gap.c +++ b/src/gap.c @@ -68,6 +68,17 @@ static Obj Error; static UInt SystemErrorCode; +/**************************************************************************** +** +*V SyLoadSystemInitFile . . . . . . should GAP load 'lib/init.g' at startup +** +** TODO: this variable could be made static or even deleted. However for +** now the GAP.jl Julia package is accessing it, so we have to keep it. +** See also issue #5890 for the reasons behind this. +*/ +Int SyLoadSystemInitFile = 1; + + /**************************************************************************** ** *V Last . . . . . . . . . . . . . . . . . . . . . . global variable 'last' @@ -1527,21 +1538,33 @@ void InitializeGap ( // make command line available to GAP level InitKernelArgs(argc, argv); - // read the init files - // this now actually runs the GAP session, we only get - // past here when we're about to exit. - if ( SyLoadSystemInitFile ) { - GAP_TRY { - if ( READ_GAP_ROOT("lib/init.g") == 0 ) { - Pr( "gap: hmm, I cannot find 'lib/init.g' maybe" - " use option '-l '?\n", 0, 0); + // should GAP load 'lib/init.g' on initialization? + if (SyCompilePlease) { + SyLoadSystemInitFile = 0; + } +#ifdef GAP_ENABLE_SAVELOAD + else if (SyRestoring) { + SyLoadSystemInitFile = 0; + } +#endif + + if (SyLoadSystemInitFile) { + // read the init files + // depending on the command line this now actually runs the GAP + // session, we only get past here when we're about to exit. + GAP_TRY + { + if (READ_GAP_ROOT("lib/init.g") == 0) { + Pr("gap: hmm, I cannot find 'lib/init.g' maybe" + " use option '-l '?\n", + 0, 0); SystemErrorCode = 1; } - } - GAP_CATCH { - Panic("Caught error at top-most level, probably quit from " - "library loading"); - } + } + GAP_CATCH + { + Panic("Caught error at top-most level, probably quit from " + "library loading"); + } } - } diff --git a/src/sysopt.h b/src/sysopt.h index cb04f7a598..87b3972e2b 100644 --- a/src/sysopt.h +++ b/src/sysopt.h @@ -161,6 +161,10 @@ extern UInt SyInitializing; /**************************************************************************** ** *V SyLoadSystemInitFile . . . . . . should GAP load 'lib/init.g' at startup +** +** TODO: this variable could be made static or even deleted. However for +** now the GAP.jl Julia package is accessing it, so we have to keep it. +** See also issue #5890 for the reasons behind this. */ extern Int SyLoadSystemInitFile; diff --git a/src/system.c b/src/system.c index d6210d7dc4..0a98a29402 100644 --- a/src/system.c +++ b/src/system.c @@ -207,13 +207,6 @@ Char * SyRestoring; UInt SyInitializing; -/**************************************************************************** -** -*V SyLoadSystemInitFile . . . . . . should GAP load 'lib/init.g' at startup -*/ -Int SyLoadSystemInitFile = 1; - - /**************************************************************************** ** *V SyUseModule . . . . . . . . . check for static modules in 'READ_GAP_ROOT' @@ -663,16 +656,6 @@ void InitSystem ( syWinPut( 0, "@p", "1." ); } - // should GAP load 'init/lib.g' on initialization - if ( SyCompilePlease ) { - SyLoadSystemInitFile = 0; - } -#ifdef GAP_ENABLE_SAVELOAD - else if ( SyRestoring ) { - SyLoadSystemInitFile = 0; - } -#endif - // the users home directory if ( getenv("HOME") != 0 ) { strxcpy(DotGapPath, getenv("HOME"), sizeof(DotGapPath));