guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making guardians a module?


From: Dirk Herrmann
Subject: Making guardians a module?
Date: Tue, 5 Dec 2000 19:01:47 +0100 (MET)

Hello everybody,

I just realized that it would be easily possible to extract guardians into
a module that was only initialized if necessary.  Below is a possible
implementation for it.  However, I am not sure whether it is a good idea
at all, and whether the solution below is good/portable at all.  At least,
it works here :-)

Dirk Herrmann


Index: ice-9/Makefile.am
===================================================================
RCS file: /cvs/guile/guile-core/ice-9/Makefile.am,v
retrieving revision 1.32
diff -u -r1.32 Makefile.am
--- ice-9/Makefile.am   2000/08/11 00:45:09     1.32
+++ ice-9/Makefile.am   2000/12/05 17:53:46
@@ -30,7 +30,8 @@
        posix.scm psyntax.pp psyntax.ss q.scm r4rs.scm r5rs.scm           \
        receive.scm srfi-8.scm                                            \
        regex.scm runq.scm safe-r5rs.scm safe.scm session.scm slib.scm    \
-       streams.scm string-fun.scm syncase.scm tags.scm threads.scm 
+       streams.scm string-fun.scm syncase.scm tags.scm threads.scm       \
+       guardians.scm
 
 subpkgdatadir = $(pkgdatadir)/$(VERSION)/ice-9
 subpkgdata_DATA = $(ice9_sources)



Index: libguile/guardians.c
===================================================================
RCS file: /cvs/guile/guile-core/libguile/guardians.c,v
retrieving revision 1.24
diff -u -r1.24 guardians.c
--- libguile/guardians.c        2000/12/05 03:04:20     1.24
+++ libguile/guardians.c        2000/12/05 17:54:10
@@ -56,6 +56,7 @@
 
 
 #include "libguile/_scm.h"
+#include "libguile/feature.h"
 #include "libguile/ports.h"
 #include "libguile/print.h"
 #include "libguile/smob.h"
@@ -341,6 +342,8 @@
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/guardians.x"
 #endif
+
+  scm_add_feature ("guardians");
 }
 
 /*


NOTE:  The following patch does not apply.  It's an extract of
the actual patch, which holds some more stuff locally here.

Index: libguile/init.c
===================================================================
RCS file: /cvs/guile/guile-core/libguile/init.c,v
retrieving revision 1.106
diff -u -r1.106 init.c
--- libguile/init.c     2000/11/26 18:27:49     1.106
+++ libguile/init.c     2000/12/05 17:54:10
@@ -138,7 +140,6 @@
 #include "libguile/version.h"
 #include "libguile/vports.h"
 #include "libguile/weaks.h"
-#include "libguile/guardians.h"
 
 #include "libguile/init.h"
 
@@ -572,7 +575,6 @@
   scm_init_vectors ();
   scm_init_version ();
   scm_init_weaks ();
-  scm_init_guardian ();
   scm_init_vports ();
   scm_init_eval ();
   scm_init_evalext ();


New file:  ice-9/guardians.scm:

;;;;    Copyright (C) 2000 Free Software Foundation, Inc.
;;;; 
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2, or (at your option)
;;;; any later version.
;;;; 
;;;; This program 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 General Public License for more details.
;;;; 
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING.  If not, write to
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA
;;;; 

;;;; Guardians

(define-module (ice-9 guardians))

(if (not (feature? 'guardians))
    (dynamic-call "scm_init_guardian" (dynamic-link "libguile.so")))

(define-public make-guardian make-guardian)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]