summaryrefslogtreecommitdiffstats
path: root/srfi
diff options
context:
space:
mode:
authorGravatar Arvydas Silanskas 2021-08-22 10:50:54 +0300
committerGravatar Arvydas Silanskas 2021-08-22 10:50:54 +0300
commit80b2c2767d5b35deb5f1b0ba25b258271f10fe66 (patch)
tree25dd764ac1f28a27cecd813fe44ea42a931183a3 /srfi
parentmerge (diff)
fix default implementation
Diffstat (limited to 'srfi')
-rw-r--r--srfi/default-impl.scm21
-rw-r--r--srfi/externals.scm16
2 files changed, 26 insertions, 11 deletions
diff --git a/srfi/default-impl.scm b/srfi/default-impl.scm
index 4253f6a..dfd3f58 100644
--- a/srfi/default-impl.scm
+++ b/srfi/default-impl.scm
@@ -77,12 +77,12 @@
(define (default-dict-delete-all* dtd dictionary dict-search-proc keylist)
(let loop ((keylist keylist)
- (dictionary dictionary))
+ (d dictionary))
(cond
- ((null? keylist) dictionary)
+ ((null? keylist) d)
(else (let*-values
(((key) (car keylist))
- ((new-d _) (dict-search-proc dtd dictionary key
+ ((new-d _) (dict-search-proc dtd d key
(lambda (_ ignore)
(ignore #f))
(lambda (key old-value _ delete)
@@ -198,7 +198,7 @@
(lambda (key)
(not (pred key (dict-ref dtd dictionary key))))
keys))
- (dict-delete-all-proc dtd dictionary keys))
+ (dict-delete-all-proc dtd dictionary keys-to-delete))
(define (default-dict-filter dtd pred dictionary)
(default-dict-filter* dtd dict-delete-all pred dictionary))
@@ -218,11 +218,20 @@
(define (default-dict-remove! dtd pred dictionary)
(default-dict-remove* dtd dict-filter! pred dictionary))
+ (define (create-fresh-dict-from-existing dtd dictionary)
+ (call/cc
+ (lambda (k)
+ (with-exception-handler
+ (lambda (err)
+ (k (make-dictionary dtd #f)))
+ (lambda ()
+ (make-dictionary dtd (dict-comparator dictionary)))))))
+
(define (default-dict-copy dtd dictionary)
- (define dict (make-dictionary (dict-comparator dtd dictionary)))
+ (define dict (create-fresh-dict-from-existing dtd dictionary))
(dict-for-each dtd
(lambda (key value)
- (set! dict (dict-set! dtd key value)))
+ (set! dict (dict-set! dtd dict key value)))
dictionary)
dict)
diff --git a/srfi/externals.scm b/srfi/externals.scm
index 8fee936..34c8450 100644
--- a/srfi/externals.scm
+++ b/srfi/externals.scm
@@ -11,12 +11,18 @@
(message dictionary-message)
(irritants dictionary-irritants))
+(define-syntax dtd-ref-stx
+ (syntax-rules ()
+ ((_ dtd index)
+ (begin
+ (vector-ref (procvec dtd) index)))))
+
(define-syntax define/dict-proc
(syntax-rules ()
((_ proc index)
(define (proc dtd . args)
(assume (dtd? dtd))
- (apply (vector-ref (procvec dtd) index) dtd args)))))
+ (apply (dtd-ref-stx dtd index) dtd args)))))
(define/dict-proc make-dictionary make-dictionary-index)
(define/dict-proc dictionary? dictionary?-index)
@@ -35,7 +41,7 @@
((dtd dict key failure success)
(assume (dtd? dtd))
- ((vector-ref (procvec dtd) dict-ref-index) dtd dict key failure success))))
+ ((dtd-ref-stx dtd dict-ref-index) dtd dict key failure success))))
(define/dict-proc dict-ref/default dict-ref/default-index)
(define/dict-proc dict-set dict-set-index)
@@ -63,7 +69,7 @@
((dtd dict key updater failure success)
(assume (dtd? dtd))
- ((vector-ref (procvec dtd) dict-update-index) dtd dict key updater failure success))))
+ ((dtd-ref-stx dtd dict-update-index) dtd dict key updater failure success))))
(define dict-update!
(case-lambda
@@ -77,7 +83,7 @@
((dtd dict key updater failure success)
(assume (dtd? dtd))
- ((vector-ref (procvec dtd) dict-update!-index) dtd dict key updater failure success))))
+ ((dtd-ref-stx dtd dict-update!-index) dtd dict key updater failure success))))
(define/dict-proc dict-update/default dict-update/default-index)
(define/dict-proc dict-update/default! dict-update/default!-index)
@@ -106,7 +112,7 @@
(define/dict-proc dict-comparator dict-comparator-index)
(define (dtd-ref dtd procindex)
- (vector-ref (procvec dtd) procindex))
+ (dtd-ref-stx dtd procindex))
(define (make-modified-dtd dtd . lst)
(define vec (vector-copy (procvec dtd)))
/rules?h=v2.0.4&id=bbfc1944cd33de7056dc9617f9d9a977978032fa&follow=1'>Added control files for Debian packages.Gravatar aeb 6-8/+106 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@37 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-09-01Added missing prototypes for iso send functions.Gravatar aeb 1-0/+7 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@36 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-08-08Added raw1394_get_irm_id().Gravatar aeb 7-7/+39 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@35 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-08-06Added support for isochronous sending.Gravatar aeb 3-0/+35 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@34 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-07-05Added raw1394_reset_bus() call.Gravatar aeb 4-0/+23 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@33 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-06-22- Set library version info in configure.in, use in src/Makefile.am.Gravatar aeb 4-2/+16 - Enable compiler warnings. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@32 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-06-15Update libtool version number.Gravatar aeb 2-2/+2 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@31 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-06-14Added copyright headers.Gravatar aeb 6-0/+54 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@30 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-06-11Added explicit AC_PROG_INSTALL call.Gravatar aeb 1-0/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@29 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-06-09Fix size of error field.Gravatar aeb 1-2/+2 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@28 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-06-02Modified support for 32/64 bit environments, control struct fields have ↵Gravatar aeb 7-43/+28 fixed size now. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@27 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-05-28Added support for environments with 64 bit kernel and 32 bit userland.Gravatar aeb 8-7/+45 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@26 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-04-27Fixed missing setting of ext code in raw1394_start_lock()Gravatar aeb 1-0/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@25 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-04-15Fixed lock transaction to actually return response value.Gravatar aeb 3-5/+11 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@24 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-04-12Add userdata functions as news.Gravatar aeb 1-0/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@23 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-04-05Add userdata functions.Gravatar aeb 3-0/+18 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@22 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-03-18Bump version number to 0.6.Gravatar aeb 3-5/+6 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@21 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-03-18Mention byte order change.Gravatar aeb 1-0/+2 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@20 53a565d1-3bb7-0310-b661-cf11e63c67ab 2000-03-18Mention SourceForge home.Gravatar aeb 1-1/+5 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@19 53a565d1-3bb7-0310-b661-cf11e63c67ab