Skip to content

Commit

Permalink
suppress the GAP banner when importing GAP.jl
Browse files Browse the repository at this point in the history
This pull request addresses issue oscar-system#334.

- By default, `using GAP` will not show the banner.
- If Julia's `ENV[ "GAP_SHOW_BANNER" ]` is set to `"true"` then
  the GAP banner is shown on `using GAP`.
- When the user loads GAP packages, it depends on the `LoadPackage` call
  whether a package banner is shown.
  This is the standard GAP behaviour in the situation that banners are
  in principle enabled:
  If there is a second argument `false` then the banner is not shown,
  otherwise it is shown.

(The idea is to set the command line option `-b` when GAP shall be started
without banner, and to reset this option after the start of GAP.)

I think we should wait until issue oscar-system#333 gets resolved
before switching off the GAP banner by default.
  • Loading branch information
ThomasBreuer committed Mar 11, 2020
1 parent 0f068b2 commit 4494321
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/GAP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ function run_it(gapdir::String, error_handler_func::Ptr{Nothing})
end
sysinfo = read_sysinfo_gap(gapdir)
gaproots = abspath(joinpath(@__DIR__, "..")) * ";" * sysinfo["GAP_LIB_DIR"]
initialize( gapdir, [ ""
cmdline_options = [ ""
, "-l", gaproots
, "-T", "-A", "--nointeract"
, "-m", "1000m" ], [""], error_handler_func )
, "-m", "1000m" ]
if get( ENV, "GAP_SHOW_BANNER", "false" ) != "true"
# Do not show the main GAP banner by default.
push!( cmdline_options, "-b" )
end
initialize( gapdir, cmdline_options, [""], error_handler_func )
gap_is_initialized = true
end

Expand Down Expand Up @@ -162,6 +167,18 @@ function __init__()
Base.MainInclude.eval(:(
(func::$MPtr)(args...; kwargs...) = $(GAP.call_gap_func)(func, args...; kwargs...)
))

if ! haskey( ENV, "GAP_SHOW_BANNER" ) || ENV[ "GAP_SHOW_BANNER" ] != "true"
# Show package banners by default when LoadPackage is called.
Base.MainInclude.eval(:(
begin
record = $gap_module.Globals.GAPInfo
record.CommandLineOptions = $gap_module.Globals.ShallowCopy( record.CommandLineOptions )
record.CommandLineOptions.b = false
$gap_module.Globals.MakeImmutable( record.CommandLineOptions )
end
))
end
end

include( "ccalls.jl" )
Expand Down

0 comments on commit 4494321

Please sign in to comment.