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

Use GAP kernel helper IS_STRING_REP to test for strings #1045

Merged
merged 2 commits into from
Nov 8, 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: 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
Loading