#| -*-Scheme-*-
-$Id: port.scm,v 1.52 2008/01/30 20:02:33 cph Exp $
+$Id: port.scm,v 1.53 2008/02/02 01:19:10 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(define-structure (port-type (type-descriptor <port-type>)
(conc-name port-type/)
(constructor %make-port-type))
+ (parent #f read-only #t)
standard-operations
custom-operations
;; input operations:
\f
;;;; Constructors
-(define (make-port-type operations type)
+(define (make-port-type operations parent-type)
(if (not (list-of-type? operations
(lambda (elt)
(and (pair? elt)
(procedure? (cadr elt))
(null? (cddr elt))))))
(error:wrong-type-argument operations "operations list" 'MAKE-PORT-TYPE))
+ (if parent-type
+ (guarantee-port-type parent-type 'MAKE-PORT-TYPE))
(receive (standard-operations custom-operations)
- (parse-operations-list operations type)
+ (parse-operations-list operations parent-type)
(let ((op
(let ((input? (assq 'READ-CHAR standard-operations))
(output? (assq 'WRITE-CHAR standard-operations))
(let ((p (assq name standard-operations)))
(and p
(cdr p)))))))))))
- (%make-port-type standard-operations
+ (%make-port-type parent-type
+ standard-operations
custom-operations
(op 'CHAR-READY?)
(op 'READ-CHAR)
(op 'FLUSH-OUTPUT)
(op 'DISCRETIONARY-FLUSH-OUTPUT)))))
\f
-(define (parse-operations-list operations type)
+(define (parse-operations-list operations parent-type)
(parse-operations-list-1
- (if type
+ (if parent-type
(append operations
- (delete-matching-items (port-type/operations type)
+ (delete-matching-items (port-type/operations parent-type)
(let ((excluded
(append
(if (assq 'READ-CHAR operations)
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.630 2008/01/30 20:02:34 cph Exp $
+$Id: runtime.pkg,v 14.631 2008/02/02 01:19:13 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
port-type/operation
port-type/operation-names
port-type/operations
+ port-type/parent
port-type/peek-char
port-type/read-char
port-type/read-external-substring