Skip to content

Commit

Permalink
Use GAP kernel helper IS_STRING_REP to test for strings
Browse files Browse the repository at this point in the history
There are actually six TNUMs indicating strings.
  • Loading branch information
fingolfin committed Nov 7, 2024
1 parent 265de04 commit c69be74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gapbind14/include/gapbind14/to_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace gapbind14 {
static gap_tnum_type constexpr gap_type = T_STRING;

std::string operator()(Obj o) const {
if (TNUM_OBJ(o) != T_STRING) {
if (!IS_STRING_REP(o)) {
throw std::runtime_error(std::string("expected string, found ")
+ TNAM_OBJ(o));
}
Expand Down
4 changes: 2 additions & 2 deletions src/to_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ namespace gapbind14 {
static gap_tnum_type constexpr gap_type = T_STRING;

cpp_type operator()(Obj o) const {
if (TNUM_OBJ(o) != T_STRING && TNUM_OBJ(o) != T_STRING + IMMUTABLE) {
if (!IS_STRING_REP(o)) {
ErrorQuit("expected string but got %s!", (Int) TNAM_OBJ(o), 0L);
}
std::string stype = std::string(CSTR_STRING(o));
Expand All @@ -409,7 +409,7 @@ namespace gapbind14 {
using cpp_type = libsemigroups::Congruence::options::runners;

cpp_type operator()(Obj o) const {
if (TNUM_OBJ(o) != T_STRING && TNUM_OBJ(o) != T_STRING + IMMUTABLE) {
if (!IS_STRING_REP(o)) {
ErrorQuit("expected string but got %s!", (Int) TNAM_OBJ(o), 0L);
}
std::string stype = std::string(CSTR_STRING(o));
Expand Down

0 comments on commit c69be74

Please sign in to comment.