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

kernel: move all refs to SyLoadSystemInitFile to gap.c #5898

Merged
merged 1 commit into from
Jan 8, 2025
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
51 changes: 37 additions & 14 deletions src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
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'
Expand Down Expand Up @@ -1527,21 +1538,33 @@
// 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 <gaproot>'?\n", 0, 0);
// should GAP load 'lib/init.g' on initialization?
if (SyCompilePlease) {
SyLoadSystemInitFile = 0;
}
#ifdef GAP_ENABLE_SAVELOAD
else if (SyRestoring) {
SyLoadSystemInitFile = 0;

Check warning on line 1547 in src/gap.c

View check run for this annotation

Codecov / codecov/patch

src/gap.c#L1547

Added line #L1547 was not covered by tests
}
#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"

Check warning on line 1558 in src/gap.c

View check run for this annotation

Codecov / codecov/patch

src/gap.c#L1558

Added line #L1558 was not covered by tests
" use option '-l <gaproot>'?\n",
0, 0);
SystemErrorCode = 1;
}
}
GAP_CATCH {
Panic("Caught error at top-most level, probably quit from "
"library loading");
}
}
GAP_CATCH

Check warning on line 1564 in src/gap.c

View check run for this annotation

Codecov / codecov/patch

src/gap.c#L1564

Added line #L1564 was not covered by tests
{
Panic("Caught error at top-most level, probably quit from "

Check warning on line 1566 in src/gap.c

View check run for this annotation

Codecov / codecov/patch

src/gap.c#L1566

Added line #L1566 was not covered by tests
"library loading");
}
}

}
4 changes: 4 additions & 0 deletions src/sysopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
17 changes: 0 additions & 17 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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));
Expand Down
Loading