From 3bca6ed8ac23613fa0823805e2a3bb16e85a944f Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 27 Feb 2003 21:27:58 +0000 Subject: [PATCH] Allow OPEN-INPUT-STRING to accept #F for optional arguments. --- v7/src/runtime/strnin.scm | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/v7/src/runtime/strnin.scm b/v7/src/runtime/strnin.scm index 8e3006a75..401058fb0 100644 --- a/v7/src/runtime/strnin.scm +++ b/v7/src/runtime/strnin.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: strnin.scm,v 14.11 2003/02/14 18:28:34 cph Exp $ +$Id: strnin.scm,v 14.12 2003/02/27 21:27:58 cph Exp $ Copyright 1988,1990,1993,1999,2003 Massachusetts Institute of Technology @@ -44,24 +44,20 @@ USA. (with-input-from-port (open-input-string string) thunk)) (define (open-input-string string #!optional start end) + (guarantee-string string 'OPEN-INPUT-STRING) (let ((end - (if (default-object? end) + (if (or (default-object? end) (not end)) (string-length string) - (check-index end (string-length string) 'OPEN-INPUT-STRING)))) - (make-port - input-string-port-type - (make-input-string-state string - (if (default-object? start) - 0 - (check-index start end 'OPEN-INPUT-STRING)) - end)))) - -(define (check-index index limit procedure) - (if (not (exact-nonnegative-integer? index)) - (error:wrong-type-argument index "exact non-negative integer" procedure)) - (if (not (<= index limit)) - (error:bad-range-argument index procedure)) - index) + (guarantee-substring-end-index end (string-length string) + 'OPEN-INPUT-STRING)))) + (make-port input-string-port-type + (make-input-string-state + string + (if (or (default-object? start) (not start)) + 0 + (guarantee-substring-start-index start end + 'OPEN-INPUT-STRING)) + end)))) (define input-string-port-type) -- 2.25.1