View of xos/include/ctype.h


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
#ifndef _CTYPE_H
#define _CTYPE_H
 
#ifdef CTYPE_C
#define inline
#endif
 
extern inline int isupper(int c)
{
  return c >= 'A' && c <= 'Z';
}
 
extern inline int islower(int c)
{
  return c >= 'a' && c <= 'z';
}
 
extern inline int isalpha(int c)
{
  return isupper(c) || islower(c);
}
 
extern inline int isdigit(int c)
{
  return c >= '0' && c <= '9';
}
 
extern inline int isalnum(int c)
{
  return isalpha(c) || isdigit(c);
}
 
extern inline int iscntrl(int c)
{
  return (c >= 0 && c <= 31) || c == 127;
}
 
extern inline int toupper(int c)
{
  return c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c;
}
 
extern inline int tolower(int c)
{
  return c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c;
}
 
#undef inline
 
#endif