BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

ctype.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJ_CTYPE_H__
20#define __PJ_CTYPE_H__
21
27#include <pj/types.h>
28#include <pj/compat/ctype.h>
29
31
47PJ_INLINE(int) pj_isalnum(unsigned char c) { return isalnum(c); }
48
56PJ_INLINE(int) pj_isalpha(unsigned char c) { return isalpha(c); }
57
65PJ_INLINE(int) pj_isascii(unsigned char c) { return c<128; }
66
74PJ_INLINE(int) pj_isdigit(unsigned char c) { return isdigit(c); }
75
83PJ_INLINE(int) pj_isspace(unsigned char c) { return isspace(c); }
84
92PJ_INLINE(int) pj_islower(unsigned char c) { return islower(c); }
93
94
102PJ_INLINE(int) pj_isupper(unsigned char c) { return isupper(c); }
103
111PJ_INLINE(int) pj_isblank(unsigned char c) { return (c==' ' || c=='\t'); }
112
118PJ_INLINE(int) pj_tolower(unsigned char c) { return tolower(c); }
119
125PJ_INLINE(int) pj_toupper(unsigned char c) { return toupper(c); }
126
134PJ_INLINE(int) pj_isxdigit(unsigned char c){ return isxdigit(c); }
135
139/*extern char pj_hex_digits[];*/
140#define pj_hex_digits "0123456789abcdef"
141
148PJ_INLINE(void) pj_val_to_hex_digit(unsigned value, char *p)
149{
150 *p++ = pj_hex_digits[ (value & 0xF0) >> 4 ];
151 *p = pj_hex_digits[ (value & 0x0F) ];
152}
153
159PJ_INLINE(unsigned) pj_hex_digit_to_val(unsigned char c)
160{
161 if (c <= '9')
162 return (c-'0') & 0x0F;
163 else if (c <= 'F')
164 return (c-'A'+10) & 0x0F;
165 else
166 return (c-'a'+10) & 0x0F;
167}
168
172
173#endif /* __PJ_CTYPE_H__ */
174
#define PJ_BEGIN_DECL
Definition: config.h:1284
#define PJ_INLINE(type)
Definition: config.h:1178
#define PJ_END_DECL
Definition: config.h:1285
int pj_tolower(unsigned char c)
Definition: ctype.h:118
void pj_val_to_hex_digit(unsigned value, char *p)
Definition: ctype.h:148
int pj_toupper(unsigned char c)
Definition: ctype.h:125
int pj_isblank(unsigned char c)
Definition: ctype.h:111
unsigned pj_hex_digit_to_val(unsigned char c)
Definition: ctype.h:159
int pj_isalnum(unsigned char c)
Definition: ctype.h:47
int pj_isxdigit(unsigned char c)
Definition: ctype.h:134
int pj_islower(unsigned char c)
Definition: ctype.h:92
int pj_isupper(unsigned char c)
Definition: ctype.h:102
int pj_isascii(unsigned char c)
Definition: ctype.h:65
#define pj_hex_digits
Definition: ctype.h:140
int pj_isspace(unsigned char c)
Definition: ctype.h:83
int pj_isalpha(unsigned char c)
Definition: ctype.h:56
int pj_isdigit(unsigned char c)
Definition: ctype.h:74
Declaration of basic types and utility.

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.