New foreign object facility, to replace SMOBs
[bpt/guile.git] / libguile / foreign-object.h
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
35 SCM_API SCM scm_make_foreign_object_1 (SCM type, scm_t_bits val0);
36 SCM_API SCM scm_make_foreign_object_2 (SCM type, scm_t_bits val0,
37 scm_t_bits val1);
38 SCM_API SCM scm_make_foreign_object_3 (SCM type, scm_t_bits val0,
39 scm_t_bits val1, scm_t_bits val2);
40 SCM_API SCM scm_make_foreign_object_n (SCM type, size_t n, scm_t_bits vals[]);
41
42 SCM_API scm_t_bits scm_foreign_object_ref (SCM obj, size_t n);
43 SCM_API void scm_foreign_object_set_x (SCM obj, size_t n, scm_t_bits val);
44
45 SCM_INTERNAL void scm_register_foreign_object (void);
46
47
48 #endif /* SCM_FOREIGN_OBJECT_H */