chars.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* classes: h_files */
  2. #ifndef SCM_CHARS_H
  3. #define SCM_CHARS_H
  4. /* Copyright (C) 1995,1996,2000,2001,2004, 2006, 2008, 2009 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. */
  21. #include "libguile/__scm.h"
  22. #include "libguile/numbers.h"
  23. /* Immediate Characters
  24. */
  25. #define SCM_CHARP(x) (SCM_ITAG8(x) == scm_tc8_char)
  26. #define SCM_CHAR(x) ((scm_t_wchar)SCM_ITAG8_DATA(x))
  27. #define SCM_MAKE_CHAR(x) \
  28. ((scm_t_int32) (x) < 0 \
  29. ? SCM_MAKE_ITAG8 ((scm_t_bits) (unsigned char) (x), scm_tc8_char) \
  30. : SCM_MAKE_ITAG8 ((scm_t_bits) (x), scm_tc8_char))
  31. #define SCM_CODEPOINT_MAX (0x10ffff)
  32. #define SCM_IS_UNICODE_CHAR(c) \
  33. ((scm_t_wchar) (c) <= 0xd7ff \
  34. || ((scm_t_wchar) (c) >= 0xe000 && (scm_t_wchar) (c) <= SCM_CODEPOINT_MAX))
  35. SCM_API SCM scm_char_p (SCM x);
  36. SCM_API SCM scm_char_eq_p (SCM x, SCM y);
  37. SCM_API SCM scm_char_less_p (SCM x, SCM y);
  38. SCM_API SCM scm_char_leq_p (SCM x, SCM y);
  39. SCM_API SCM scm_char_gr_p (SCM x, SCM y);
  40. SCM_API SCM scm_char_geq_p (SCM x, SCM y);
  41. SCM_API SCM scm_char_ci_eq_p (SCM x, SCM y);
  42. SCM_API SCM scm_char_ci_less_p (SCM x, SCM y);
  43. SCM_API SCM scm_char_ci_leq_p (SCM x, SCM y);
  44. SCM_API SCM scm_char_ci_gr_p (SCM x, SCM y);
  45. SCM_API SCM scm_char_ci_geq_p (SCM x, SCM y);
  46. SCM_API SCM scm_char_alphabetic_p (SCM chr);
  47. SCM_API SCM scm_char_numeric_p (SCM chr);
  48. SCM_API SCM scm_char_whitespace_p (SCM chr);
  49. SCM_API SCM scm_char_upper_case_p (SCM chr);
  50. SCM_API SCM scm_char_lower_case_p (SCM chr);
  51. SCM_API SCM scm_char_is_both_p (SCM chr);
  52. SCM_API SCM scm_char_to_integer (SCM chr);
  53. SCM_API SCM scm_integer_to_char (SCM n);
  54. SCM_API SCM scm_char_upcase (SCM chr);
  55. SCM_API SCM scm_char_downcase (SCM chr);
  56. SCM_API scm_t_wchar scm_c_upcase (scm_t_wchar c);
  57. SCM_API scm_t_wchar scm_c_downcase (scm_t_wchar c);
  58. SCM_INTERNAL const char *scm_i_charname (SCM chr);
  59. SCM_INTERNAL SCM scm_i_charname_to_char (const char *charname,
  60. size_t charname_len);
  61. SCM_INTERNAL void scm_init_chars (void);
  62. #endif /* SCM_CHARS_H */
  63. /*
  64. Local Variables:
  65. c-file-style: "gnu"
  66. End:
  67. */