Avoid signed overflow and use size_t in bytevectors.c.
[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
fb7dd001
AW
6/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009,
7 * 2014 Free Software Foundation, Inc.
476b894c
AW
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 3 of
12 * the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25\f
26
27#include "libguile/__scm.h"
28#include "libguile/generalized-vectors.h"
29
30\f
31
32/*
33 * Uniform vectors contain unboxed values. They are not necessarily contiguous.
34 */
35
36SCM_INTERNAL const size_t scm_i_array_element_type_sizes[];
37#define SCM_ARRAY_ELEMENT_TYPE_IS_UNBOXED(t) \
38 (scm_i_array_element_type_sizes[(t)] != 0)
39
f5a51cae 40/* type size in bytes */
476b894c 41SCM_API size_t scm_array_handle_uniform_element_size (scm_t_array_handle *h);
f5a51cae
AW
42/* type size in bits */
43SCM_API size_t scm_array_handle_uniform_element_bit_size (scm_t_array_handle *h);
476b894c
AW
44
45SCM_API const void *scm_array_handle_uniform_elements (scm_t_array_handle *h);
46SCM_API void *scm_array_handle_uniform_writable_elements (scm_t_array_handle *h);
47
fb7dd001
AW
48#if SCM_ENABLE_DEPRECATED
49
50SCM_DEPRECATED SCM scm_uniform_vector_p (SCM v);
51SCM_DEPRECATED SCM scm_uniform_vector_length (SCM v);
52SCM_DEPRECATED SCM scm_uniform_vector_element_type (SCM v);
53SCM_DEPRECATED SCM scm_uniform_vector_element_size (SCM v);
54SCM_DEPRECATED SCM scm_uniform_vector_ref (SCM v, SCM idx);
55SCM_DEPRECATED SCM scm_uniform_vector_set_x (SCM v, SCM idx, SCM val);
56SCM_DEPRECATED SCM scm_uniform_vector_to_list (SCM v);
57SCM_DEPRECATED SCM scm_uniform_vector_read_x (SCM v, SCM port_or_fd,
58 SCM start, SCM end);
59SCM_DEPRECATED SCM scm_uniform_vector_write (SCM v, SCM port_or_fd,
60 SCM start, SCM end);
61
62SCM_DEPRECATED int scm_is_uniform_vector (SCM obj);
63SCM_DEPRECATED size_t scm_c_uniform_vector_length (SCM v);
64SCM_DEPRECATED SCM scm_c_uniform_vector_ref (SCM v, size_t idx);
65SCM_DEPRECATED void scm_c_uniform_vector_set_x (SCM v, size_t idx, SCM val);
66SCM_DEPRECATED const void *scm_uniform_vector_elements (SCM uvec,
67 scm_t_array_handle *h,
68 size_t *lenp,
69 ssize_t *incp);
70SCM_DEPRECATED void *scm_uniform_vector_writable_elements (SCM uvec,
71 scm_t_array_handle *h,
72 size_t *lenp,
73 ssize_t *incp);
74
75#endif
476b894c
AW
76
77SCM_INTERNAL void scm_init_uniform (void);
78
79#endif /* SCM_UNIFORM_H */
80
81/*
82 Local Variables:
83 c-file-style: "gnu"
84 End:
85*/