From 1bbf7f75805c10c4d7715853cd7d6c3e8226d5fc Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 10 Feb 2015 14:35:35 +0100 Subject: [PATCH] Add `scm_smob_type_class()'. * libguile/smob.h: * libguile/smob.c (scm_smob_type_class): New function, to access the GOOPS class for a SMOB type. --- libguile/smob.c | 12 ++++++++++++ libguile/smob.h | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libguile/smob.c b/libguile/smob.c index 2a6c96f3a..eecefd3dc 100644 --- a/libguile/smob.c +++ b/libguile/smob.c @@ -443,6 +443,18 @@ scm_i_new_double_smob (scm_t_bits tc, scm_t_bits data1, return ret; } + + + +SCM +scm_smob_type_class (scm_t_bits tc) +{ + scm_load_goops (); + + return scm_i_smob_class[SCM_TC2SMOBNUM (tc)]; +} + + void scm_smob_prehistory () diff --git a/libguile/smob.h b/libguile/smob.h index 0e59f89d0..561a6d124 100644 --- a/libguile/smob.h +++ b/libguile/smob.h @@ -4,7 +4,7 @@ #define SCM_SMOB_H /* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2009, - * 2010, 2011, 2012 Free Software Foundation, Inc. + * 2010, 2011, 2012, 2015 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 @@ -190,6 +190,8 @@ SCM_API void scm_set_smob_apply (scm_t_bits tc, unsigned int opt, unsigned int rst); +SCM_API SCM scm_smob_type_class (scm_t_bits tc); + SCM_API void scm_assert_smob_type (scm_t_bits tag, SCM val); /* Function for creating smobs */