ctype.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Sane locale-independent, ASCII ctype.
  3. *
  4. * No surprises, and works with signed and unsigned chars.
  5. */
  6. #include "util.h"
  7. enum {
  8. S = GIT_SPACE,
  9. A = GIT_ALPHA,
  10. D = GIT_DIGIT,
  11. G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
  12. R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | * */
  13. P = GIT_PRINT_EXTRA, /* printable - alpha - digit - glob - regex */
  14. PS = GIT_SPACE | GIT_PRINT_EXTRA,
  15. };
  16. unsigned char sane_ctype[256] = {
  17. /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
  18. 0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
  19. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
  20. PS,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, P, 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, P, P, 0, /* 112..127 */
  26. /* Nothing in the 128.. range */
  27. };
  28. const char *graph_line =
  29. "_____________________________________________________________________"
  30. "_____________________________________________________________________"
  31. "_____________________________________________________________________";
  32. const char *graph_dotted_line =
  33. "---------------------------------------------------------------------"
  34. "---------------------------------------------------------------------"
  35. "---------------------------------------------------------------------";
  36. const char *spaces =
  37. " "
  38. " "
  39. " ";
  40. const char *dots =
  41. "....................................................................."
  42. "....................................................................."
  43. ".....................................................................";