3 #ifndef SCM_BITVECTORS_H
4 #define SCM_BITVECTORS_H
6 /* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009, 2014 Free Software Foundation, Inc.
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.
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.
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
26 #include "libguile/__scm.h"
27 #include "libguile/array-handle.h"
31 /* Bitvectors. Exciting stuff, maybe!
37 SCM_API SCM
scm_bitvector_p (SCM vec
);
38 SCM_API SCM
scm_bitvector (SCM bits
);
39 SCM_API SCM
scm_make_bitvector (SCM len
, SCM fill
);
40 SCM_API SCM
scm_bitvector_length (SCM vec
);
41 SCM_API SCM
scm_bitvector_ref (SCM vec
, SCM idx
);
42 SCM_API SCM
scm_bitvector_set_x (SCM vec
, SCM idx
, SCM val
);
43 SCM_API SCM
scm_list_to_bitvector (SCM list
);
44 SCM_API SCM
scm_bitvector_to_list (SCM vec
);
45 SCM_API SCM
scm_bitvector_fill_x (SCM vec
, SCM val
);
47 SCM_API SCM
scm_bit_count (SCM item
, SCM seq
);
48 SCM_API SCM
scm_bit_position (SCM item
, SCM v
, SCM k
);
49 SCM_API SCM
scm_bit_set_star_x (SCM v
, SCM kv
, SCM obj
);
50 SCM_API SCM
scm_bit_count_star (SCM v
, SCM kv
, SCM obj
);
51 SCM_API SCM
scm_bit_invert_x (SCM v
);
52 SCM_API SCM
scm_istr2bve (SCM str
);
54 SCM_API
int scm_is_bitvector (SCM obj
);
55 SCM_API SCM
scm_c_make_bitvector (size_t len
, SCM fill
);
56 SCM_API
size_t scm_c_bitvector_length (SCM vec
);
57 SCM_API SCM
scm_c_bitvector_ref (SCM vec
, size_t idx
);
58 SCM_API
void scm_c_bitvector_set_x (SCM vec
, size_t idx
, SCM val
);
59 SCM_API
const scm_t_uint32
*scm_array_handle_bit_elements (scm_t_array_handle
*h
);
60 SCM_API scm_t_uint32
*scm_array_handle_bit_writable_elements (scm_t_array_handle
*h
);
61 SCM_API
size_t scm_array_handle_bit_elements_offset (scm_t_array_handle
*h
);
62 SCM_API
const scm_t_uint32
*scm_bitvector_elements (SCM vec
,
63 scm_t_array_handle
*h
,
67 SCM_API scm_t_uint32
*scm_bitvector_writable_elements (SCM vec
,
68 scm_t_array_handle
*h
,
73 SCM_INTERNAL scm_t_uint32
*scm_i_bitvector_bits (SCM vec
);
74 SCM_INTERNAL
int scm_i_print_bitvector (SCM vec
, SCM port
, scm_print_state
*pstate
);
75 SCM_INTERNAL SCM
scm_i_bitvector_equal_p (SCM vec1
, SCM vec2
);
76 SCM_INTERNAL
void scm_init_bitvectors (void);
78 #endif /* SCM_BITVECTORS_H */