Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
172 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/*************************************************************************** | ||
* _ _ ____ _ | ||
* Project ___| | | | _ \| | | ||
* / __| | | | |_) | | | ||
* | (__| |_| | _ <| |___ | ||
* \___|\___/|_| \_\_____| | ||
* | ||
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
* | ||
* This software is licensed as described in the file COPYING, which | ||
* you should have received as part of this distribution. The terms | ||
* are also available at https://curl.haxx.se/docs/copyright.html. | ||
* | ||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||
* copies of the Software, and permit persons to whom the Software is | ||
* furnished to do so, under the terms of the COPYING file. | ||
* | ||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
* KIND, either express or implied. | ||
* | ||
***************************************************************************/ | ||
|
||
#include "curl_setup.h" | ||
|
||
#define _U (1<<0) /* upper case */ | ||
#define _L (1<<1) /* lower case */ | ||
#define _N (1<<2) /* decimal numerical digit */ | ||
#define _S (1<<3) /* space */ | ||
#define _P (1<<4) /* punctuation */ | ||
#define _C (1<<5) /* control */ | ||
#define _X (1<<6) /* hexadecimal letter */ | ||
#define _B (1<<7) /* blank */ | ||
|
||
const unsigned char Curl_ctype[128] = { | ||
_C, _C, _C, _C, _C, _C, _C, _C, | ||
_C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, | ||
_C, _C, _C, _C, _C, _C, _C, _C, | ||
_C, _C, _C, _C, _C, _C, _C, _C, | ||
_S|_B, _P, _P, _P, _P, _P, _P, _P, | ||
_P, _P, _P, _P, _P, _P, _P, _P, | ||
_N, _N, _N, _N, _N, _N, _N, _N, | ||
_N, _N, _P, _P, _P, _P, _P, _P, | ||
_P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, | ||
_U, _U, _U, _U, _U, _U, _U, _U, | ||
_U, _U, _U, _U, _U, _U, _U, _U, | ||
_U, _U, _U, _P, _P, _P, _P, _P, | ||
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, | ||
_L, _L, _L, _L, _L, _L, _L, _L, | ||
_L, _L, _L, _L, _L, _L, _L, _L, | ||
_L, _L, _L, _P, _P, _P, _P, _C | ||
}; | ||
|
||
int Curl_isspace(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & _S); | ||
} | ||
|
||
int Curl_isdigit(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & _N); | ||
} | ||
|
||
int Curl_isalnum(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_N|_U|_L)); | ||
} | ||
|
||
int Curl_isxdigit(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_N|_X)); | ||
} | ||
|
||
int Curl_isgraph(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80) || (c == ' ')) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_N|_X|_U|_L|_P|_S)); | ||
} | ||
|
||
int Curl_isprint(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_N|_X|_U|_L|_P|_S)); | ||
} | ||
|
||
int Curl_isalpha(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_U|_L)); | ||
} | ||
|
||
int Curl_isupper(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_U)); | ||
} | ||
|
||
int Curl_islower(int c) | ||
{ | ||
if((c < 0) || (c >= 0x80)) | ||
return FALSE; | ||
return (Curl_ctype[c] & (_L)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef HEADER_CURL_CTYPE_H | ||
#define HEADER_CURL_CTYPE_H | ||
/*************************************************************************** | ||
* _ _ ____ _ | ||
* Project ___| | | | _ \| | | ||
* / __| | | | |_) | | | ||
* | (__| |_| | _ <| |___ | ||
* \___|\___/|_| \_\_____| | ||
* | ||
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. | ||
* | ||
* This software is licensed as described in the file COPYING, which | ||
* you should have received as part of this distribution. The terms | ||
* are also available at https://curl.haxx.se/docs/copyright.html. | ||
* | ||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||
* copies of the Software, and permit persons to whom the Software is | ||
* furnished to do so, under the terms of the COPYING file. | ||
* | ||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
* KIND, either express or implied. | ||
* | ||
***************************************************************************/ | ||
|
||
int Curl_isspace(int c); | ||
int Curl_isdigit(int c); | ||
int Curl_isalnum(int c); | ||
int Curl_isxdigit(int c); | ||
int Curl_isgraph(int c); | ||
int Curl_isprint(int c); | ||
int Curl_isalpha(int c); | ||
int Curl_isupper(int c); | ||
int Curl_islower(int c); | ||
|
||
#define ISSPACE(x) (Curl_isspace((int) ((unsigned char)x))) | ||
#define ISDIGIT(x) (Curl_isdigit((int) ((unsigned char)x))) | ||
#define ISALNUM(x) (Curl_isalnum((int) ((unsigned char)x))) | ||
#define ISXDIGIT(x) (Curl_isxdigit((int) ((unsigned char)x))) | ||
#define ISGRAPH(x) (Curl_isgraph((int) ((unsigned char)x))) | ||
#define ISALPHA(x) (Curl_isalpha((int) ((unsigned char)x))) | ||
#define ISPRINT(x) (Curl_isprint((int) ((unsigned char)x))) | ||
#define ISUPPER(x) (Curl_isupper((int) ((unsigned char)x))) | ||
#define ISLOWER(x) (Curl_islower((int) ((unsigned char)x))) | ||
#define ISASCII(x) (((x) >= 0) && ((x) <= 0x80)) | ||
#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \ | ||
(((unsigned char)x) == '\t')) | ||
|
||
#endif /* HEADER_CURL_CTYPE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters