00001 /* $Id: ctype.h 3553 2011-05-05 06:14:19Z nanang $ */00002 /* 00003 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)00004 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>00005 *00006 * This program is free software; you can redistribute it and/or modify00007 * it under the terms of the GNU General Public License as published by00008 * the Free Software Foundation; either version 2 of the License, or00009 * (at your option) any later version.00010 *00011 * This program is distributed in the hope that it will be useful,00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00014 * GNU General Public License for more details.00015 *00016 * You should have received a copy of the GNU General Public License00017 * along with this program; if not, write to the Free Software00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */00020 #ifndef __PJ_CTYPE_H__00021 #define __PJ_CTYPE_H__00022
00028 #include <pj/types.h>00029 #include <pj/compat/ctype.h>00030
00031 PJ_BEGIN_DECL00032
00048PJ_INLINE(int) pj_isalnum(unsignedchar c) { return isalnum(c); }
00049
00057PJ_INLINE(int) pj_isalpha(unsignedchar c) { return isalpha(c); }
00058
00066PJ_INLINE(int) pj_isascii(unsignedchar c) { return c<128; }
00067
00075PJ_INLINE(int) pj_isdigit(unsignedchar c) { return isdigit(c); }
00076
00084PJ_INLINE(int) pj_isspace(unsignedchar c) { return isspace(c); }
00085
00093PJ_INLINE(int) pj_islower(unsignedchar c) { return islower(c); }
00094
00095
00103PJ_INLINE(int) pj_isupper(unsignedchar c) { return isupper(c); }
00104
00112PJ_INLINE(int) pj_isblank(unsignedchar c) { return isblank(c); }
00113
00119PJ_INLINE(int) pj_tolower(unsignedchar c) { return tolower(c); }
00120
00126PJ_INLINE(int) pj_toupper(unsignedchar c) { return toupper(c); }
00127
00135PJ_INLINE(int) pj_isxdigit(unsignedchar c){ return isxdigit(c); }
00136
00140 /*extern char pj_hex_digits[];*/00141#define pj_hex_digits "0123456789abcdef"00142
00149PJ_INLINE(void) pj_val_to_hex_digit(unsigned value, char *p)
00150 {
00151 *p++ = pj_hex_digits[ (value & 0xF0) >> 4 ];
00152 *p = pj_hex_digits[ (value & 0x0F) ];
00153 }
00154
00160PJ_INLINE(unsigned) pj_hex_digit_to_val(unsignedchar c)
00161 {
00162 if (c <= '9')
00163 return (c-'0') & 0x0F;
00164 elseif (c <= 'F')
00165 return (c-'A'+10) & 0x0F;
00166 else00167 return (c-'a'+10) & 0x0F;
00168 }
00169
00172 PJ_END_DECL00173
00174 #endif /* __PJ_CTYPE_H__ */00175
PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.