From a06134a754a37bc889e9e9ffd9320283c0ca016d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 4 Nov 1997 11:02:07 +0000 Subject: [PATCH] Define SUBSTRING->NONNEGATIVE-INTEGER. --- v7/src/edwin/nntp.scm | 11 +---------- v7/src/edwin/utils.scm | 11 ++++++++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/v7/src/edwin/nntp.scm b/v7/src/edwin/nntp.scm index 68bfebcb8..0ad7ffbe5 100644 --- a/v7/src/edwin/nntp.scm +++ b/v7/src/edwin/nntp.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: nntp.scm,v 1.15 1997/11/01 19:33:58 cph Exp $ +;;; $Id: nntp.scm,v 1.16 1997/11/04 11:02:07 cph Exp $ ;;; ;;; Copyright (c) 1995-97 Massachusetts Institute of Technology ;;; @@ -1807,15 +1807,6 @@ (define (token->number token) (or (substring->nonnegative-integer token 0 (string-length token)) (error:bad-range-argument token #f))) - -(define (substring->nonnegative-integer line start end) - (let loop ((index start) (n 0)) - (if (fix:= index end) - n - (let ((k (fix:- (vector-8b-ref line index) (char->integer #\0)))) - (and (fix:>= k 0) - (fix:< k 10) - (loop (fix:+ index 1) (+ (* n 10) k))))))) (define (substring-skip-leading-space string start end) (let loop ((index start)) diff --git a/v7/src/edwin/utils.scm b/v7/src/edwin/utils.scm index f609f0cb8..9f413a8b0 100644 --- a/v7/src/edwin/utils.scm +++ b/v7/src/edwin/utils.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: utils.scm,v 1.41 1997/11/04 09:27:31 cph Exp $ +;;; $Id: utils.scm,v 1.42 1997/11/04 11:01:25 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-97 Massachusetts Institute of Technology ;;; @@ -216,6 +216,15 @@ (cond ((string-null? x) y) ((string-null? y) x) (else (string-append x " " y)))) + +(define (substring->nonnegative-integer line start end) + (let loop ((index start) (n 0)) + (if (fix:= index end) + n + (let ((k (fix:- (vector-8b-ref line index) (char->integer #\0)))) + (and (fix:>= k 0) + (fix:< k 10) + (loop (fix:+ index 1) (+ (* n 10) k))))))) (define char-set:null (char-set)) -- 2.25.1