Skip to content
Snippets Groups Projects
Commit 69b8611e authored by Markus Pfeiffer's avatar Markus Pfeiffer
Browse files

Add export of operations

parent 0a91140f
No related branches found
No related tags found
No related merge requests found
# Load into GAP using Read("gaptypes.g"); and export using # Load into GAP using Read("gaptypes.g"); and export using
# GAPTypesToJson("gap_types.json"); # GAPTypesToJson("gap_types.json");
# Operations
# Families (not necessary)
# Types of Installed Methods ( with filters )
LoadPackage("json"); LoadPackage("json");
LoadPackage("io"); LoadPackage("io");
FindOperationId := function( oper )
local i;
GAPFilterToFilterType := function(fid) if IsOperation(oper) then
if INFO_FILTERS[fid] in FNUM_CATS then for i in [1..Length(OPERATIONS)/2] do
return "GAP_Category"; if OPERATIONS[2*i - 1] = oper then
elif INFO_FILTERS[fid] in FNUM_REPS then return 2*i - 1;
return "GAP_Representation"; fi;
elif INFO_FILTERS[fid] in FNUM_ATTS then od;
return "GAP_Attribute"; return fail;
elif INFO_FILTERS[fid] in FNUM_PROS then
return "GAP_Property";
elif INFO_FILTERS[fid] in FNUM_TPRS then
return "GAP_TrueProperty";
else else
return "GAP_Filter"; Error("not an operation");
fi; fi;
return fail;
end;
FiltersForOperation := function( oper )
local res, res2, filts, opid, fset, flags;
res := [];
opid := FindOperationId(oper);
filts := OPERATIONS[opid + 1];
for fset in filts do
res2 := [];
for flags in fset do
Add(res2, List(TRUES_FLAGS(flags), x -> FILTERS[x]));
od;
Add(res, res2);
od;
return res;
end; end;
GAPAndFilterUnpack := function(t) GAPAndFilterUnpack := function(t)
...@@ -28,7 +50,7 @@ GAPAndFilterUnpack := function(t) ...@@ -28,7 +50,7 @@ GAPAndFilterUnpack := function(t)
if IsOperation(t) then if IsOperation(t) then
if (IsInt(FLAG1_FILTER(t)) and IsInt(FLAG2_FILTER(t))) if (IsInt(FLAG1_FILTER(t)) and IsInt(FLAG2_FILTER(t)))
then then
Add(res, NAME_FUNC(t)); Add(res, NAME_FUNC(t));
else else
Append(res, GAPAndFilterUnpack(FLAG1_FILTER(t))); Append(res, GAPAndFilterUnpack(FLAG1_FILTER(t)));
...@@ -38,6 +60,21 @@ GAPAndFilterUnpack := function(t) ...@@ -38,6 +60,21 @@ GAPAndFilterUnpack := function(t)
return res; return res;
end; end;
GAPFilterToFilterType := function(fid)
if INFO_FILTERS[fid] in FNUM_CATS then
return "GAP_Category";
elif INFO_FILTERS[fid] in FNUM_REPS then
return "GAP_Representation";
elif INFO_FILTERS[fid] in FNUM_ATTS then
return "GAP_Attribute";
elif INFO_FILTERS[fid] in FNUM_PROS then
return "GAP_Property";
elif INFO_FILTERS[fid] in FNUM_TPRS then
return "GAP_TrueProperty";
else
return "GAP_Filter";
fi;
end;
# Make GAP Type graph as a record # Make GAP Type graph as a record
GAPTypesInfo := function() GAPTypesInfo := function()
...@@ -83,9 +120,18 @@ GAPTypesInfo := function() ...@@ -83,9 +120,18 @@ GAPTypesInfo := function()
lres.name := ATTRIBUTES[i][1]; lres.name := ATTRIBUTES[i][1];
Add(res, lres); Add(res, lres);
od; od;
for i in [1..Length(OPERATIONS)/2] do
lres := rec();
lres.type := "GAP_Operation";
lres.name := NAME_FUNC(OPERATIONS[2*i - 1]);
lres.filters := FiltersForOperation(OPERATIONS[2*i - 1]);
lres.filters := List(lres.filters, x->List(x,y -> List(y,NAME_FUNC)));
Add(res, lres);
od;
return res; return res;
end; end;
# Write the graph of type info to JSon file # Write the graph of type info to JSon file
GAPTypesToJson := function(file) GAPTypesToJson := function(file)
local fd, n; local fd, n;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment