Add `SCM_INTERNAL' macro, use it.
[bpt/guile.git] / libguile / srfi-14.h
CommitLineData
63181a97
MV
1#ifndef SCM_SRFI_14_H
2#define SCM_SRFI_14_H
3
4/* srfi-14.c --- SRFI-14 procedures for Guile
5 *
102dbb6f 6 * Copyright (C) 2001, 2004, 2006, 2008 Free Software Foundation, Inc.
63181a97
MV
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
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but 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
92205699 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
63181a97
MV
21 */
22\f
23
24#include "libguile/__scm.h"
25
26#define SCM_CHARSET_SIZE 256
27
28/* We expect 8-bit bytes here. Should be no problem in the year
29 2001. */
30#ifndef SCM_BITS_PER_LONG
31# define SCM_BITS_PER_LONG (sizeof (long) * 8)
32#endif
33
34#define SCM_CHARSET_GET(cs, idx) (((long *) SCM_SMOB_DATA (cs))\
35 [((unsigned char) (idx)) / SCM_BITS_PER_LONG] &\
36 (1L << (((unsigned char) (idx)) % SCM_BITS_PER_LONG)))
37
38#define SCM_CHARSETP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_charset))
39
40/* Smob type code for character sets. */
41SCM_API int scm_tc16_charset;
42
43SCM_API SCM scm_char_set_p (SCM obj);
44SCM_API SCM scm_char_set_eq (SCM char_sets);
45SCM_API SCM scm_char_set_leq (SCM char_sets);
46SCM_API SCM scm_char_set_hash (SCM cs, SCM bound);
47SCM_API SCM scm_char_set_cursor (SCM cs);
48SCM_API SCM scm_char_set_ref (SCM cs, SCM cursor);
49SCM_API SCM scm_char_set_cursor_next (SCM cs, SCM cursor);
50SCM_API SCM scm_end_of_char_set_p (SCM cursor);
51SCM_API SCM scm_char_set_fold (SCM kons, SCM knil, SCM cs);
52SCM_API SCM scm_char_set_unfold (SCM p, SCM f, SCM g, SCM seed, SCM base_cs);
53SCM_API SCM scm_char_set_unfold_x (SCM p, SCM f, SCM g, SCM seed, SCM base_cs);
54SCM_API SCM scm_char_set_for_each (SCM proc, SCM cs);
55SCM_API SCM scm_char_set_map (SCM proc, SCM cs);
56SCM_API SCM scm_char_set_copy (SCM cs);
57SCM_API SCM scm_char_set (SCM rest);
58SCM_API SCM scm_list_to_char_set (SCM list, SCM base_cs);
59SCM_API SCM scm_list_to_char_set_x (SCM list, SCM base_cs);
60SCM_API SCM scm_string_to_char_set (SCM str, SCM base_cs);
61SCM_API SCM scm_string_to_char_set_x (SCM str, SCM base_cs);
62SCM_API SCM scm_char_set_filter (SCM pred, SCM cs, SCM base_cs);
63SCM_API SCM scm_char_set_filter_x (SCM pred, SCM cs, SCM base_cs);
64SCM_API SCM scm_ucs_range_to_char_set (SCM lower, SCM upper, SCM error, SCM base_cs);
65SCM_API SCM scm_ucs_range_to_char_set_x (SCM lower, SCM upper, SCM error, SCM base_cs);
66SCM_API SCM scm_to_char_set (SCM x);
67SCM_API SCM scm_char_set_size (SCM cs);
68SCM_API SCM scm_char_set_count (SCM pred, SCM cs);
69SCM_API SCM scm_char_set_to_list (SCM cs);
70SCM_API SCM scm_char_set_to_string (SCM cs);
71SCM_API SCM scm_char_set_contains_p (SCM cs, SCM ch);
72SCM_API SCM scm_char_set_every (SCM pred, SCM cs);
73SCM_API SCM scm_char_set_any (SCM pred, SCM cs);
74SCM_API SCM scm_char_set_adjoin (SCM cs, SCM rest);
75SCM_API SCM scm_char_set_delete (SCM cs, SCM rest);
76SCM_API SCM scm_char_set_adjoin_x (SCM cs, SCM rest);
77SCM_API SCM scm_char_set_delete_x (SCM cs, SCM rest);
78SCM_API SCM scm_char_set_complement (SCM cs);
79SCM_API SCM scm_char_set_union (SCM rest);
80SCM_API SCM scm_char_set_intersection (SCM rest);
81SCM_API SCM scm_char_set_difference (SCM cs1, SCM rest);
82SCM_API SCM scm_char_set_xor (SCM rest);
83SCM_API SCM scm_char_set_diff_plus_intersection (SCM cs1, SCM rest);
84SCM_API SCM scm_char_set_complement_x (SCM cs);
85SCM_API SCM scm_char_set_union_x (SCM cs1, SCM rest);
86SCM_API SCM scm_char_set_intersection_x (SCM cs1, SCM rest);
87SCM_API SCM scm_char_set_difference_x (SCM cs1, SCM rest);
88SCM_API SCM scm_char_set_xor_x (SCM cs1, SCM rest);
89SCM_API SCM scm_char_set_diff_plus_intersection_x (SCM cs1, SCM cs2, SCM rest);
90
91SCM_API SCM scm_char_set_lower_case;
92SCM_API SCM scm_char_set_upper_case;
93SCM_API SCM scm_char_set_title_case;
94SCM_API SCM scm_char_set_letter;
95SCM_API SCM scm_char_set_digit;
96SCM_API SCM scm_char_set_letter_and_digit;
97SCM_API SCM scm_char_set_graphic;
98SCM_API SCM scm_char_set_printing;
99SCM_API SCM scm_char_set_whitespace;
100SCM_API SCM scm_char_set_iso_control;
101SCM_API SCM scm_char_set_punctuation;
102SCM_API SCM scm_char_set_symbol;
103SCM_API SCM scm_char_set_hex_digit;
104SCM_API SCM scm_char_set_blank;
105SCM_API SCM scm_char_set_ascii;
106SCM_API SCM scm_char_set_empty;
107SCM_API SCM scm_char_set_full;
108
102dbb6f
LC
109SCM_INTERNAL void scm_srfi_14_compute_char_sets (void);
110SCM_INTERNAL void scm_init_srfi_14 (void);
63181a97
MV
111
112#endif /* SCM_SRFI_14_H */