srfi-14.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef SCM_SRFI_14_H
  2. #define SCM_SRFI_14_H
  3. /* srfi-14.c --- SRFI-14 procedures for Guile
  4. xxg
  5. Copyright 2001,2004,2006,2008,2011,2018
  6. Free Software Foundation, Inc.
  7. This file is part of Guile.
  8. Guile is free software: you can redistribute it and/or modify it
  9. under the terms of the GNU Lesser General Public License as published
  10. by the Free Software Foundation, either version 3 of the License, or
  11. (at your option) any later version.
  12. Guile is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  15. License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with Guile. If not, see
  18. <https://www.gnu.org/licenses/>. */
  19. #include "libguile/chars.h"
  20. typedef struct
  21. {
  22. scm_t_wchar lo;
  23. scm_t_wchar hi;
  24. } scm_t_char_range;
  25. typedef struct
  26. {
  27. size_t len;
  28. scm_t_char_range *ranges;
  29. } scm_t_char_set;
  30. typedef struct
  31. {
  32. size_t range;
  33. scm_t_wchar n;
  34. } scm_t_char_set_cursor;
  35. #define SCM_CHARSET_GET(cs,idx) \
  36. scm_i_charset_get((scm_t_char_set *)SCM_SMOB_DATA(cs),idx)
  37. #define SCM_CHARSETP(x) (SCM_HAS_TYP16 (x, scm_tc16_charset))
  38. /* Smob type code for character sets. */
  39. SCM_API int scm_tc16_charset;
  40. SCM_INTERNAL int scm_i_charset_get (scm_t_char_set *cs, scm_t_wchar n);
  41. SCM_INTERNAL void scm_i_charset_set (scm_t_char_set *cs, scm_t_wchar n);
  42. SCM_INTERNAL void scm_i_charset_unset (scm_t_char_set *cs, scm_t_wchar n);
  43. SCM_API SCM scm_char_set_p (SCM obj);
  44. SCM_API SCM scm_char_set_eq (SCM char_sets);
  45. SCM_API SCM scm_char_set_leq (SCM char_sets);
  46. SCM_API SCM scm_char_set_hash (SCM cs, SCM bound);
  47. SCM_API SCM scm_char_set_cursor (SCM cs);
  48. SCM_API SCM scm_char_set_ref (SCM cs, SCM cursor);
  49. SCM_API SCM scm_char_set_cursor_next (SCM cs, SCM cursor);
  50. SCM_API SCM scm_end_of_char_set_p (SCM cursor);
  51. SCM_API SCM scm_char_set_fold (SCM kons, SCM knil, SCM cs);
  52. SCM_API SCM scm_char_set_unfold (SCM p, SCM f, SCM g, SCM seed, SCM base_cs);
  53. SCM_API SCM scm_char_set_unfold_x (SCM p, SCM f, SCM g, SCM seed, SCM base_cs);
  54. SCM_API SCM scm_char_set_for_each (SCM proc, SCM cs);
  55. SCM_API SCM scm_char_set_map (SCM proc, SCM cs);
  56. SCM_API SCM scm_char_set_copy (SCM cs);
  57. SCM_API SCM scm_char_set (SCM rest);
  58. SCM_API SCM scm_list_to_char_set (SCM list, SCM base_cs);
  59. SCM_API SCM scm_list_to_char_set_x (SCM list, SCM base_cs);
  60. SCM_API SCM scm_string_to_char_set (SCM str, SCM base_cs);
  61. SCM_API SCM scm_string_to_char_set_x (SCM str, SCM base_cs);
  62. SCM_API SCM scm_char_set_filter (SCM pred, SCM cs, SCM base_cs);
  63. SCM_API SCM scm_char_set_filter_x (SCM pred, SCM cs, SCM base_cs);
  64. SCM_API SCM scm_ucs_range_to_char_set (SCM lower, SCM upper, SCM error, SCM base_cs);
  65. SCM_API SCM scm_ucs_range_to_char_set_x (SCM lower, SCM upper, SCM error, SCM base_cs);
  66. SCM_API SCM scm_to_char_set (SCM x);
  67. SCM_API SCM scm_char_set_size (SCM cs);
  68. SCM_API SCM scm_char_set_count (SCM pred, SCM cs);
  69. SCM_API SCM scm_char_set_to_list (SCM cs);
  70. SCM_API SCM scm_char_set_to_string (SCM cs);
  71. SCM_API SCM scm_char_set_contains_p (SCM cs, SCM ch);
  72. SCM_API SCM scm_char_set_every (SCM pred, SCM cs);
  73. SCM_API SCM scm_char_set_any (SCM pred, SCM cs);
  74. SCM_API SCM scm_char_set_adjoin (SCM cs, SCM rest);
  75. SCM_API SCM scm_char_set_delete (SCM cs, SCM rest);
  76. SCM_API SCM scm_char_set_adjoin_x (SCM cs, SCM rest);
  77. SCM_API SCM scm_char_set_delete_x (SCM cs, SCM rest);
  78. SCM_API SCM scm_char_set_complement (SCM cs);
  79. SCM_API SCM scm_char_set_union (SCM rest);
  80. SCM_API SCM scm_char_set_intersection (SCM rest);
  81. SCM_API SCM scm_char_set_difference (SCM cs1, SCM rest);
  82. SCM_API SCM scm_char_set_xor (SCM rest);
  83. SCM_API SCM scm_char_set_diff_plus_intersection (SCM cs1, SCM rest);
  84. SCM_API SCM scm_char_set_complement_x (SCM cs);
  85. SCM_API SCM scm_char_set_union_x (SCM cs1, SCM rest);
  86. SCM_API SCM scm_char_set_intersection_x (SCM cs1, SCM rest);
  87. SCM_API SCM scm_char_set_difference_x (SCM cs1, SCM rest);
  88. SCM_API SCM scm_char_set_xor_x (SCM cs1, SCM rest);
  89. SCM_API SCM scm_char_set_diff_plus_intersection_x (SCM cs1, SCM cs2, SCM rest);
  90. SCM_API SCM scm_sys_char_set_dump (SCM charset);
  91. SCM_API SCM scm_char_set_lower_case;
  92. SCM_API SCM scm_char_set_upper_case;
  93. SCM_API SCM scm_char_set_title_case;
  94. SCM_API SCM scm_char_set_letter;
  95. SCM_API SCM scm_char_set_digit;
  96. SCM_API SCM scm_char_set_letter_and_digit;
  97. SCM_API SCM scm_char_set_graphic;
  98. SCM_API SCM scm_char_set_printing;
  99. SCM_API SCM scm_char_set_whitespace;
  100. SCM_API SCM scm_char_set_iso_control;
  101. SCM_API SCM scm_char_set_punctuation;
  102. SCM_API SCM scm_char_set_symbol;
  103. SCM_API SCM scm_char_set_hex_digit;
  104. SCM_API SCM scm_char_set_blank;
  105. SCM_API SCM scm_char_set_ascii;
  106. SCM_API SCM scm_char_set_empty;
  107. SCM_API SCM scm_char_set_full;
  108. SCM_INTERNAL void scm_init_srfi_14 (void);
  109. #endif /* SCM_SRFI_14_H */