#| -*-Scheme-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlbase/rtlty1.scm,v 4.8 1988/08/22 20:10:18 markf Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlbase/rtlty1.scm,v 4.9 1988/08/24 16:29:46 markf Exp $
Copyright (c) 1987 Massachusetts Institute of Technology
(declare (usual-integrations))
\f
+(package (define-rtl-constructor get-rtl-constructor)
+
+;; Calls to define-rtl-constructor are generated by the define-rtl-...
+;; macros used below.
+
+(define rtl-type->constructors '())
+(define entry-rtl-type car)
+(define entry-constructor cdr)
+
+(define (put-rtl-constructor rtl-type constructor)
+ (let ((entry (assq rtl-type rtl-type->constructors)))
+ (if entry
+ (set-cdr! entry constructor)
+ (set! rtl-type->constructors
+ (cons (cons rtl-type constructor) rtl-type->constructors)))))
+
+(define-export (define-rtl-constructor rtl-type constructor)
+ (if (pair? rtl-type)
+ (for-each (lambda (rtl-type)
+ (put-constructor rtl-type constructor))
+ rtl-type)
+ (put-rtl-constructor rtl-type constructor)))
+
+(define-export (get-rtl-constructor rtl-type)
+ (let ((entry (assq rtl-type rtl-type->constructors)))
+ (if entry
+ (entry-constructor entry)
+ (error "No constructor found for this rtl type:" rtl-type))))
+) ;; end package
+\f
(define-rtl-expression char->ascii rtl: expression)
(define-rtl-expression byte-offset rtl: register number)
(define-rtl-expression register % number)