From 105a1b94bd9d5a0f10752e135671f4e9a4b0d8da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 17 May 2019 13:51:43 -1000 Subject: GLK: TADS2: Added code for output, run, various miscellaneous --- common/util.cpp | 6 ++++++ common/util.h | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'common') diff --git a/common/util.cpp b/common/util.cpp index 62a1baf6ac..a6c7958a0d 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -23,6 +23,7 @@ #define FORBIDDEN_SYMBOL_EXCEPTION_isalnum #define FORBIDDEN_SYMBOL_EXCEPTION_isalpha #define FORBIDDEN_SYMBOL_EXCEPTION_isdigit +#define FORBIDDEN_SYMBOL_EXCEPTION_isxdigit #define FORBIDDEN_SYMBOL_EXCEPTION_isnumber #define FORBIDDEN_SYMBOL_EXCEPTION_islower #define FORBIDDEN_SYMBOL_EXCEPTION_isspace @@ -132,6 +133,11 @@ bool isDigit(int c) { return isdigit((byte)c); } +bool isXDigit(int c) { + ENSURE_ASCII_CHAR(c); + return isxdigit((byte)c); +} + bool isLower(int c) { ENSURE_ASCII_CHAR(c); return islower((byte)c); diff --git a/common/util.h b/common/util.h index 77d7523034..5f853da43a 100644 --- a/common/util.h +++ b/common/util.h @@ -141,6 +141,16 @@ bool isAlpha(int c); */ bool isDigit(int c); +/** + * Test whether the given character is a hwzadecimal-digit (0-9 or A-F). + * If the parameter is outside the range of a signed or unsigned char, then + * false is returned. + * + * @param c the character to test + * @return true if the character is a hexadecimal-digit, false otherwise. + */ +bool isXDigit(int c); + /** * Test whether the given character is a lower-case letter (a-z). * If the parameter is outside the range of a signed or unsigned char, then -- cgit v1.2.3