primitive-load returns the value(s) of the last expression
[bpt/guile.git] / libguile / arrays.h
CommitLineData
0f2d19dd
JB
1/* classes: h_files */
2
1030b450
AW
3#ifndef SCM_ARRAY_H
4#define SCM_ARRAY_H
b29058ff 5
73788ca8 6/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
b29058ff 7 *
73be1d9e 8 * This library is free software; you can redistribute it and/or
53befeb7
NJ
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.
b29058ff 12 *
53befeb7
NJ
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
b29058ff 17 *
73be1d9e
MV
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
53befeb7
NJ
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
73be1d9e 22 */
d3a6bc94 23
0f2d19dd
JB
24\f
25
b4309c3c 26#include "libguile/__scm.h"
9598a406 27#include "libguile/print.h"
0f2d19dd
JB
28
29\f
1d7bdb25 30
1030b450
AW
31/* Multidimensional arrays. Woo hoo!
32 Also see ....
33 */
20930f28
MV
34
35
36/** Arrays */
37
f301dbf3 38SCM_API SCM scm_make_array (SCM fill, SCM bounds);
73788ca8
AW
39SCM_API SCM scm_from_contiguous_array (SCM bounds, const SCM *elts,
40 size_t len);
f301dbf3 41SCM_API SCM scm_make_typed_array (SCM type, SCM fill, SCM bounds);
782a82ee
AW
42SCM_API SCM scm_from_contiguous_typed_array (SCM type, SCM bounds,
43 const void *bytes,
44 size_t byte_len);
33b001fd
MV
45SCM_API SCM scm_shared_array_root (SCM ra);
46SCM_API SCM scm_shared_array_offset (SCM ra);
47SCM_API SCM scm_shared_array_increments (SCM ra);
33b001fd
MV
48SCM_API SCM scm_make_shared_array (SCM oldra, SCM mapfunc, SCM dims);
49SCM_API SCM scm_transpose_array (SCM ra, SCM args);
33b001fd 50SCM_API SCM scm_array_contents (SCM ra, SCM strict);
f301dbf3
MV
51SCM_API SCM scm_list_to_array (SCM ndim, SCM lst);
52SCM_API SCM scm_list_to_typed_array (SCM type, SCM ndim, SCM lst);
20930f28 53
0cd6cb2f
MV
54/* internal. */
55
04b87de5
MV
56typedef struct scm_i_t_array
57{
58 SCM v; /* the contents of the array, e.g., a vector or uniform vector. */
59 unsigned long base;
60} scm_i_t_array;
61
8c93b597 62SCM_INTERNAL scm_t_bits scm_i_tc16_array;
04b87de5 63
c395cb78 64#define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0)
04b87de5
MV
65
66#define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_i_tc16_array, a)
c395cb78
AW
67#define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_SMOB_FLAGS (x)>>1))
68#define SCM_I_ARRAY_CONTP(x) (SCM_SMOB_FLAGS(x) & SCM_I_ARRAY_FLAG_CONTIGUOUS)
04b87de5 69
c395cb78 70#define SCM_I_ARRAY_MEM(a) ((scm_i_t_array *) SCM_SMOB_DATA_1 (a))
04b87de5
MV
71#define SCM_I_ARRAY_V(a) (SCM_I_ARRAY_MEM (a)->v)
72#define SCM_I_ARRAY_BASE(a) (SCM_I_ARRAY_MEM (a)->base)
73#define SCM_I_ARRAY_DIMS(a) \
74 ((scm_t_array_dim *)((char *) SCM_I_ARRAY_MEM (a) + sizeof (scm_i_t_array)))
75
66b9d7d3 76SCM_INTERNAL SCM scm_i_make_array (int ndim);
102dbb6f 77SCM_INTERNAL SCM scm_i_read_array (SCM port, int c);
0cd6cb2f 78
2fa901a5 79SCM_INTERNAL void scm_init_arrays (void);
0f2d19dd 80
1030b450 81#endif /* SCM_ARRAYS_H */
89e00824
ML
82
83/*
84 Local Variables:
85 c-file-style: "gnu"
86 End:
87*/