aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cuprate/rewriters.chicken.sld
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-11-01 22:29:42 -0400
committerGravatar Peter McGoron 2025-11-01 22:29:42 -0400
commit44e4fd1e1f914e5b307435769c8909da8a72aafb (patch)
tree0c5e707c836f646229462adb08314ac8988e2d14 /lib/cuprate/rewriters.chicken.sld
parentadd expect-to-fail (diff)
Big rewrite:
1. Rename to "cuprate". 2. Remove mutexes. 3. Move rewriters to other library. 4. Move the DTO out of the `test-info` parameter. They are now separate parameters, with the expectation that the DTO will not change over time. This significantly reduces the complexity of the code. 5. Use SRFI-146 for Chicken.
Diffstat (limited to 'lib/cuprate/rewriters.chicken.sld')
-rw-r--r--lib/cuprate/rewriters.chicken.sld35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/cuprate/rewriters.chicken.sld b/lib/cuprate/rewriters.chicken.sld
new file mode 100644
index 0000000..82a275c
--- /dev/null
+++ b/lib/cuprate/rewriters.chicken.sld
@@ -0,0 +1,35 @@
+(define-library (cuprate rewriters)
+ (import (scheme base) (scheme write)
+ (chicken memory representation)
+ (chicken condition))
+ (export rewriters rewrite)
+ (begin
+ (define (default-on-pair pair)
+ (cons (rewrite (car pair))
+ (rewrite (cdr pair))))
+ (define (default-on-vector vec)
+ (vector-map rewrite vec))
+ (define (default-on-error error)
+ (cons 'error
+ (cons (error-object-message error)
+ (error-object-irritants error))))
+ (define (default-on-condition cond)
+ (map rewrite (condition->list cond)))
+ (define (default-on-record rec)
+ `(record (name ,(rewrite (record-instance-type rec)))
+ (elements
+ ,(vector-map rewrite (record->vector rec)))))
+ (define rewriters
+ (make-parameter
+ `((,pair? . ,default-on-pair)
+ (,vector? . ,default-on-vector)
+ (,error-object? . ,default-on-error)
+ (,condition? . ,default-on-condition)
+ (,record-instance? . ,default-on-record))))
+ (define (rewrite obj)
+ (let loop ((rewriters (rewriters)))
+ (cond
+ ((null? rewriters) obj)
+ (((caar rewriters) obj) ((cdar rewriters) obj))
+ (else (loop (cdr rewriters))))))))
+
retro' width='13' height='13' alt='Gravatar' /> 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