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