summaryrefslogtreecommitdiffstats
path: root/srfi/225/srfi-125-impl.sld
blob: a98778753b0d5f384b11db1b585e8bccfe83bbf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
(define-library
  (srfi 225 srfi-125-impl)
  (import (scheme base)
          (srfi 128)
          (prefix (srfi 125) t125-)
          (srfi 225 default-impl)
          (srfi 225 indexes))
  (export hash-table-dto)
  (begin

   (define (t125-hash-table-pure?* dto table)
     #f)

    (define (t125-hash-table-set* dto table . obj)
      (apply t125-hash-table-set! (cons table obj))
      table)

    (define (t125-hash-table-update* dto table key updater fail success)
      (t125-hash-table-update! table key updater fail success)
      table)

    (define (t125-hash-table-update/default* dto table key proc default)
      (t125-hash-table-update!/default table key proc default)
      table)

    (define (t125-hash-table-intern* dto table key failure)
      (values table (t125-hash-table-intern! table key failure)))

    (define (t125-hash-table-pop* dto table)
      (if (t125-hash-table-empty? table)
          (error "popped empty dictionary")
          (call-with-values (lambda () (t125-hash-table-pop! table))
                            (lambda (key value) (values table key value)))))

    (define (t125-hash-table-delete-all* dto table keys)
      (for-each
          (lambda (key)
            (t125-hash-table-delete! table key))
          keys)
      table)

    (define (t125-hash-table-map* dto proc table)
      (t125-hash-table-map! proc table))

    (define (t125-hash-table-filter* dto proc table)
      (t125-hash-table-prune!
          (lambda (key value)
            (not (proc key value)))
          table)
      table)

    (define (t125-hash-table-remove* dto proc table)
      (t125-hash-table-prune! proc table)
      table)

    (define (t125-hash-table-find-update* dto table key fail success)
      ;; instead of running immediately,
      ;; add an indirection through thunk
      ;; to guarantee call in tail position
      (define (make-success-thunk value)
        (define (update new-key new-value)
          (unless (eq? new-key key)
            (t125-hash-table-delete! table key))
          (t125-hash-table-set! table new-key new-value)
          table)
        (define (remove)
          (t125-hash-table-delete! table key)
          table)
        (lambda ()
          (success key value update remove) ))
      (define (make-failure-thunk)
        (define (ignore)
          table)
        (define (insert value)
          (t125-hash-table-set! table key value)
          table)
        (lambda ()
          (fail insert ignore)))
      (define thunk (t125-hash-table-ref table key make-failure-thunk make-success-thunk))
      (thunk))

    (define (t125-hash-table-comparator* dto table)
      (make-comparator (lambda args #t)
                       (t125-hash-table-equivalence-function table)
                       #f
                       (t125-hash-table-hash-function table)))

    (define (t125-hash-table-size* dto table)
      (t125-hash-table-size table))

    (define (t125-hash-table-keys* dto table)
      (t125-hash-table-keys table))

    (define (t125-hash-table-values* dto table)
      (t125-hash-table-values table))

    (define (t125-hash-table-entries* dto table)
      (t125-hash-table-entries table))

    (define (t125-hash-table-fold* dto proc knil table)
      (t125-hash-table-fold proc knil table))

    (define (t125-hash-table-map->list* dto proc table)
      (t125-hash-table-map->list proc table))

    (define (t125-hash-table->alist* dto table)
      (t125-hash-table->alist table))

    (define (t125-hash-table?* dto table)
      (t125-hash-table? table))

    (define (t125-hash-table-empty?* dto table)
      (t125-hash-table-empty? table))

    (define (t125-hash-table-contains?* dto table key)
      (t125-hash-table-contains? table key))

    (define (t125-hash-table-ref* dto table key failure success)
      (t125-hash-table-ref table key failure success))

    (define (t125-hash-table-ref/default* dto table key default)
      (t125-hash-table-ref/default table key default))

    (define hash-table-dto
      (make-dto
        dictionary?-id t125-hash-table?*
        dict-pure?-id t125-hash-table-pure?*
        dict-empty?-id t125-hash-table-empty?*
        dict-contains?-id t125-hash-table-contains?*
        dict-ref-id t125-hash-table-ref*
        dict-ref/default-id t125-hash-table-ref/default*
        dict-set-id t125-hash-table-set*
        dict-delete-all-id t125-hash-table-delete-all*
        dict-intern-id t125-hash-table-intern*
        dict-update-id t125-hash-table-update*
        dict-update/default-id t125-hash-table-update/default*
        dict-pop-id t125-hash-table-pop*
        dict-map-id t125-hash-table-map*
        dict-filter-id t125-hash-table-filter*
        dict-remove-id t125-hash-table-remove*
        dict-find-update-id t125-hash-table-find-update*
        dict-size-id t125-hash-table-size*
        dict-keys-id t125-hash-table-keys*
        dict-values-id t125-hash-table-values*
        dict-entries-id t125-hash-table-entries*
        dict-fold-id t125-hash-table-fold*
        dict-map->list-id t125-hash-table-map->list*
        dict->alist-id t125-hash-table->alist*
        dict-comparator-id t125-hash-table-comparator*))))
03-07-13Update Debian maintainerGravatar bencollins 1-1/+2 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@112 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Update Debian changelog.Gravatar bencollins 1-0/+8 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@111 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13File doesn't really seem needed. The NEWS file gives a good overview, andGravatar bencollins 1-4/+0 the svn log is more than verbose enough for info seekers. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@110 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Fix compiler warnings.Gravatar bencollins 4-12/+22 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@109 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-07-13Updates from 0.10.0 release.Gravatar bencollins 4-5/+14 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@108 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-23add libtoolize to bootstrapGravatar ddennedy 1-1/+10 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@107 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-21added Dan Maas' rawiso docsGravatar ddennedy 1-32/+295 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@106 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-04-07new_handle_on_port() error path fix from Jim RadfordGravatar dmaas 1-1/+3 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@105 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-03-26add raw1394_new_handle_on_port() convenience functionGravatar dmaas 2-1/+41 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@104 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-02-22Updates for new rawiso ioctl interface.Gravatar bencollins 3-37/+125 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@103 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15add iso_xmit_sync() and iso_xmit_write(); clean up iso handling a bitGravatar dmaas 5-39/+161 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@102 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-15implement tag matching for rawiso receptionGravatar dmaas 3-4/+12 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@101 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-06back out previous commit - don't drop the legacy API just yetGravatar dmaas 6-173/+130 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@100 53a565d1-3bb7-0310-b661-cf11e63c67ab 2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@99 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@98 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@97 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; ↵Gravatar anonymous 3-124/+48 brought kernel-raw1394.h back in sync with the kernel version git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@96 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 - changed return type of rawiso xmit/recv handlers from int to enum raw1394_iso_disposition - added an ioctl (RAW1394_ISO_QUEUE_ACTIVITY) to force an ISO_ACTIVITY event into the queue. This is needed for handling RAW1394_ISO_DEFER, to kick us out of the next read() instead of sleeping forever. - removed references to "8-byte" isochronous header - this is an OHCI-specific implementation detail git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@95 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@94 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@93 53a565d1-3bb7-0310-b661-cf11e63c67ab