1 ;;;============================================================================
3 ;;; File: "_std#.scm", Time-stamp: <2008-02-08 22:44:13 feeley>
5 ;;; Copyright (c) 1994-2008 by Marc Feeley, All Rights Reserved.
7 ;;;============================================================================
9 ;;; Representation of exceptions.
11 (define-library-type-of-exception improper-length-list-exception
12 id: 15d36810-b4bf-4609-83cc-761a8868e4a0
16 (procedure unprintable: read-only:)
17 (arguments unprintable: read-only:)
18 (arg-num unprintable: read-only:)
21 ;;;----------------------------------------------------------------------------
23 ;;; Define type checking macros.
25 (define-check-type string 'string
28 (define-check-type string-list 'string-list
31 (define-check-type vector 'vector
34 (define-check-type vector-list 'vector-list
37 (define-check-type s8vector 's8vector
40 (define-check-type s8vector-list 's8vector-list
43 (define-check-type u8vector 'u8vector
46 (define-check-type u8vector-list 'u8vector-list
49 (define-check-type s16vector 's16vector
52 (define-check-type s16vector-list 's16vector-list
55 (define-check-type u16vector 'u16vector
58 (define-check-type u16vector-list 'u16vector-list
61 (define-check-type s32vector 's32vector
64 (define-check-type s32vector-list 's32vector-list
67 (define-check-type u32vector 'u32vector
70 (define-check-type u32vector-list 'u32vector-list
73 (define-check-type s64vector 's64vector
76 (define-check-type s64vector-list 's64vector-list
79 (define-check-type u64vector 'u64vector
82 (define-check-type u64vector-list 'u64vector-list
85 (define-check-type f32vector 'f32vector
88 (define-check-type f32vector-list 'f32vector-list
91 (define-check-type f64vector 'f64vector
94 (define-check-type f64vector-list 'f64vector-list
97 (define-check-type pair-mutable 'mutable
100 (define-check-type subtyped-mutable 'mutable
103 (define-check-type pair 'pair
106 (define-check-type pair-list 'pair-list
109 (define-check-type list 'list
112 (define-check-type symbol 'symbol
115 (define-check-type char 'char
118 (define-check-type char-list 'char-list
121 (define-check-type procedure 'procedure
124 (define-check-type keyword 'keyword
127 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
128 (##define-macro (macro-fail-check-list arg-num form)
130 (define (rest-param x)
135 (define (nonrest-params x)
137 (cons (car x) (nonrest-params (cdr x)))
140 (define (key-params x)
142 (if (keyword? (car x))
143 (cons (car x) (cons (cadr x) (key-params (cddr x))))
144 (key-params (cdr x)))
147 (define (prekey-params x)
148 (if (or (not (pair? x)) (keyword? (car x)))
150 (cons (car x) (prekey-params (cdr x)))))
152 (define (failure name)
153 (let* ((k (key-params (cdr form)))
154 (r (rest-param (cdr form)))
155 (nr (nonrest-params (cdr form)))
156 (pk (prekey-params nr)))
157 (if (and (null? k) (not (null? r)))
158 `(,name ,arg-num '() ,(car form) ,@pk ,r)
161 ,(if (and (null? k) (null? r))
163 `(##list ,(car form) ,@k ,@(if (null? r) '() (list r))))
166 (failure '##fail-check-list))
168 ;;;============================================================================