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: Semigroups can be used in GAP on julia #1036

Merged
merged 1 commit into from
Aug 30, 2024
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
2 changes: 2 additions & 0 deletions gapbind14/include/gapbind14/gapbind14.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ namespace gapbind14 {
(Int) detail::to_string(o).c_str());
}

#ifdef GAP_ENABLE_SAVELOAD
void save(Obj o) {
SaveUInt(detail::obj_subtype(o));
}

void load(Obj o) const;
#endif

void free(Obj o) const {
_subtypes.at(detail::obj_subtype(o))->free(o);
Expand Down
12 changes: 9 additions & 3 deletions gapbind14/src/gapbind14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "gapbind14/gap_include.hpp" // for Obj etc

#define GVAR_ENTRY(srcfile, name, nparam, params) \
{ #name, nparam, params, (GVarFunc) name, srcfile ":Func" #name }
{#name, nparam, params, (GVarFunc) name, srcfile ":Func" #name}

namespace gapbind14 {
UInt T_GAPBIND14_OBJ = 0;
Expand Down Expand Up @@ -129,11 +129,13 @@ namespace gapbind14 {
}
return it->second;
}
#ifdef GAP_ENABLE_SAVELOAD
void Module::load(Obj o) const {
gapbind14_subtype sbtyp = LoadUInt();
ADDR_OBJ(o)[0] = reinterpret_cast<Obj>(sbtyp);
ADDR_OBJ(o)[1] = static_cast<Obj>(nullptr);
}
#endif

void Module::finalize() {
for (auto &x : _mem_funcs) {
Expand All @@ -158,13 +160,15 @@ namespace gapbind14 {
module().print(o);
}

#ifdef GAP_ENABLE_SAVELOAD
void TGapBind14ObjSaveFunc(Obj o) {
module().save(o);
}

void TGapBind14ObjLoadFunc(Obj o) {
module().load(o);
}
#endif

Obj TGapBind14ObjCopyFunc(Obj o, Int mut) {
return o;
Expand Down Expand Up @@ -254,8 +258,10 @@ namespace gapbind14 {
PKG_TNUM = RegisterPackageTNUM("TGapBind14", TGapBind14ObjTypeFunc);

PrintObjFuncs[PKG_TNUM] = TGapBind14ObjPrintFunc;
SaveObjFuncs[PKG_TNUM] = TGapBind14ObjSaveFunc;
LoadObjFuncs[PKG_TNUM] = TGapBind14ObjLoadFunc;
#ifdef GAP_ENABLE_SAVELOAD
SaveObjFuncs[PKG_TNUM] = TGapBind14ObjSaveFunc;
LoadObjFuncs[PKG_TNUM] = TGapBind14ObjLoadFunc;
#endif

CopyObjFuncs[PKG_TNUM] = &TGapBind14ObjCopyFunc;
CleanObjFuncs[PKG_TNUM] = &TGapBind14ObjCleanFunc;
Expand Down
8 changes: 8 additions & 0 deletions src/pkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ Obj TBlocksObjTypeFunc(Obj o) {
return TheTypeTBlocksObj;
}

#ifdef GAP_ENABLE_SAVELOAD

void TBipartObjSaveFunc(Obj o) {
Bipartition* b = bipart_get_cpp(o);
SaveUInt4(b->degree());
Expand Down Expand Up @@ -332,6 +334,8 @@ void TBlocksObjLoadFunc(Obj o) {
ADDR_OBJ(o)[0] = reinterpret_cast<Obj>(blocks);
}

#endif

// Filters for IS_BIPART, IS_BLOCKS

Obj IsBipartFilt;
Expand Down Expand Up @@ -500,8 +504,10 @@ static Int InitKernel(StructInitInfo* module) {
CleanObjFuncs[T_BIPART] = &TBipartObjCleanFunc;
IsMutableObjFuncs[T_BIPART] = &AlwaysNo;

#ifdef GAP_ENABLE_SAVELOAD
SaveObjFuncs[T_BIPART] = TBipartObjSaveFunc;
LoadObjFuncs[T_BIPART] = TBipartObjLoadFunc;
#endif

InitMarkFuncBags(T_BIPART, &MarkAllButFirstSubBags);
InitFreeFuncBag(T_BIPART, &TBipartObjFreeFunc);
Expand All @@ -520,8 +526,10 @@ static Int InitKernel(StructInitInfo* module) {
CleanObjFuncs[T_BLOCKS] = &TBlocksObjCleanFunc;
IsMutableObjFuncs[T_BLOCKS] = &AlwaysNo;

#ifdef GAP_ENABLE_SAVELOAD
SaveObjFuncs[T_BLOCKS] = TBlocksObjSaveFunc;
LoadObjFuncs[T_BLOCKS] = TBlocksObjLoadFunc;
#endif

InitMarkFuncBags(T_BLOCKS, &MarkNoSubBags);
InitFreeFuncBag(T_BLOCKS, &TBlocksObjFreeFunc);
Expand Down
Loading