(declare (usual-integrations))
\f
-(define (register-mit-bytevector-predicates!)
- (register-predicate! u8? 'u8 '<= index-fixnum?)
- (register-predicate! u16? 'u16 '<= index-fixnum?)
- (register-predicate! u32? 'u32 '<= (if (fix:fixnum? #xFFFFFFFF)
- index-fixnum?
- exact-nonnegative-integer?)))
+(defer-boot-action 'predicate-registrations
+ (lambda ()
+ (register-predicate! u8? 'u8 '<= index-fixnum?)
+ (register-predicate! u16? 'u16 '<= index-fixnum?)
+ (register-predicate! u32? 'u32 '<= (if (fix:fixnum? #xFFFFFFFF)
+ index-fixnum?
+ exact-nonnegative-integer?))))
(define (u8? object)
(and (index-fixnum? object)
(declare (usual-integrations))
\f
-(define boot-registrations '())
-
(define (predicate? object)
(any (lambda (reg)
(eqv? (car reg) object))
boot-registrations))
unspecific)
+(define (run-deferred-predicate-registrations!)
+ (for-each (lambda (reg)
+ (apply register-predicate! reg))
+ (reverse! boot-registrations))
+ (set! boot-registrations)
+ unspecific)
+
+(define boot-registrations '())
+
(define get-predicate-tag)
(define set-predicate-tag!)
(add-boot-init!
(set! register-predicate! register-predicate!/after-boot)
unspecific)))
-(define (register-predicate!/after-boot predicate name . keylist)
- (guarantee keyword-list? keylist 'register-predicate!)
- (let ((tag
- (make-tag name
- predicate
- predicate-tagging-strategy:never
- 'register-predicate!
- (get-keyword-value keylist 'extra)
- (get-keyword-value keylist 'description))))
- (for-each (lambda (superset)
- (set-tag<=! tag (predicate->tag superset)))
- (get-keyword-values keylist '<=))
- tag))
+(define register-predicate!/after-boot
+ (named-lambda (register-predicate! predicate name . keylist)
+ (guarantee keyword-list? keylist 'register-predicate!)
+ (let ((tag
+ (make-tag name
+ predicate
+ predicate-tagging-strategy:never
+ 'register-predicate!
+ (get-keyword-value keylist 'extra)
+ (get-keyword-value keylist 'description))))
+ (for-each (lambda (superset)
+ (set-tag<=! tag (predicate->tag superset)))
+ (get-keyword-values keylist '<=))
+ tag)))
\f
(define (predicate-name predicate)
(tag-name (predicate->tag predicate 'predicate-name)))
(register-predicate! flo:flonum? 'flonum '<= real?)
- (register-mit-bytevector-predicates!)
-
;; MIT/GNU Scheme: lists
(register-predicate! alist? 'association-list '<= list?)
(register-predicate! keyword-list? 'keyword-list '<= list?)
(register-predicate! weak-list? 'weak-list)
(register-predicate! weak-pair? 'weak-pair)
- (register-ustring-predicates!)
-
- (cleanup-boot-time-record-predicates!)))
+ (run-deferred-boot-actions 'predicate-registrations)))
-(add-boot-init!
- (lambda ()
- (for-each (lambda (reg)
- (apply register-predicate! reg))
- (reverse! boot-registrations))
- (set! boot-registrations)
- unspecific))
\ No newline at end of file
+(add-boot-init! run-deferred-predicate-registrations!)
\ No newline at end of file
unspecific))
(define (initialize-record-procedures!)
- (run-deferred-boot-actions 'record-type-predicates))
+ (run-deferred-boot-actions 'record-procedures))
(define (record-type-default-value record-type field-name)
(record-type-default-value-by-index
%record-type-tag)
(define (%set-record-type-predicate! record-type predicate)
- (defer-boot-action 'record-type-predicates
+ (defer-boot-action 'predicate-registrations
(lambda ()
(%set-record-type-predicate! record-type predicate)))
(%set-record-type-tag! record-type predicate))
+(defer-boot-action 'predicate-registrations
+ (lambda ()
+ (set! %record-type-predicate
+ (named-lambda (%record-type-predicate record-type)
+ (tag->predicate (%record-type-tag record-type))))
+ (set! %set-record-type-predicate!
+ (named-lambda (%set-record-type-predicate! record-type predicate)
+ (%register-record-predicate! predicate record-type)
+ (%set-record-type-tag! record-type (predicate->tag predicate))))
+ unspecific))
+
(define (%register-record-predicate! predicate record-type)
(register-predicate! predicate
(string->symbol
%record-type-entity-tag)
(define (%set-record-type-entity-predicate! record-type predicate)
- (defer-boot-action 'record-type-predicates
+ (defer-boot-action 'predicate-registrations
(lambda ()
(%set-record-type-entity-predicate! record-type predicate)))
(%set-record-type-entity-tag! record-type predicate))
+(defer-boot-action 'predicate-registrations
+ (lambda ()
+ (set! %record-type-entity-predicate
+ (named-lambda (%record-type-entity-predicate record-type)
+ (tag->predicate (%record-type-entity-tag record-type))))
+ (set! %set-record-type-entity-predicate!
+ (named-lambda (%set-record-type-entity-predicate! record-type
+ predicate)
+ (%register-record-entity-predicate! predicate record-type)
+ (%set-record-type-entity-tag! record-type
+ (predicate->tag predicate))))
+ unspecific))
+
(define (%register-record-entity-predicate! predicate record-type)
(register-predicate! predicate
(string->symbol
(strip-angle-brackets (%record-type-name record-type))
"-entity"))
'<= record-entity?))
-
-(define (cleanup-boot-time-record-predicates!)
- (set! %record-type-predicate
- (named-lambda (%record-type-predicate record-type)
- (tag->predicate (%record-type-tag record-type))))
- (set! %set-record-type-predicate!
- (named-lambda (%set-record-type-predicate! record-type predicate)
- (%register-record-predicate! predicate record-type)
- (%set-record-type-tag! record-type (predicate->tag predicate))))
- (set! %record-type-entity-predicate
- (named-lambda (%record-type-entity-predicate record-type)
- (tag->predicate (%record-type-entity-tag record-type))))
- (set! %set-record-type-entity-predicate!
- (named-lambda (%set-record-type-entity-predicate! record-type predicate)
- (%register-record-entity-predicate! predicate record-type)
- (%set-record-type-entity-tag! record-type
- (predicate->tag predicate))))
- (run-deferred-boot-actions 'record-type-predicates))
\f
;;;; Constructors
substring
substring?
vector->string)
- (export (runtime predicate-metadata)
- register-ustring-predicates!)
(export (runtime symbol)
%ascii-ustring!
%ascii-ustring-allocate
utf32le->string
utf8->string
vector->bytevector)
- (export (runtime predicate-metadata)
- register-mit-bytevector-predicates!)
(export (runtime ucd-tables)
vector->bytevector-u16be))
error:no-such-slot
error:uninitialized-slot
record-type-field-index)
- (export (runtime predicate-metadata)
- cleanup-boot-time-record-predicates!)
(export (runtime predicate-tagging)
%record-type-descriptor
%record-type-tag)
((slice? string) (not (slice-mutable? string)))
(else (fail))))
-(define (register-ustring-predicates!)
- (register-predicate! string? 'string)
- (register-predicate! mutable-string? 'mutable-string '<= string?)
- (register-predicate! immutable-string? 'immutable-string '<= string?)
- (register-predicate! nfc-string? 'nfc-string '<= string?)
- (register-predicate! legacy-string? 'legacy-string
- '<= string?
- '<= mutable-string?)
- (register-predicate! ustring? 'unicode-string '<= string?)
- (register-predicate! slice? 'string-slice '<= string?)
- (register-predicate! 8-bit-string? '8-bit-string '<= string?))
+(defer-boot-action 'predicate-registrations
+ (lambda ()
+ (register-predicate! mutable-string? 'mutable-string '<= string?)
+ (register-predicate! immutable-string? 'immutable-string '<= string?)
+ (register-predicate! nfc-string? 'nfc-string '<= string?)
+ (register-predicate! legacy-string? 'legacy-string
+ '<= string?
+ '<= mutable-string?)
+ (register-predicate! ustring? 'unicode-string '<= string?)
+ (register-predicate! slice? 'string-slice '<= string?)
+ (register-predicate! 8-bit-string? '8-bit-string '<= string?)))
\f
;;;; Unicode string layout