kern

diff src/klibc/ctype.c @ 2:86781ef20689

added hardware scrolling, memset16 and temporary keyboard input for testing
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 04 Dec 2010 08:04:43 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/klibc/ctype.c	Sat Dec 04 08:04:43 2010 +0200
     1.3 @@ -0,0 +1,56 @@
     1.4 +#include "ctype.h"
     1.5 +
     1.6 +int isalnum(int c)
     1.7 +{
     1.8 +	return isalpha(c) || isdigit(c);
     1.9 +}
    1.10 +
    1.11 +int isalpha(int c)
    1.12 +{
    1.13 +	return isupper(c) || islower(c);
    1.14 +}
    1.15 +
    1.16 +int isblank(int c)
    1.17 +{
    1.18 +	return c == ' ' || c == '\t';
    1.19 +}
    1.20 +
    1.21 +int isdigit(int c)
    1.22 +{
    1.23 +	return c >= '0' && c <= '9';
    1.24 +}
    1.25 +
    1.26 +int isupper(int c)
    1.27 +{
    1.28 +	return c >= 'A' && c <= 'Z';
    1.29 +}
    1.30 +
    1.31 +int islower(int c)
    1.32 +{
    1.33 +	return c >= 'a' && c <= 'z';
    1.34 +}
    1.35 +
    1.36 +int isgraph(int c)
    1.37 +{
    1.38 +	return c > ' ' && c <= '~';
    1.39 +}
    1.40 +
    1.41 +int isprint(int c)
    1.42 +{
    1.43 +	return isgraph(c) || c == ' ';
    1.44 +}
    1.45 +
    1.46 +int isspace(int c)
    1.47 +{
    1.48 +	return isblank(c) || c == '\f' || c == '\n' || c == '\r' || c == '\v';
    1.49 +}
    1.50 +
    1.51 +int toupper(int c)
    1.52 +{
    1.53 +	return islower(c) ? (c + ('A' - 'a')) : c;
    1.54 +}
    1.55 +
    1.56 +int tolower(int c)
    1.57 +{
    1.58 +	return isupper(c) ? (c + ('A' - 'a')) : c;
    1.59 +}