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

Added functions GetChar and CharValue to libgap api #2999

Merged
merged 2 commits into from
Nov 15, 2018
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
13 changes: 13 additions & 0 deletions src/libgap-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,16 @@ char * GAP_CSTR_STRING(Obj string)
return 0;
return CSTR_STRING(string);
}

Int GAP_ValueOfChar(Obj obj)
{
if (TNUM_OBJ(obj) != T_CHAR) {
return -1;
}
return (Int)CHAR_VALUE(obj);
}
fingolfin marked this conversation as resolved.
Show resolved Hide resolved

Obj GAP_CharWithValue(UChar obj)
{
return ObjsChar[obj];
}
6 changes: 6 additions & 0 deletions src/libgap-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,11 @@ extern Obj GAP_MakeString(const char * string);
// terminated C string.
extern Obj GAP_MakeImmString(const char * string);

// Returns the value of the GAP character object <obj>.
// If <obj> is not a GAP character object, it returns -1.
extern Int GAP_ValueOfChar(Obj obj);

// Returns the GAP character object with value <obj>.
extern Obj GAP_CharWithValue(UChar obj);

#endif