1#ifndef HEADER_CURL_CTYPE_H
2#define HEADER_CURL_CTYPE_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.haxx.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
24
25#include "curl_setup.h"
26
27#ifdef CURL_DOES_CONVERSIONS
28
29/*
30 * Uppercase macro versions of ANSI/ISO is*() functions/macros which
31 * avoid negative number inputs with argument byte codes > 127.
32 *
33 * For non-ASCII platforms the C library character classification routines
34 * are used despite being locale-dependent, because this is better than
35 * not to work at all.
36 */
37#include <ctype.h>
38
39#define ISSPACE(x) (isspace((int) ((unsigned char)x)))
40#define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
41#define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
42#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
43#define ISGRAPH(x) (isgraph((int) ((unsigned char)x)))
44#define ISALPHA(x) (isalpha((int) ((unsigned char)x)))
45#define ISPRINT(x) (isprint((int) ((unsigned char)x)))
46#define ISUPPER(x) (isupper((int) ((unsigned char)x)))
47#define ISLOWER(x) (islower((int) ((unsigned char)x)))
48#define ISCNTRL(x) (iscntrl((int) ((unsigned char)x)))
49#define ISASCII(x) (isascii((int) ((unsigned char)x)))
50
51#else
52
53int Curl_isspace(int c);
54int Curl_isdigit(int c);
55int Curl_isalnum(int c);
56int Curl_isxdigit(int c);
57int Curl_isgraph(int c);
58int Curl_isprint(int c);
59int Curl_isalpha(int c);
60int Curl_isupper(int c);
61int Curl_islower(int c);
62int Curl_iscntrl(int c);
63
64#define ISSPACE(x) (Curl_isspace((int) ((unsigned char)x)))
65#define ISDIGIT(x) (Curl_isdigit((int) ((unsigned char)x)))
66#define ISALNUM(x) (Curl_isalnum((int) ((unsigned char)x)))
67#define ISXDIGIT(x) (Curl_isxdigit((int) ((unsigned char)x)))
68#define ISGRAPH(x) (Curl_isgraph((int) ((unsigned char)x)))
69#define ISALPHA(x) (Curl_isalpha((int) ((unsigned char)x)))
70#define ISPRINT(x) (Curl_isprint((int) ((unsigned char)x)))
71#define ISUPPER(x) (Curl_isupper((int) ((unsigned char)x)))
72#define ISLOWER(x) (Curl_islower((int) ((unsigned char)x)))
73#define ISCNTRL(x) (Curl_iscntrl((int) ((unsigned char)x)))
74#define ISASCII(x) (((x) >= 0) && ((x) <= 0x80))
75
76#endif
77
78#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \
79 (((unsigned char)x) == '\t'))
80
81#endif /* HEADER_CURL_CTYPE_H */
82