Commit | Line | Data |
---|---|---|
a7ee7f7c AW |
1 | #ifndef SCM_FOREIGN_OBJECT_H |
2 | #define SCM_FOREIGN_OBJECT_H | |
3 | ||
4 | /* Copyright (C) 2014 Free Software Foundation, Inc. | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public License | |
8 | * as published by the Free Software Foundation; either version 3 of | |
9 | * the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
19 | * 02110-1301 USA | |
20 | */ | |
21 | ||
22 | \f | |
23 | ||
24 | #include "libguile/__scm.h" | |
25 | #include "libguile/print.h" | |
26 | ||
27 | ||
28 | \f | |
29 | ||
30 | SCM_API SCM scm_make_foreign_object_type (SCM name, SCM slot_names, | |
31 | scm_t_struct_finalize finalizer); | |
32 | ||
33 | SCM_API void scm_assert_foreign_object_type (SCM type, SCM val); | |
34 | ||
4b8ce7c7 AW |
35 | /* All objects of a given foreign object type have the same number of |
36 | fields. When constructing a foreign object, you don't have to pass | |
37 | initializers for all of the fields; it is always OK to call | |
38 | scm_make_foreign_object_0 and initialize the fields by hand with | |
39 | scm_foreign_object_set_x or other setters. The initial value of | |
40 | fields that haven't been explicitly given a value is 0. */ | |
ea4c2460 | 41 | SCM_API SCM scm_make_foreign_object_0 (SCM type); |
4b8ce7c7 AW |
42 | SCM_API SCM scm_make_foreign_object_1 (SCM type, void *val0); |
43 | SCM_API SCM scm_make_foreign_object_2 (SCM type, void *val0, void *val1); | |
44 | SCM_API SCM scm_make_foreign_object_3 (SCM type, void *val0, void *val1, | |
45 | void *val2); | |
46 | SCM_API SCM scm_make_foreign_object_n (SCM type, size_t n, void *vals[]); | |
47 | ||
48 | SCM_API void* scm_foreign_object_ref (SCM obj, size_t n); | |
49 | SCM_API void scm_foreign_object_set_x (SCM obj, size_t n, void *val); | |
50 | ||
51 | SCM_API scm_t_bits scm_foreign_object_unsigned_ref (SCM obj, size_t n); | |
52 | SCM_API void scm_foreign_object_unsigned_set_x (SCM obj, size_t n, | |
53 | scm_t_bits val); | |
54 | ||
55 | SCM_API scm_t_signed_bits scm_foreign_object_signed_ref (SCM obj, size_t n); | |
56 | SCM_API void scm_foreign_object_signed_set_x (SCM obj, size_t n, | |
57 | scm_t_signed_bits val); | |
a7ee7f7c AW |
58 | |
59 | SCM_INTERNAL void scm_register_foreign_object (void); | |
60 | ||
61 | ||
62 | #endif /* SCM_FOREIGN_OBJECT_H */ |