From 8d6c5b6a0e609c4ebfdc4bdb56b284eeeb7f654d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 6 Jan 2017 11:51:24 -0800 Subject: [PATCH] Allow register-predicate! to specify multiple supersets. --- src/runtime/predicate-metadata.scm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/runtime/predicate-metadata.scm b/src/runtime/predicate-metadata.scm index d1a851836..7db9532fb 100644 --- a/src/runtime/predicate-metadata.scm +++ b/src/runtime/predicate-metadata.scm @@ -50,8 +50,12 @@ USA. (get-keyword-value keylist 'extra) (get-keyword-value keylist 'description))) (superset (get-keyword-value keylist '<=))) - (if (not (default-object? superset)) - (set-tag<=! tag (predicate->tag superset))))) + (if (not (default-object? superset)) + (for-each (lambda (superset) + (set-tag<=! tag (predicate->tag superset))) + (if (list? superset) + superset + (list superset)))))) (define (predicate->tag predicate #!optional caller) (let ((tag (get-predicate-tag predicate #f))) @@ -245,12 +249,11 @@ USA. (register-predicate! fix:fixnum? 'fixnum '<= exact-integer?) (register-predicate! index-fixnum? 'index-fixnum '<= fix:fixnum?) (register-predicate! negative-fixnum? 'negative-fixnum '<= fix:fixnum?) - (register-predicate! positive-fixnum? 'positive-fixnum '<= fix:fixnum?) - (set-predicate<=! positive-fixnum? exact-positive-integer?) + (register-predicate! positive-fixnum? 'positive-fixnum + '<= (list fix:fixnum? exact-positive-integer?)) (register-predicate! non-negative-fixnum? 'non-negative-fixnum - '<= fix:fixnum?) - (set-predicate<=! non-negative-fixnum? exact-nonnegative-integer?) + '<= (list fix:fixnum? exact-nonnegative-integer?)) (register-predicate! non-positive-fixnum? 'non-positive-fixnum '<= fix:fixnum?) @@ -274,9 +277,13 @@ USA. (register-predicate! thunk? 'thunk '<= procedure?) (register-predicate! unparser-method? 'unparser-method '<= procedure?) + ;; MIT/GNU Scheme: URIs + (register-predicate! uri? 'uniform-resource-identifier) + (register-predicate! absolute-uri? 'absolute-uri '<= uri?) + (register-predicate! relative-uri? 'relative-uri '<= uri?) + ;; MIT/GNU Scheme: other stuff (register-predicate! 8-bit-char? '8-bit-char '<= char?) - (register-predicate! absolute-uri? 'absolute-uri) (register-predicate! dispatch-tag? 'dispatch-tag) (register-predicate! environment? 'environment) (register-predicate! interned-symbol? 'interned-symbol '<= symbol?) @@ -286,7 +293,6 @@ USA. (register-predicate! population? 'population) (register-predicate! record? 'record) (register-predicate! record-type? 'record-type) - (register-predicate! relative-uri? 'relative-uri) (register-predicate! thread? 'thread) (register-predicate! thread-mutex? 'thread-mutex) (register-predicate! undefined-value? 'undefined-value) @@ -294,9 +300,5 @@ USA. (register-predicate! unicode-scalar-value? 'unicode-scalar-value '<= index-fixnum?) (register-predicate! uninterned-symbol? 'uninterned-symbol '<= symbol?) - (register-predicate! uri? 'uniform-resource-identifier) (register-predicate! weak-list? 'weak-list) - (register-predicate! weak-pair? 'weak-pair) - - (set-predicate<=! absolute-uri? uri?) - (set-predicate<=! relative-uri? uri?))) \ No newline at end of file + (register-predicate! weak-pair? 'weak-pair))) \ No newline at end of file -- 2.25.1