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
# GAPTypesToJson("gap_types.json");
# Operations
# Families (not necessary)
# Types of Installed Methods ( with filters )
LoadPackage("json");
LoadPackage("io");
FindOperationId := function( oper )
local i;
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";
if IsOperation(oper) then
for i in [1..Length(OPERATIONS)/2] do
if OPERATIONS[2*i - 1] = oper then
return 2*i - 1;
fi;
od;
return fail;
else
return "GAP_Filter";
Error("not an operation");
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;
GAPAndFilterUnpack := function(t)
......@@ -28,7 +50,7 @@ GAPAndFilterUnpack := function(t)
if IsOperation(t) then
if (IsInt(FLAG1_FILTER(t)) and IsInt(FLAG2_FILTER(t)))
then
then
Add(res, NAME_FUNC(t));
else
Append(res, GAPAndFilterUnpack(FLAG1_FILTER(t)));
......@@ -38,6 +60,21 @@ GAPAndFilterUnpack := function(t)
return res;
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
GAPTypesInfo := function()
......@@ -83,9 +120,18 @@ GAPTypesInfo := function()
lres.name := ATTRIBUTES[i][1];
Add(res, lres);
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;
end;
# Write the graph of type info to JSon file
GAPTypesToJson := function(file)
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