From 8473609fae6d2505ce98b9efed7e54576a3ace8b Mon Sep 17 00:00:00 2001 From: "James D. Mitchell" Date: Fri, 30 Aug 2024 16:05:12 +0100 Subject: [PATCH] kernel: Semigroups can be used in GAP on julia --- gapbind14/include/gapbind14/gapbind14.hpp | 2 ++ gapbind14/src/gapbind14.cpp | 12 +++++++++--- src/pkg.cpp | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gapbind14/include/gapbind14/gapbind14.hpp b/gapbind14/include/gapbind14/gapbind14.hpp index 86200ea3c..bbb7a37b2 100644 --- a/gapbind14/include/gapbind14/gapbind14.hpp +++ b/gapbind14/include/gapbind14/gapbind14.hpp @@ -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); diff --git a/gapbind14/src/gapbind14.cpp b/gapbind14/src/gapbind14.cpp index 8a3644543..16e873fb7 100644 --- a/gapbind14/src/gapbind14.cpp +++ b/gapbind14/src/gapbind14.cpp @@ -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; @@ -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(sbtyp); ADDR_OBJ(o)[1] = static_cast(nullptr); } +#endif void Module::finalize() { for (auto &x : _mem_funcs) { @@ -158,6 +160,7 @@ namespace gapbind14 { module().print(o); } +#ifdef GAP_ENABLE_SAVELOAD void TGapBind14ObjSaveFunc(Obj o) { module().save(o); } @@ -165,6 +168,7 @@ namespace gapbind14 { void TGapBind14ObjLoadFunc(Obj o) { module().load(o); } +#endif Obj TGapBind14ObjCopyFunc(Obj o, Int mut) { return o; @@ -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; diff --git a/src/pkg.cpp b/src/pkg.cpp index 8b0c8fc3f..ae8317854 100644 --- a/src/pkg.cpp +++ b/src/pkg.cpp @@ -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()); @@ -332,6 +334,8 @@ void TBlocksObjLoadFunc(Obj o) { ADDR_OBJ(o)[0] = reinterpret_cast(blocks); } +#endif + // Filters for IS_BIPART, IS_BLOCKS Obj IsBipartFilt; @@ -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); @@ -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);