From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: prj@po.cwru.edu (Paul Jarc) Newsgroups: gmane.lisp.guile.devel Subject: Re: Scheme-defined smobs Date: Thu, 06 Nov 2003 11:25:50 -0500 Organization: What did you have in mind? A short, blunt, human pyramid? Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <87wuaehh65.fsf@zagadka.ping.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1068136159 17396 80.91.224.253 (6 Nov 2003 16:29:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Nov 2003 16:29:19 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Nov 06 17:29:16 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AHn0W-000633-00 for ; Thu, 06 Nov 2003 17:29:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AHmzC-0002Pv-Ta for guile-devel@m.gmane.org; Thu, 06 Nov 2003 11:27:54 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AHmyM-0001mU-Fg for guile-devel@gnu.org; Thu, 06 Nov 2003 11:27:02 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AHmxi-0001Jz-4E for guile-devel@gnu.org; Thu, 06 Nov 2003 11:26:53 -0500 Original-Received: from [129.22.104.63] (helo=harris.CNS.CWRU.Edu) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AHmxh-0000x1-4W for guile-devel@gnu.org; Thu, 06 Nov 2003 11:26:21 -0500 Original-Received: from conversion-daemon.smtp-a.cwru.edu by smtp-a.cwru.edu (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) id <0HNX00B01UYNST@smtp-a.cwru.edu> for guile-devel@gnu.org; Thu, 06 Nov 2003 11:25:51 -0500 (EST) Original-Received: from multivac.cwru.edu (multivac.ITS.CWRU.Edu [129.22.114.26]) by smtp-a.cwru.edu (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with SMTP id <0HNX00BH8UZ3IQ@smtp-a.cwru.edu> for guile-devel@gnu.org; Thu, 06 Nov 2003 11:25:51 -0500 (EST) Original-Received: (qmail 20925 invoked by uid 500); Thu, 06 Nov 2003 16:26:13 +0000 In-reply-to: <87wuaehh65.fsf@zagadka.ping.de> Original-To: Marius Vollmer Mail-followup-to: Marius Vollmer , guile-devel@gnu.org Mail-Copies-To: nobody User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Original-Lines: 80 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2977 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2977 Marius Vollmer wrote: > New data types in Scheme should be created with GOOPS. Is there > something missing in GOOPS that keeps you from implementing this with > define-class, etc? Ah - only that I wasn't familiar with GOOPS. How about these snarfing macros, though? * snarf.h (SCM_SMOB, SCM_GLOBAL_SMOB, SCM_SMOB_MARK, SCM_GLOBAL_SMOB_MARK, SCM_SMOB_FREE, SCM_GLOBAL_SMOB_FREE, SCM_SMOB_PRINT, SCM_GLOBAL_SMOB_PRINT, SCM_SMOB_EQUALP, SCM_GLOBAL_SMOB_EQUALP, SCM_SMOB_APPLY, SCM_GLOBAL_SMOB_APPLY): New macros. Index: guile-core/libguile/snarf.h =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/snarf.h,v retrieving revision 1.61 diff -u -r1.61 snarf.h --- guile-core/libguile/snarf.h 5 Apr 2003 19:10:22 -0000 1.61 +++ guile-core/libguile/snarf.h 6 Nov 2003 16:12:02 -0000 @@ -221,6 +221,54 @@ SCM_SNARF_HERE(scm_t_rec_mutex c_name) \ SCM_SNARF_INIT(scm_i_plugin_rec_mutex_init (&c_name, &scm_i_plugin_rec_mutex)) +#define SCM_SMOB(tag, scheme_name, size) \ +SCM_SNARF_HERE(static scm_t_bits tag) \ +SCM_SNARF_INIT((tag)=scm_make_smob_type((scheme_name), (size));) + +#define SCM_GLOBAL_SMOB(tag, scheme_name, size) \ +SCM_SNARF_HERE(scm_t_bits tag) \ +SCM_SNARF_INIT((tag)=scm_make_smob_type((scheme_name), (size));) + +#define SCM_SMOB_MARK(tag, c_name, arg) \ +SCM_SNARF_HERE(static SCM c_name(SCM arg)) \ +SCM_SNARF_INIT(scm_set_smob_mark((tag), (c_name));) + +#define SCM_GLOBAL_SMOB_MARK(tag, c_name, arg) \ +SCM_SNARF_HERE(SCM c_name(SCM arg)) \ +SCM_SNARF_INIT(scm_set_smob_mark((tag), (c_name));) + +#define SCM_SMOB_FREE(tag, c_name, arg) \ +SCM_SNARF_HERE(static size_t c_name(SCM arg)) \ +SCM_SNARF_INIT(scm_set_smob_free((tag), (c_name));) + +#define SCM_GLOBAL_SMOB_FREE(tag, c_name, arg) \ +SCM_SNARF_HERE(size_t c_name(SCM arg)) \ +SCM_SNARF_INIT(scm_set_smob_free((tag), (c_name));) + +#define SCM_SMOB_PRINT(tag, c_name, obj, port, pstate) \ +SCM_SNARF_HERE(static int c_name(SCM obj, SCM port, scm_print_state* pstate)) \ +SCM_SNARF_INIT(scm_set_smob_print((tag), (c_name));) + +#define SCM_GLOBAL_SMOB_PRINT(tag, c_name, obj, port, pstate) \ +SCM_SNARF_HERE(int c_name(SCM obj, SCM port, scm_print_state* pstate)) \ +SCM_SNARF_INIT(scm_set_smob_print((tag), (c_name));) + +#define SCM_SMOB_EQUALP(tag, c_name, obj1, obj2) \ +SCM_SNARF_HERE(static SCM c_name(SCM obj1, SCM obj2)) \ +SCM_SNARF_INIT(scm_set_smob_equalp((tag), (c_name));) + +#define SCM_GLOBAL_SMOB_EQUALP(tag, c_name, obj1, obj2) \ +SCM_SNARF_HERE(SCM c_name(SCM obj1, SCM obj2)) \ +SCM_SNARF_INIT(scm_set_smob_equalp((tag), (c_name));) + +#define SCM_SMOB_APPLY(tag, c_name, req, opt, rest, arglist) \ +SCM_SNARF_HERE(static SCM c_name arglist) \ +SCM_SNARF_INIT(scm_set_smob_apply((tag), (c_name), (req), (opt), (rest));) + +#define SCM_GLOBAL_SMOB_APPLY(tag, c_name, req, opt, rest, arglist) \ +SCM_SNARF_HERE(SCM c_name arglist) \ +SCM_SNARF_INIT(scm_set_smob_apply((tag), (c_name), (req), (opt), (rest));) + #ifdef SCM_MAGIC_SNARF_DOCS #undef SCM_ASSERT #define SCM_ASSERT(_cond, _arg, _pos, _subr) ^^ argpos _arg _pos __LINE__ ^^ paul _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel