Skip to content

Commit

Permalink
Reduce implicit dependencies on GAP packages
Browse files Browse the repository at this point in the history
These changes avoid some direct or indirect access to functionality
provided by GAP packages (namely CTblLib, GAPDoc, SmallGrp).
  • Loading branch information
fingolfin committed Jul 3, 2023
1 parent 72441a3 commit 71dac4e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
12 changes: 9 additions & 3 deletions pkg/JuliaInterface/gap/helpstring.g
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ BindGlobal( "HELP_GET_MATCHES2", function( books, topic, frombegin )
return [exact, match];
end);

BindGlobal( "HELP_SCREEN_WIDTH_LINE", function()
local s;
s := ListWithIdenticalEntries(SizeScreen()[1], "");
return Concatenation(s);
#return RepeatedUTF8String( "─", SizeScreen()[1] );
end );

#############################################################################
##
Expand All @@ -344,7 +350,7 @@ BindGlobal( "HELP_DESC_MATCHES", function( books, topic, frombegin, onlyexact...
if 0 = Length(match) and 0 = Length(exact) then
return [ false, [ "Help: no matching entry found" ] ];
else
sep:= [ "", RepeatedUTF8String( "", SizeScreen()[1] ), "" ];
sep:= [ "", HELP_SCREEN_WIDTH_LINE(), "" ];
HELP_LAST.TOPICS:=[];
# show exact matches first
match := Concatenation(exact, match);
Expand Down Expand Up @@ -569,7 +575,7 @@ InstallGlobalFunction( HELP_String, function( str, onlyexact )
return info;
fi;

sep:= [ "", RepeatedUTF8String( "", SizeScreen()[1] ), "" ];
sep:= [ "", HELP_SCREEN_WIDTH_LINE(), "" ];
lines:= [];
for i in [ 1 .. Length( info.entries ) ] do
Add( lines, Concatenation( info.entries[i][1].bookname, ":" ) );
Expand Down Expand Up @@ -627,7 +633,7 @@ BindGlobal( "ComposedHelpString", function( entry )
desc:= HELP_DESC_MATCH( entry )[2];
Add( lines, Concatenation( entry[1].bookname, ":" ) );
Append( lines, desc );
sep:= [ "", RepeatedUTF8String( "", SizeScreen()[1] ), "" ];
sep:= [ "", HELP_SCREEN_WIDTH_LINE(), "" ];
Append( lines, sep );
res:= "";
if IsBound( entry[1].start ) then
Expand Down
14 changes: 4 additions & 10 deletions src/ccalls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,11 @@ For convenience, one can use the syntax `func(args...; kwargs...)`.
julia> GAP.Globals.Factors( 12 )
GAP: [ 2, 2, 3 ]
julia> g = GAP.Globals.SylowSubgroup( GAP.Globals.SymmetricGroup( 6 ), 2 )
GAP: Group([ (1,2), (3,4), (1,3)(2,4), (5,6) ])
julia> GAP.Globals.StructureDescription( g )
GAP: "C2 x D8"
julia> g = GAP.Globals.SylowSubgroup( GAP.Globals.SymmetricGroup( 6 ), 2 );
julia> GAP.Globals.StructureDescription( g, short = true )
GAP: "2xD8"
julia> GAP.Globals.Cyc(GAP.Obj(1.41421356))
GAP: 35355339/25000000
julia> GAP.Globals.Cyc(GAP.Obj(1.41421356); bits=20)
GAP: E(8)-E(8)^3
```
"""
function call_gap_func(func::GapObj, args...; kwargs...)
Expand Down
8 changes: 5 additions & 3 deletions test/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@
@test occursin("Set the value", string(doc))

# Do tester and setter refer to the right objects?
# (Choose a group `G` whose center is different from the center
# of its derived subgroup.)
@gapattribute cendersub(G::GapObj) = GAP.Globals.Centre(dersub(G))
G = GAP.Globals.SmallGroup(72, 15)
G = GAP.Globals.SymmetricGroup(3)
@test GAP.Globals.Size(GAP.Globals.Centre(G)) == 1
G = GAP.Globals.SmallGroup(72, 15) # create the group anew
G = GAP.Globals.SymmetricGroup(3) # create the group anew
@test ! GAP.Globals.HasCentre(G)
@test ! has_dersub(G)
@test ! has_cendersub(G)
@test has_dersub(G) # the previous call has set the value
ggens = GAP.Globals.GeneratorsOfGroup(G)
set_cendersub(G, GAP.Globals.Subgroup(G, GAP.GapObj([ggens[3]])))
set_cendersub(G, GAP.Globals.Subgroup(G, GAP.GapObj([ggens[1]])))
@test has_cendersub(G)
@test GAP.Globals.HasCentre(GAP.Globals.DerivedSubgroup(G))
@test GAP.Globals.Size(GAP.Globals.Centre(G)) == 1
Expand Down
2 changes: 1 addition & 1 deletion test/packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Load packages via their local paths.
# - a package that was already loaded, with the same path
path = string(GAP.Globals.GAPInfo.PackagesLoaded.ctbllib[1])
path = string(GAP.Globals.GAPInfo.PackagesLoaded.juliainterface[1])
@test GAP.Packages.load(path)

# - a package that was already loaded, with another installation path
Expand Down

0 comments on commit 71dac4e

Please sign in to comment.