\f
+SCM_SYMBOL (sym_void, "void");
+SCM_SYMBOL (sym_float, "float");
+SCM_SYMBOL (sym_double, "double");
+SCM_SYMBOL (sym_uint8, "uint8");
+SCM_SYMBOL (sym_int8, "int8");
+SCM_SYMBOL (sym_uint16, "uint16");
+SCM_SYMBOL (sym_int16, "int16");
+SCM_SYMBOL (sym_uint32, "uint32");
+SCM_SYMBOL (sym_int32, "int32");
+SCM_SYMBOL (sym_uint64, "uint64");
+SCM_SYMBOL (sym_int64, "int64");
+
static void
foreign_finalizer_trampoline (GC_PTR ptr, GC_PTR data)
{
\f
-void
+static void
scm_init_foreign (void)
{
#ifndef SCM_MAGIC_SNARFER
#include "libguile/foreign.x"
#endif
+ scm_define (sym_void, scm_from_uint8 (SCM_FOREIGN_TYPE_VOID));
+ scm_define (sym_float, scm_from_uint8 (SCM_FOREIGN_TYPE_FLOAT));
+ scm_define (sym_double, scm_from_uint8 (SCM_FOREIGN_TYPE_DOUBLE));
+ scm_define (sym_uint8, scm_from_uint8 (SCM_FOREIGN_TYPE_UINT8));
+ scm_define (sym_int8, scm_from_uint8 (SCM_FOREIGN_TYPE_INT8));
+ scm_define (sym_uint16, scm_from_uint8 (SCM_FOREIGN_TYPE_UINT16));
+ scm_define (sym_int16, scm_from_uint8 (SCM_FOREIGN_TYPE_INT16));
+ scm_define (sym_uint32, scm_from_uint8 (SCM_FOREIGN_TYPE_UINT32));
+ scm_define (sym_int32, scm_from_uint8 (SCM_FOREIGN_TYPE_INT32));
+ scm_define (sym_uint64, scm_from_uint8 (SCM_FOREIGN_TYPE_UINT64));
+ scm_define (sym_int64, scm_from_uint8 (SCM_FOREIGN_TYPE_INT64));
+}
+
+void
+scm_register_foreign (void)
+{
+ scm_c_register_extension ("libguile", "scm_init_foreign",
+ (scm_t_extension_init_func)scm_init_foreign,
+ NULL);
}
/*
--- /dev/null
+;;;; Copyright (C) 2010 Free Software Foundation, Inc.
+;;;;
+;;;; This library is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU Lesser General Public
+;;;; License as published by the Free Software Foundation; either
+;;;; version 2.1 of the License, or (at your option) any later version.
+;;;;
+;;;; This library is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;;;; Lesser General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU Lesser General Public
+;;;; License along with this library; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;;;;
+\f
+
+(define-module (system foreign)
+ #:export (void
+ float double
+ int8 uint8
+ uint16 int16
+ uint32 int32
+ uint64 int64
+
+ foreign-ref foreign-set!))
+
+(load-extension "libguile" "scm_init_foreign")