Merge commit '2f3b7e9a41677bfe802e8a1ee851827297384c58'
[bpt/guile.git] / libguile / uniform.h
1 /* classes: h_files */
2
3 #ifndef SCM_UNIFORM_H
4 #define SCM_UNIFORM_H
5
6 /* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009, 2013 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
24 \f
25
26 #include "libguile/__scm.h"
27
28 \f
29
30 /*
31 * Uniform vectors contain unboxed values. They are not necessarily contiguous.
32 */
33
34 SCM_INTERNAL const size_t scm_i_array_element_type_sizes[];
35 #define SCM_ARRAY_ELEMENT_TYPE_IS_UNBOXED(t) \
36 (scm_i_array_element_type_sizes[(t)] != 0)
37
38 /* type size in bytes */
39 SCM_API size_t scm_array_handle_uniform_element_size (scm_t_array_handle *h);
40 /* type size in bits */
41 SCM_API size_t scm_array_handle_uniform_element_bit_size (scm_t_array_handle *h);
42
43 SCM_API const void *scm_array_handle_uniform_elements (scm_t_array_handle *h);
44 SCM_API void *scm_array_handle_uniform_writable_elements (scm_t_array_handle *h);
45
46 SCM_API SCM scm_uniform_vector_p (SCM v);
47 SCM_API SCM scm_uniform_vector_length (SCM v);
48 SCM_API SCM scm_uniform_vector_element_type (SCM v);
49 SCM_API SCM scm_uniform_vector_element_type_code (SCM v);
50 SCM_API SCM scm_uniform_vector_element_size (SCM v);
51 SCM_API SCM scm_uniform_vector_ref (SCM v, SCM idx);
52 SCM_API SCM scm_uniform_vector_set_x (SCM v, SCM idx, SCM val);
53 SCM_API SCM scm_uniform_vector_to_list (SCM v);
54 SCM_API SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd,
55 SCM start, SCM end);
56 SCM_API SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
57 SCM start, SCM end);
58
59 SCM_API int scm_is_uniform_vector (SCM obj);
60 SCM_API size_t scm_c_uniform_vector_length (SCM v);
61 SCM_API SCM scm_c_uniform_vector_ref (SCM v, size_t idx);
62 SCM_API void scm_c_uniform_vector_set_x (SCM v, size_t idx, SCM val);
63 SCM_API const void *scm_uniform_vector_elements (SCM uvec,
64 scm_t_array_handle *h,
65 size_t *lenp, ssize_t *incp);
66 SCM_API void *scm_uniform_vector_writable_elements (SCM uvec,
67 scm_t_array_handle *h,
68 size_t *lenp,
69 ssize_t *incp);
70
71 SCM_INTERNAL void scm_init_uniform (void);
72
73 #endif /* SCM_UNIFORM_H */
74
75 /*
76 Local Variables:
77 c-file-style: "gnu"
78 End:
79 */