more cleaning
This commit is contained in:
55
cstdlib/ctype.c
Normal file
55
cstdlib/ctype.c
Normal file
@@ -0,0 +1,55 @@
|
||||
int
|
||||
isblank(int c){
|
||||
return c == '\t'
|
||||
|| c == ' ';
|
||||
}
|
||||
|
||||
int
|
||||
isspace(int c){
|
||||
return isblank(c)
|
||||
|| c == '\n'
|
||||
|| c == '\v'
|
||||
|| c == '\f'
|
||||
|| c == '\r';
|
||||
}
|
||||
|
||||
int
|
||||
isgraph(int c){ return c >= '!' && c <= '~'; }
|
||||
|
||||
int
|
||||
isprint(int c){ return c == ' ' || isgraph(c); }
|
||||
|
||||
int
|
||||
iscntrl(int c){ return !isprint(c); }
|
||||
|
||||
int
|
||||
isdigit(int c){ return c >= '0' && c <= '9'; }
|
||||
|
||||
int
|
||||
islower(int c){ return c >= 'a' && c <= 'z'; }
|
||||
|
||||
int
|
||||
isupper(int c){ return c >= 'A' && c <= 'Z'; }
|
||||
|
||||
int
|
||||
isxdigit(int c){
|
||||
return
|
||||
isdigit(c)
|
||||
|| (c >= 'a' && c <= 'f')
|
||||
|| (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
int
|
||||
isalpha(int c){ return islower(c) || isupper(c); }
|
||||
|
||||
int
|
||||
isalnum(int c){ return isalpha(c) || isdigit(c) };
|
||||
|
||||
int
|
||||
ispunct(int c){ return c != ' ' && !isalnum(c) };
|
||||
|
||||
int
|
||||
tolower(int c){ return c - isupper(c) * ('A' - 'a'); }
|
||||
|
||||
int
|
||||
toupper(int c){ return c + islower(c) * ('A' - 'a'); }
|
||||
17
cstdlib/ctype.h
Normal file
17
cstdlib/ctype.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _CTYPE_H
|
||||
# define CTYPE_H
|
||||
int isblank(int c);
|
||||
int isspace(int c);
|
||||
int isgraph(int c);
|
||||
int isprint(int c);
|
||||
int iscntrl(int c);
|
||||
int isdigit(int c);
|
||||
int islower(int c);
|
||||
int isupper(int c);
|
||||
int isxdigit(int c);
|
||||
int isalpha(int c);
|
||||
int isalnum(int c);
|
||||
int ispunct(int c);
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
#endif /* ifndef _CTYPE_H */
|
||||
Reference in New Issue
Block a user