2005-10-14 02:03:18 +08:00
|
|
|
/*
|
|
|
|
* Sane locale-independent, ASCII ctype.
|
|
|
|
*
|
|
|
|
* No surprises, and works with signed and unsigned chars.
|
|
|
|
*/
|
2012-02-10 10:13:30 +08:00
|
|
|
#include "git-compat-util.h"
|
2005-10-14 02:03:18 +08:00
|
|
|
|
2009-01-17 23:50:29 +08:00
|
|
|
enum {
|
|
|
|
S = GIT_SPACE,
|
|
|
|
A = GIT_ALPHA,
|
|
|
|
D = GIT_DIGIT,
|
2009-01-17 23:50:34 +08:00
|
|
|
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
|
2011-04-09 07:18:46 +08:00
|
|
|
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
|
2012-10-15 14:25:51 +08:00
|
|
|
P = GIT_PATHSPEC_MAGIC, /* other non-alnum, except for ] and } */
|
|
|
|
X = GIT_CNTRL,
|
|
|
|
U = GIT_PUNCT,
|
|
|
|
Z = GIT_CNTRL | GIT_SPACE
|
2009-01-17 23:50:29 +08:00
|
|
|
};
|
2005-10-14 02:03:18 +08:00
|
|
|
|
2012-10-15 14:25:50 +08:00
|
|
|
const unsigned char sane_ctype[256] = {
|
2012-10-15 14:25:51 +08:00
|
|
|
X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X, /* 0.. 15 */
|
|
|
|
X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 16.. 31 */
|
2011-04-09 07:18:46 +08:00
|
|
|
S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
|
|
|
|
D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
|
|
|
|
P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
|
2012-10-15 14:25:51 +08:00
|
|
|
A, A, A, A, A, A, A, A, A, A, A, G, G, U, R, P, /* 80.. 95 */
|
2011-04-09 07:18:46 +08:00
|
|
|
P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
|
2012-10-15 14:25:51 +08:00
|
|
|
A, A, A, A, A, A, A, A, A, A, A, R, R, U, P, X, /* 112..127 */
|
2005-10-14 02:03:18 +08:00
|
|
|
/* Nothing in the 128.. range */
|
|
|
|
};
|