Git 1.7.9
[git/git.git] / ctype.c
CommitLineData
4546738b
LT
1/*
2 * Sane locale-independent, ASCII ctype.
3 *
4 * No surprises, and works with signed and unsigned chars.
5 */
6#include "cache.h"
7
c841aa8b
RS
8enum {
9 S = GIT_SPACE,
10 A = GIT_ALPHA,
11 D = GIT_DIGIT,
8cc32992 12 G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
2f6c9760
JH
13 R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
14 P = GIT_PATHSPEC_MAGIC /* other non-alnum, except for ] and } */
c841aa8b 15};
4546738b
LT
16
17unsigned char sane_ctype[256] = {
8cc32992 18 0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
c841aa8b 19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
2f6c9760
JH
20 S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
21 D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
22 P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
23 A, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, P, /* 80.. 95 */
24 P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
25 A, A, A, A, A, A, A, A, A, A, A, R, R, 0, P, 0, /* 112..127 */
4546738b
LT
26 /* Nothing in the 128.. range */
27};