diff --git a/src/libgap-api.c b/src/libgap-api.c index 36dea6e2a0..ab016b6fb7 100644 --- a/src/libgap-api.c +++ b/src/libgap-api.c @@ -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); +} + +Obj GAP_CharWithValue(UChar obj) +{ + return ObjsChar[obj]; +} diff --git a/src/libgap-api.h b/src/libgap-api.h index e08dc41f69..7dba9509a5 100644 --- a/src/libgap-api.h +++ b/src/libgap-api.h @@ -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 . +// If is not a GAP character object, it returns -1. +extern Int GAP_ValueOfChar(Obj obj); + +// Returns the GAP character object with value . +extern Obj GAP_CharWithValue(UChar obj); #endif