From 0972e8025742a9d0227cf2be5ba7c79307e7c04f Mon Sep 17 00:00:00 2001 From: NeGate Date: Thu, 2 Jun 2022 19:57:14 -0400 Subject: [PATCH] formatting --- code/ctype.c | 51 +++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/code/ctype.c b/code/ctype.c index 1d8bffe..0f58474 100644 --- a/code/ctype.c +++ b/code/ctype.c @@ -7,86 +7,69 @@ #define in_range(low, v, high) ((low <= v) && (v <= high)) -int isalnum(int c) -{ +int isalnum(int c) { return isalpha(c) || isdigit(c); } -int isalpha(int c) -{ +int isalpha(int c) { return islower(c) || isupper(c); } -int isblank(int c) -{ +int isblank(int c) { return c == ' ' || c == '\t'; } -int iscntrl(int c) -{ +int iscntrl(int c) { return in_range('\x00', c, '\x1f') || c == '\x7f'; } -int isdigit(int c) -{ +int isdigit(int c) { return in_range('0', c, '9'); } -int isgraph(int c) -{ +int isgraph(int c) { return isprint(c) && (c != ' '); } -int islower(int c) -{ +int islower(int c) { return in_range('a', c, 'z'); } -int isprint(int c) -{ +int isprint(int c) { return in_range(' ', c, '\x7e'); } -int ispunct(int c) -{ +int ispunct(int c) { return in_range('\x21', c, '\x2f') || in_range('\x3a', c, '\x40') || in_range('\x5b', c, '\x60') || in_range('\x7b', c, '\x7e'); } -int isspace(int c) -{ - return in_range('\x09', c, '\x0d') - || c == ' '; +int isspace(int c) { + return in_range('\x09', c, '\x0d') || c == ' '; } -int isupper(int c) -{ +int isupper(int c) { return in_range('A', c, 'Z'); } -int isxdigit(int c) -{ +int isxdigit(int c) { return in_range('0', c, '9') || in_range('a', c, 'f') || in_range('A', c, 'F'); } -int tolower(int c) -{ +int tolower(int c) { if(isupper(c)) { return c-'A'+'a'; } - else return c; + return c; } -int toupper(int c) -{ +int toupper(int c) { if(islower(c)) { return c-'a'+'A'; } - else return c; + return c; } - -