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