Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
1030b450 AW |
3 | #ifndef SCM_ARRAY_H |
4 | #define SCM_ARRAY_H | |
b29058ff | 5 | |
493ceb99 MW |
6 | /* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009, |
7 | * 2010, 2012 Free Software Foundation, Inc. | |
b29058ff | 8 | * |
73be1d9e | 9 | * This library is free software; you can redistribute it and/or |
53befeb7 NJ |
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. | |
b29058ff | 13 | * |
53befeb7 NJ |
14 | * This library is distributed in the hope that it will be useful, but |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
73be1d9e MV |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | * Lesser General Public License for more details. | |
b29058ff | 18 | * |
73be1d9e MV |
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 | |
53befeb7 NJ |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
22 | * 02110-1301 USA | |
73be1d9e | 23 | */ |
d3a6bc94 | 24 | |
0f2d19dd JB |
25 | \f |
26 | ||
b4309c3c | 27 | #include "libguile/__scm.h" |
9598a406 | 28 | #include "libguile/print.h" |
0f2d19dd JB |
29 | |
30 | \f | |
1d7bdb25 | 31 | |
1030b450 AW |
32 | /* Multidimensional arrays. Woo hoo! |
33 | Also see .... | |
34 | */ | |
20930f28 MV |
35 | |
36 | ||
37 | /** Arrays */ | |
38 | ||
f301dbf3 | 39 | SCM_API SCM scm_make_array (SCM fill, SCM bounds); |
73788ca8 AW |
40 | SCM_API SCM scm_from_contiguous_array (SCM bounds, const SCM *elts, |
41 | size_t len); | |
f301dbf3 | 42 | SCM_API SCM scm_make_typed_array (SCM type, SCM fill, SCM bounds); |
782a82ee AW |
43 | SCM_API SCM scm_from_contiguous_typed_array (SCM type, SCM bounds, |
44 | const void *bytes, | |
45 | size_t byte_len); | |
33b001fd MV |
46 | SCM_API SCM scm_shared_array_root (SCM ra); |
47 | SCM_API SCM scm_shared_array_offset (SCM ra); | |
48 | SCM_API SCM scm_shared_array_increments (SCM ra); | |
33b001fd MV |
49 | SCM_API SCM scm_make_shared_array (SCM oldra, SCM mapfunc, SCM dims); |
50 | SCM_API SCM scm_transpose_array (SCM ra, SCM args); | |
33b001fd | 51 | SCM_API SCM scm_array_contents (SCM ra, SCM strict); |
f301dbf3 MV |
52 | SCM_API SCM scm_list_to_array (SCM ndim, SCM lst); |
53 | SCM_API SCM scm_list_to_typed_array (SCM type, SCM ndim, SCM lst); | |
20930f28 | 54 | |
0cd6cb2f MV |
55 | /* internal. */ |
56 | ||
c395cb78 | 57 | #define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0) |
04b87de5 | 58 | |
b2637c98 AW |
59 | #define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_tc7_array, a) |
60 | #define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)>>17)) | |
61 | #define SCM_I_ARRAY_CONTP(x) (SCM_CELL_WORD_0 (x) & (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16)) | |
04b87de5 | 62 | |
65704b98 DL |
63 | #define SCM_I_ARRAY_V(a) SCM_CELL_OBJECT_1 (a) |
64 | #define SCM_I_ARRAY_BASE(a) ((size_t) SCM_CELL_WORD_2 (a)) | |
65 | #define SCM_I_ARRAY_DIMS(a) ((scm_t_array_dim *) SCM_CELL_OBJECT_LOC (a, 3)) | |
66 | ||
67 | #define SCM_I_ARRAY_SET_V(a, v) SCM_SET_CELL_OBJECT_1(a, v) | |
68 | #define SCM_I_ARRAY_SET_BASE(a, base) SCM_SET_CELL_WORD_2(a, base) | |
04b87de5 | 69 | |
66b9d7d3 | 70 | SCM_INTERNAL SCM scm_i_make_array (int ndim); |
b2637c98 | 71 | SCM_INTERNAL int scm_i_print_array (SCM array, SCM port, scm_print_state *pstate); |
0cd6cb2f | 72 | |
2fa901a5 | 73 | SCM_INTERNAL void scm_init_arrays (void); |
0f2d19dd | 74 | |
1030b450 | 75 | #endif /* SCM_ARRAYS_H */ |
89e00824 ML |
76 | |
77 | /* | |
78 | Local Variables: | |
79 | c-file-style: "gnu" | |
80 | End: | |
81 | */ |