parts of unif.[ch] to array-handle.[ch]
[bpt/guile.git] / libguile / array-handle.h
1 /* classes: h_files */
2
3 #ifndef SCM_ARRAY_HANDLE_H
4 #define SCM_ARRAY_HANDLE_H
5
6 /* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009 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 typedef struct scm_t_array_dim
31 {
32 ssize_t lbnd;
33 ssize_t ubnd;
34 ssize_t inc;
35 } scm_t_array_dim;
36
37 struct scm_t_array_handle;
38
39 typedef SCM (*scm_i_t_array_ref) (struct scm_t_array_handle *, ssize_t);
40 typedef void (*scm_i_t_array_set) (struct scm_t_array_handle *, ssize_t, SCM);
41
42 typedef struct scm_t_array_handle {
43 SCM array;
44 size_t base;
45 scm_t_array_dim *dims;
46 scm_t_array_dim dim0;
47 scm_i_t_array_ref ref;
48 scm_i_t_array_set set;
49 const void *elements;
50 void *writable_elements;
51 } scm_t_array_handle;
52
53 SCM_API void scm_array_get_handle (SCM array, scm_t_array_handle *h);
54 SCM_API size_t scm_array_handle_rank (scm_t_array_handle *h);
55 SCM_API scm_t_array_dim *scm_array_handle_dims (scm_t_array_handle *h);
56 SCM_API ssize_t scm_array_handle_pos (scm_t_array_handle *h, SCM indices);
57 SCM_API const SCM *scm_array_handle_elements (scm_t_array_handle *h);
58 SCM_API SCM *scm_array_handle_writable_elements (scm_t_array_handle *h);
59 SCM_API void scm_array_handle_release (scm_t_array_handle *h);
60
61 /* See inline.h for scm_array_handle_ref and scm_array_handle_set */
62
63 SCM_INTERNAL void scm_init_array_handle (void);
64
65
66 #endif /* SCM_ARRAY_HANDLE_H */
67
68 /*
69 Local Variables:
70 c-file-style: "gnu"
71 End:
72 */